@procedures/lib 0.1.0 → 0.2.1
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 +37 -0
- package/README.md +2 -2
- 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 -2
- 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 +25 -1
- package/dist/module.js.map +1 -1
- package/dist/procedures/lib/new.d.ts +5 -3
- package/dist/procedures/lib/new.d.ts.map +1 -1
- package/dist/procedures/lib/new.js +51 -16
- package/dist/procedures/lib/new.js.map +1 -1
- package/dist/register.d.ts +3 -6
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +4 -14
- package/dist/register.js.map +1 -1
- package/package.json +11 -8
- package/src/index.ts +1 -2
- package/src/module.ts +26 -1
- package/src/procedures/lib/new.ts +53 -16
- package/src/register.ts +4 -16
- package/dist/scoped-input.d.ts +0 -17
- package/dist/scoped-input.d.ts.map +0 -1
- package/dist/scoped-input.js +0 -23
- package/dist/scoped-input.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Library management procedures for the workspace - scan, new, audit, rename.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
export * from "./module.js";
|
|
7
7
|
export * from "./types.js";
|
|
8
8
|
export { libScan, libRename, libNew, libAudit, } from "./procedures/lib/index.js";
|
|
9
9
|
export { ecosystemProcedures, EcosystemProceduresInputSchema, } from "./procedures/ecosystem/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAG3B,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Library management procedures for the workspace - scan, new, audit, rename.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
import "./register.js";
|
|
6
|
+
export * from "./module.js";
|
|
8
7
|
// Re-export types
|
|
9
8
|
export * from "./types.js";
|
|
10
9
|
// Re-export procedures
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,aAAa,CAAC;AAE5B,kBAAkB;AAClB,cAAc,YAAY,CAAC;AAE3B,uBAAuB;AACvB,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,2BAA2B,CAAC;AAEnC,iCAAiC;AACjC,OAAO,EACL,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,iCAAiC,CAAC;AAQzC,+CAA+C;AAC/C,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,0BAA0B;AAC1B,OAAO,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,+FAA+F;AAC/F,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC"}
|
package/dist/module.d.ts
CHANGED
|
@@ -6,11 +6,17 @@
|
|
|
6
6
|
* This is the canonical home for lib.* procedures.
|
|
7
7
|
* client-cli no longer registers these to avoid duplicates.
|
|
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 libModule: ProcedureModule;
|
|
15
15
|
export default libModule;
|
|
16
|
+
/**
|
|
17
|
+
* This function registers the procedures of @procedures/lib, 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 registerLibProcedures(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,EAA4D,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA4D,KAAK,eAAe,EAAuC,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAmMjL;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,eAYG,CAAC;eAEb,SAAS;AAExB;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,GAAE,iBAAsC,GAAG,IAAI,CAE5F"}
|
package/dist/module.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This is the canonical home for lib.* procedures.
|
|
7
7
|
* client-cli no longer registers these to avoid duplicates.
|
|
8
8
|
*/
|
|
9
|
-
import { createProcedure, zodAdapter, RUNS_REFS_TAG, defineModule } from "@procedures/client";
|
|
9
|
+
import { createProcedure, zodAdapter, RUNS_REFS_TAG, defineModule, PROCEDURE_REGISTRY, registerModules } from "@procedures/client";
|
|
10
10
|
import gitModule from "@procedures/git/module";
|
|
11
11
|
import fsModule from "@procedures/fs/module";
|
|
12
12
|
import { libScan, libRename, libNew, libAudit, } from "./procedures/lib/index.js";
|
|
@@ -24,6 +24,7 @@ const libScanProcedure = createProcedure()
|
|
|
24
24
|
.meta({
|
|
25
25
|
description: "Scan for packages in the git directory",
|
|
26
26
|
calls: ["fs.readdir", "fs.read.json", "git.status", "git.remote"],
|
|
27
|
+
effects: { reads: ["fs"], writes: [] },
|
|
27
28
|
args: [],
|
|
28
29
|
shorts: {},
|
|
29
30
|
output: "json",
|
|
@@ -39,6 +40,8 @@ const libRenameProcedure = createProcedure()
|
|
|
39
40
|
.meta({
|
|
40
41
|
description: "Rename a package across the ecosystem",
|
|
41
42
|
calls: ["fs.glob", "fs.read.json", "fs.write", "fs.exists"],
|
|
43
|
+
// It rewrites package.json files and TypeScript imports of the whole workspace
|
|
44
|
+
effects: { reads: ["fs"], writes: ["fs"] },
|
|
42
45
|
args: ["oldName", "newName"],
|
|
43
46
|
shorts: { dryRun: "n" },
|
|
44
47
|
output: "json",
|
|
@@ -54,6 +57,10 @@ const libNewProcedure = createProcedure()
|
|
|
54
57
|
.meta({
|
|
55
58
|
description: "Create a new package in the ecosystem",
|
|
56
59
|
calls: ["shell.run", "fs.exists", "fs.mkdir", "fs.write", "fs.read.json"],
|
|
60
|
+
// It starts the cue-config CLI from the node_modules of the workspace: code of the project,
|
|
61
|
+
// so it writes process. That CLI writes only files of the new package folder. An existing
|
|
62
|
+
// folder is an error, so the procedure overwrites nothing.
|
|
63
|
+
effects: { reads: ["fs"], writes: ["fs", "process"], destructive: false },
|
|
57
64
|
args: ["name"],
|
|
58
65
|
shorts: { dryRun: "n" },
|
|
59
66
|
output: "json",
|
|
@@ -69,6 +76,9 @@ const libAuditProcedure = createProcedure()
|
|
|
69
76
|
.meta({
|
|
70
77
|
description: "Audit ecosystem packages for issues",
|
|
71
78
|
calls: ["fs.readdir", "fs.read.json", "git.status", "git.remote", "fs.exists", "fs.mkdir", "fs.write"],
|
|
79
|
+
// It reads the registry for the flag notices. With `fix`, it makes only the missing folders
|
|
80
|
+
// and files, so a second call changes nothing more.
|
|
81
|
+
effects: { reads: ["fs", "registry"], writes: ["fs"], destructive: false, idempotent: true },
|
|
72
82
|
args: [],
|
|
73
83
|
shorts: { fix: "f" },
|
|
74
84
|
output: "json",
|
|
@@ -86,6 +96,8 @@ const ecosystemProceduresProcedure = createProcedure()
|
|
|
86
96
|
.output(zodAdapter(EcosystemProceduresOutputSchema))
|
|
87
97
|
.meta({
|
|
88
98
|
description: "List all procedures across the ecosystem",
|
|
99
|
+
// It imports the register file of each package: that code runs, and it registers procedures
|
|
100
|
+
effects: { reads: ["fs", "registry"], writes: ["process", "registry"] },
|
|
89
101
|
args: [],
|
|
90
102
|
shorts: { namespace: "n" },
|
|
91
103
|
output: "json",
|
|
@@ -105,6 +117,8 @@ const dagTraverseProcedure = createProcedure()
|
|
|
105
117
|
description: "Traverse ecosystem packages in dependency order, executing visit procedure for each",
|
|
106
118
|
// It runs the procedure refs of its input: a server with an expose rule limits what they call
|
|
107
119
|
tags: [RUNS_REFS_TAG],
|
|
120
|
+
// Its own effect is the scan of the workspace. The admission examines each visit call.
|
|
121
|
+
effects: { reads: ["fs"], writes: [] },
|
|
108
122
|
args: [],
|
|
109
123
|
shorts: { root: "r", concurrency: "j", continueOnError: "c", dryRun: "d" },
|
|
110
124
|
output: "streaming",
|
|
@@ -124,6 +138,8 @@ const coreCatchProcedure = createProcedure()
|
|
|
124
138
|
description: "Execute a procedure with error handling",
|
|
125
139
|
// It runs the procedure refs of its input: a server with an expose rule limits what they call
|
|
126
140
|
tags: [RUNS_REFS_TAG],
|
|
141
|
+
// Control flow: no effects of its own. The admission examines each nested call.
|
|
142
|
+
effects: { reads: [], writes: [] },
|
|
127
143
|
args: [],
|
|
128
144
|
shorts: {},
|
|
129
145
|
output: "json",
|
|
@@ -153,4 +169,12 @@ export const libModule = defineModule("@procedures/lib", [
|
|
|
153
169
|
coreCatchProcedure,
|
|
154
170
|
], [fsModule, gitModule]);
|
|
155
171
|
export default libModule;
|
|
172
|
+
/**
|
|
173
|
+
* This function registers the procedures of @procedures/lib, and of the modules that it requires, in
|
|
174
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
175
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
176
|
+
*/
|
|
177
|
+
export function registerLibProcedures(registry = PROCEDURE_REGISTRY) {
|
|
178
|
+
registerModules(registry, [libModule]);
|
|
179
|
+
}
|
|
156
180
|
//# 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,aAAa,EAAE,YAAY,EAAwB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAwB,kBAAkB,EAAE,eAAe,EAA0B,MAAM,oBAAoB,CAAC;AACjL,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,+BAA+B,GAGhC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EAapB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,MAAM,gBAAgB,GAAG,eAAe,EAAE;KACvC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KACrB,KAAK,CAAC,UAAU,CAAe,kBAAkB,CAAC,CAAC;KACnD,MAAM,CAAC,UAAU,CAAgB,mBAAmB,CAAC,CAAC;KACtD,IAAI,CAAC;IACJ,WAAW,EAAE,wCAAwC;IACrD,KAAK,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,YA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ChB,kBAAkB;IAClB,eAAe;IACf,iBAAiB;IACjB,yBAAyB;IACzB,4BAA4B;IAC5B,oCAAoC;IACpC,oBAAoB;IACpB,oBAAoB;IACpB,kBAAkB;CACnB,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAE5B,eAAe,SAAS,CAAC;AAEzB;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAQ,GAAsB,kBAAkB;IACpF,eAAe,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* lib.new procedure
|
|
3
3
|
*
|
|
4
4
|
* Creates a new client package in the workspace, at packages/<name>, with the
|
|
5
|
-
* structure the other client packages have: cue-config files, src/
|
|
6
|
-
*
|
|
7
|
-
* "client.procedures" field.
|
|
5
|
+
* structure the other client packages have: cue-config files, src/module.ts (the procedures as
|
|
6
|
+
* data), src/register.ts (the only file with a side effect), src/index.ts, src/types.ts, the
|
|
7
|
+
* "./module" and "./register" exports and the "client.procedures" field. Importing the package
|
|
8
|
+
* root registers nothing (ARCHITECTURE-PROPOSALS-2026-10, P9). `mark procedure new` then adds
|
|
9
|
+
* procedures to the module, and they compile.
|
|
8
10
|
* Uses fs.* and shell.* procedures via ctx.client.call() for all operations.
|
|
9
11
|
*
|
|
10
12
|
* After it, run `pnpm install` and `pnpm build` in the workspace root.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/procedures/lib/new.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/procedures/lib/new.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA+FhE;;GAEG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,CA0I7F"}
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
* lib.new procedure
|
|
3
3
|
*
|
|
4
4
|
* Creates a new client package in the workspace, at packages/<name>, with the
|
|
5
|
-
* structure the other client packages have: cue-config files, src/
|
|
6
|
-
*
|
|
7
|
-
* "client.procedures" field.
|
|
5
|
+
* structure the other client packages have: cue-config files, src/module.ts (the procedures as
|
|
6
|
+
* data), src/register.ts (the only file with a side effect), src/index.ts, src/types.ts, the
|
|
7
|
+
* "./module" and "./register" exports and the "client.procedures" field. Importing the package
|
|
8
|
+
* root registers nothing (ARCHITECTURE-PROPOSALS-2026-10, P9). `mark procedure new` then adds
|
|
9
|
+
* procedures to the module, and they compile.
|
|
8
10
|
* Uses fs.* and shell.* procedures via ctx.client.call() for all operations.
|
|
9
11
|
*
|
|
10
12
|
* After it, run `pnpm install` and `pnpm build` in the workspace root.
|
|
11
13
|
*/
|
|
12
14
|
import { join } from "node:path";
|
|
13
15
|
import { packagesDir, resolveWorkspaceRoot } from "../../workspace.js";
|
|
14
|
-
//
|
|
15
|
-
const INDEX_TS = `//
|
|
16
|
-
export * from "./
|
|
16
|
+
// The root registers nothing: `import "<package>/register"` or `createRegistry()` registers the procedures
|
|
17
|
+
const INDEX_TS = `// The root registers nothing: import "<package>/register", or give the module to createRegistry()
|
|
18
|
+
export * from "./module.js";
|
|
17
19
|
export * from "./types.js";
|
|
18
20
|
`;
|
|
19
21
|
// \`mark procedure new\` appends the types of each procedure, and adds the zod import then.
|
|
@@ -26,22 +28,50 @@ const TYPES_TS = `/**
|
|
|
26
28
|
|
|
27
29
|
export {};
|
|
28
30
|
`;
|
|
29
|
-
|
|
31
|
+
/** The names of a package folder in code: "my-package" gives "myPackage" and "MyPackage". */
|
|
32
|
+
function codeNames(name) {
|
|
33
|
+
const pascal = name
|
|
34
|
+
.split(/[^A-Za-z0-9]+/)
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.map((part) => part[0].toUpperCase() + part.slice(1))
|
|
37
|
+
.join("");
|
|
38
|
+
return { camel: pascal[0].toLowerCase() + pascal.slice(1), pascal };
|
|
39
|
+
}
|
|
40
|
+
function moduleTs(name, packageName) {
|
|
41
|
+
const { camel, pascal } = codeNames(name);
|
|
30
42
|
return `/**
|
|
31
|
-
*
|
|
43
|
+
* The procedures of ${packageName} as data. Importing this file registers nothing.
|
|
32
44
|
*
|
|
33
|
-
* Add each procedure of this package to the registerProcedures() array.
|
|
34
45
|
* Scaffold a procedure with: mark procedure new <name> --path packages/${name}
|
|
35
46
|
*/
|
|
36
47
|
|
|
37
|
-
import {
|
|
48
|
+
import { defineModule, registerModules, PROCEDURE_REGISTRY, type ProcedureModule, type ProcedureRegistry } from "@procedures/client";
|
|
49
|
+
|
|
50
|
+
export const ${camel}Module: ProcedureModule = defineModule("${packageName}", []);
|
|
51
|
+
|
|
52
|
+
export default ${camel}Module;
|
|
38
53
|
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
/**
|
|
55
|
+
* This function registers the procedures of ${packageName} in a registry. The default is the
|
|
56
|
+
* global registry.
|
|
57
|
+
*/
|
|
58
|
+
export function register${pascal}Procedures(registry: ProcedureRegistry = PROCEDURE_REGISTRY): void {
|
|
59
|
+
registerModules(registry, [${camel}Module]);
|
|
41
60
|
}
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
function registerTs(name, packageName) {
|
|
64
|
+
const { pascal } = codeNames(name);
|
|
65
|
+
return `/**
|
|
66
|
+
* Importing this file registers the procedures of ${packageName} in the global registry:
|
|
67
|
+
* \`import "${packageName}/register"\`. The package root registers nothing.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
import { register${pascal}Procedures } from "./module.js";
|
|
71
|
+
|
|
72
|
+
export * from "./module.js";
|
|
42
73
|
|
|
43
|
-
|
|
44
|
-
register();
|
|
74
|
+
register${pascal}Procedures();
|
|
45
75
|
`;
|
|
46
76
|
}
|
|
47
77
|
/**
|
|
@@ -92,6 +122,7 @@ export async function libNew(input, ctx) {
|
|
|
92
122
|
}
|
|
93
123
|
const files = [
|
|
94
124
|
join(packagePath, "src", "index.ts"),
|
|
125
|
+
join(packagePath, "src", "module.ts"),
|
|
95
126
|
join(packagePath, "src", "register.ts"),
|
|
96
127
|
join(packagePath, "src", "types.ts"),
|
|
97
128
|
join(packagePath, "dependencies.json"),
|
|
@@ -106,7 +137,7 @@ export async function libNew(input, ctx) {
|
|
|
106
137
|
packagePath,
|
|
107
138
|
created: [`${packagePath}/`, `${join(packagePath, "src")}/`, ...files],
|
|
108
139
|
operations: [
|
|
109
|
-
"Would create packages/" + input.name + " with src/index.ts, src/register.ts and src/types.ts",
|
|
140
|
+
"Would create packages/" + input.name + " with src/index.ts, src/module.ts, src/register.ts and src/types.ts",
|
|
110
141
|
`Would run cue-config init --preset ${input.preset}`,
|
|
111
142
|
"Would run cue-config generate",
|
|
112
143
|
`Would set the package name to ${packageName}, the exports, client.procedures and the client dependency`,
|
|
@@ -122,7 +153,8 @@ export async function libNew(input, ctx) {
|
|
|
122
153
|
created.push(`${packagePath}/`, `${join(packagePath, "src")}/`);
|
|
123
154
|
for (const [file, content] of [
|
|
124
155
|
[join(packagePath, "src", "index.ts"), INDEX_TS],
|
|
125
|
-
[join(packagePath, "src", "
|
|
156
|
+
[join(packagePath, "src", "module.ts"), moduleTs(input.name, packageName)],
|
|
157
|
+
[join(packagePath, "src", "register.ts"), registerTs(input.name, packageName)],
|
|
126
158
|
[join(packagePath, "src", "types.ts"), TYPES_TS],
|
|
127
159
|
]) {
|
|
128
160
|
await ctx.client.call(["fs", "write"], { path: file, content });
|
|
@@ -144,8 +176,11 @@ export async function libNew(input, ctx) {
|
|
|
144
176
|
pkgJson["name"] = packageName;
|
|
145
177
|
pkgJson["exports"] = {
|
|
146
178
|
".": { types: "./dist/index.d.ts", import: "./dist/index.js" },
|
|
179
|
+
"./module": { types: "./dist/module.d.ts", import: "./dist/module.js" },
|
|
147
180
|
"./register": { types: "./dist/register.d.ts", import: "./dist/register.js" },
|
|
148
181
|
};
|
|
182
|
+
// Only the register entry has a side effect, so a bundler can drop the rest
|
|
183
|
+
pkgJson["sideEffects"] = ["./dist/register.js"];
|
|
149
184
|
pkgJson["client"] = { procedures: "./dist/register.js" };
|
|
150
185
|
pkgJson["dependencies"] = {
|
|
151
186
|
...(pkgJson["dependencies"] ?? {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new.js","sourceRoot":"","sources":["../../../src/procedures/lib/new.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"new.js","sourceRoot":"","sources":["../../../src/procedures/lib/new.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AASvE,2GAA2G;AAC3G,MAAM,QAAQ,GAAG;;;CAGhB,CAAC;AAEF,4FAA4F;AAC5F,sEAAsE;AACtE,MAAM,QAAQ,GAAG;;;;;;;CAOhB,CAAC;AAEF,6FAA6F;AAC7F,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,MAAM,GAAG,IAAI;SAChB,KAAK,CAAC,eAAe,CAAC;SACtB,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACrD,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;A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MAAM,CAAC,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,WAAW;QACX,WAAW;QACX,OAAO;QACP,UAAU;QACV,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/register.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Importing this file registers the procedures of @procedures/lib
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Importing this file registers the procedures of @procedures/lib, and of the modules that it
|
|
3
|
+
* requires, in the global registry: `import "@procedures/lib/register"`. The package root and the
|
|
4
|
+
* `./module` entry register nothing (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
5
5
|
*/
|
|
6
|
-
import "@procedures/fs";
|
|
7
|
-
import "@procedures/git";
|
|
8
6
|
export * from "./module.js";
|
|
9
|
-
export declare function registerLibProcedures(): void;
|
|
10
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,19 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Importing this file registers the procedures of @procedures/lib
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Importing this file registers the procedures of @procedures/lib, and of the modules that it
|
|
3
|
+
* requires, in the global registry: `import "@procedures/lib/register"`. The package root and the
|
|
4
|
+
* `./module` entry register nothing (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
// them, so client-lib works alone. (Docs review DOC-5: before, lib.scan alone found no packages,
|
|
8
|
-
// and over MCP its git calls failed with NOT_FOUND.)
|
|
9
|
-
import "@procedures/fs";
|
|
10
|
-
import "@procedures/git";
|
|
11
|
-
import { registerProcedures } from "@procedures/client";
|
|
12
|
-
import { libModule } from "./module.js";
|
|
6
|
+
import { registerLibProcedures } from "./module.js";
|
|
13
7
|
export * from "./module.js";
|
|
14
|
-
export function registerLibProcedures() {
|
|
15
|
-
registerProcedures(libModule.procedures);
|
|
16
|
-
}
|
|
17
|
-
// Auto-register when this module is loaded
|
|
18
8
|
registerLibProcedures();
|
|
19
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,
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,cAAc,aAAa,CAAC;AAE5B,qBAAqB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@procedures/lib",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "Workspace procedures for pnpm monorepos: scan the packages, scaffold a new package, audit packages against a template, rename across the workspace, and program runners.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"monorepo",
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"types": "./dist/module.d.ts",
|
|
35
35
|
"import": "./dist/module.js"
|
|
36
36
|
},
|
|
37
|
+
"./register": {
|
|
38
|
+
"types": "./dist/register.d.ts",
|
|
39
|
+
"import": "./dist/register.js"
|
|
40
|
+
},
|
|
37
41
|
"./cli-flags": {
|
|
38
42
|
"types": "./dist/cli-flags.d.ts",
|
|
39
43
|
"import": "./dist/cli-flags.js"
|
|
@@ -48,7 +52,6 @@
|
|
|
48
52
|
"CHANGELOG.md"
|
|
49
53
|
],
|
|
50
54
|
"sideEffects": [
|
|
51
|
-
"./dist/index.js",
|
|
52
55
|
"./dist/register.js"
|
|
53
56
|
],
|
|
54
57
|
"engines": {
|
|
@@ -65,12 +68,12 @@
|
|
|
65
68
|
"vitest": "^5.0.3"
|
|
66
69
|
},
|
|
67
70
|
"dependencies": {
|
|
68
|
-
"@procedures/client": "0.1
|
|
69
|
-
"@procedures/dag": "0.1
|
|
70
|
-
"@procedures/fs": "0.1
|
|
71
|
-
"@procedures/git": "0.1
|
|
72
|
-
"@procedures/pnpm": "0.1
|
|
73
|
-
"@procedures/shell": "0.1
|
|
71
|
+
"@procedures/client": "0.2.1",
|
|
72
|
+
"@procedures/dag": "0.2.1",
|
|
73
|
+
"@procedures/fs": "0.2.1",
|
|
74
|
+
"@procedures/git": "0.2.1",
|
|
75
|
+
"@procedures/pnpm": "0.2.1",
|
|
76
|
+
"@procedures/shell": "0.2.1",
|
|
74
77
|
"ts-morph": "^24.0.0",
|
|
75
78
|
"zod": "^4.6.5"
|
|
76
79
|
},
|
package/src/index.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* Library management procedures for the workspace - scan, new, audit, rename.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import "./register.js";
|
|
7
|
+
export * from "./module.js";
|
|
9
8
|
|
|
10
9
|
// Re-export types
|
|
11
10
|
export * from "./types.js";
|
package/src/module.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* client-cli no longer registers these to avoid duplicates.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { createProcedure, zodAdapter, RUNS_REFS_TAG, defineModule, type ProcedureModule } from "@procedures/client";
|
|
10
|
+
import { createProcedure, zodAdapter, RUNS_REFS_TAG, defineModule, type ProcedureModule, PROCEDURE_REGISTRY, registerModules, type ProcedureRegistry } from "@procedures/client";
|
|
11
11
|
import gitModule from "@procedures/git/module";
|
|
12
12
|
import fsModule from "@procedures/fs/module";
|
|
13
13
|
import {
|
|
@@ -64,6 +64,7 @@ const libScanProcedure = createProcedure()
|
|
|
64
64
|
.meta({
|
|
65
65
|
description: "Scan for packages in the git directory",
|
|
66
66
|
calls: ["fs.readdir", "fs.read.json", "git.status", "git.remote"],
|
|
67
|
+
effects: { reads: ["fs"], writes: [] },
|
|
67
68
|
args: [],
|
|
68
69
|
shorts: {},
|
|
69
70
|
output: "json",
|
|
@@ -80,6 +81,8 @@ const libRenameProcedure = createProcedure()
|
|
|
80
81
|
.meta({
|
|
81
82
|
description: "Rename a package across the ecosystem",
|
|
82
83
|
calls: ["fs.glob", "fs.read.json", "fs.write", "fs.exists"],
|
|
84
|
+
// It rewrites package.json files and TypeScript imports of the whole workspace
|
|
85
|
+
effects: { reads: ["fs"], writes: ["fs"] },
|
|
83
86
|
args: ["oldName", "newName"],
|
|
84
87
|
shorts: { dryRun: "n" },
|
|
85
88
|
output: "json",
|
|
@@ -96,6 +99,10 @@ const libNewProcedure = createProcedure()
|
|
|
96
99
|
.meta({
|
|
97
100
|
description: "Create a new package in the ecosystem",
|
|
98
101
|
calls: ["shell.run", "fs.exists", "fs.mkdir", "fs.write", "fs.read.json"],
|
|
102
|
+
// It starts the cue-config CLI from the node_modules of the workspace: code of the project,
|
|
103
|
+
// so it writes process. That CLI writes only files of the new package folder. An existing
|
|
104
|
+
// folder is an error, so the procedure overwrites nothing.
|
|
105
|
+
effects: { reads: ["fs"], writes: ["fs", "process"], destructive: false },
|
|
99
106
|
args: ["name"],
|
|
100
107
|
shorts: { dryRun: "n" },
|
|
101
108
|
output: "json",
|
|
@@ -112,6 +119,9 @@ const libAuditProcedure = createProcedure()
|
|
|
112
119
|
.meta({
|
|
113
120
|
description: "Audit ecosystem packages for issues",
|
|
114
121
|
calls: ["fs.readdir", "fs.read.json", "git.status", "git.remote", "fs.exists", "fs.mkdir", "fs.write"],
|
|
122
|
+
// It reads the registry for the flag notices. With `fix`, it makes only the missing folders
|
|
123
|
+
// and files, so a second call changes nothing more.
|
|
124
|
+
effects: { reads: ["fs", "registry"], writes: ["fs"], destructive: false, idempotent: true },
|
|
115
125
|
args: [],
|
|
116
126
|
shorts: { fix: "f" },
|
|
117
127
|
output: "json",
|
|
@@ -131,6 +141,8 @@ const ecosystemProceduresProcedure = createProcedure()
|
|
|
131
141
|
.output(zodAdapter<EcosystemProceduresOutput>(EcosystemProceduresOutputSchema))
|
|
132
142
|
.meta({
|
|
133
143
|
description: "List all procedures across the ecosystem",
|
|
144
|
+
// It imports the register file of each package: that code runs, and it registers procedures
|
|
145
|
+
effects: { reads: ["fs", "registry"], writes: ["process", "registry"] },
|
|
134
146
|
args: [],
|
|
135
147
|
shorts: { namespace: "n" },
|
|
136
148
|
output: "json",
|
|
@@ -152,6 +164,8 @@ const dagTraverseProcedure = createProcedure()
|
|
|
152
164
|
description: "Traverse ecosystem packages in dependency order, executing visit procedure for each",
|
|
153
165
|
// It runs the procedure refs of its input: a server with an expose rule limits what they call
|
|
154
166
|
tags: [RUNS_REFS_TAG],
|
|
167
|
+
// Its own effect is the scan of the workspace. The admission examines each visit call.
|
|
168
|
+
effects: { reads: ["fs"], writes: [] },
|
|
155
169
|
args: [],
|
|
156
170
|
shorts: { root: "r", concurrency: "j", continueOnError: "c", dryRun: "d" },
|
|
157
171
|
output: "streaming",
|
|
@@ -173,6 +187,8 @@ const coreCatchProcedure = createProcedure()
|
|
|
173
187
|
description: "Execute a procedure with error handling",
|
|
174
188
|
// It runs the procedure refs of its input: a server with an expose rule limits what they call
|
|
175
189
|
tags: [RUNS_REFS_TAG],
|
|
190
|
+
// Control flow: no effects of its own. The admission examines each nested call.
|
|
191
|
+
effects: { reads: [], writes: [] },
|
|
176
192
|
args: [],
|
|
177
193
|
shorts: {},
|
|
178
194
|
output: "json",
|
|
@@ -205,3 +221,12 @@ export const libModule: ProcedureModule = defineModule("@procedures/lib", [
|
|
|
205
221
|
], [fsModule, gitModule]);
|
|
206
222
|
|
|
207
223
|
export default libModule;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* This function registers the procedures of @procedures/lib, and of the modules that it requires, in
|
|
227
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
228
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
229
|
+
*/
|
|
230
|
+
export function registerLibProcedures(registry: ProcedureRegistry = PROCEDURE_REGISTRY): void {
|
|
231
|
+
registerModules(registry, [libModule]);
|
|
232
|
+
}
|