@procedures/lib 0.3.0 → 0.4.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 +37 -0
- package/README.md +7 -43
- package/dist/.tsbuildinfo +1 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +4 -50
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +0 -58
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -92
- package/dist/types.js.map +1 -1
- package/package.json +8 -8
- package/src/module.ts +3 -60
- package/src/types.ts +1 -150
- package/dist/procedures/core/catch.d.ts +0 -33
- package/dist/procedures/core/catch.d.ts.map +0 -1
- package/dist/procedures/core/catch.js +0 -118
- package/dist/procedures/core/catch.js.map +0 -1
- package/dist/procedures/core/index.d.ts +0 -9
- package/dist/procedures/core/index.d.ts.map +0 -1
- package/dist/procedures/core/index.js +0 -8
- package/dist/procedures/core/index.js.map +0 -1
- package/dist/procedures/dag/index.d.ts +0 -5
- package/dist/procedures/dag/index.d.ts.map +0 -1
- package/dist/procedures/dag/index.js +0 -5
- package/dist/procedures/dag/index.js.map +0 -1
- package/dist/procedures/dag/traverse.d.ts +0 -54
- package/dist/procedures/dag/traverse.d.ts.map +0 -1
- package/dist/procedures/dag/traverse.js +0 -252
- package/dist/procedures/dag/traverse.js.map +0 -1
- package/src/procedures/core/catch.ts +0 -142
- package/src/procedures/core/index.ts +0 -9
- package/src/procedures/dag/index.ts +0 -5
- package/src/procedures/dag/traverse.ts +0 -281
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @procedures/lib
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2fd2398: `dag.traverse` moved from `@procedures/lib` to `@procedures/dag`. Its name, input, output and effects stay the same. In this version, `@procedures/dag` has a `./module` entry, a `./register` entry and the `client.procedures` field, and it depends on `@procedures/client` and `zod`. The graph algorithms of its root do not change.
|
|
8
|
+
|
|
9
|
+
`dag.traverse` gets the packages from `lib.scan` through `ctx.client` (`calls: ["lib.scan"]`). `@procedures/lib` depends on `@procedures/dag`, so the module of `@procedures/dag` does not list the module of `@procedures/lib` as a dependency: a host registers the two modules. `bundle-dev`, `bundle-mcp` and `mark` do. The module of `@procedures/lib` does not register `dag.traverse` any more.
|
|
10
|
+
|
|
11
|
+
`DagTraverseInputSchema`, `DagTraverseInput`, `DagTraverseOutput` and `TraverseNodeResult` are exports of `@procedures/dag`, not of `@procedures/lib`.
|
|
12
|
+
- 3fefa43: `core.catch` is removed. Use `client.tryCatch`.
|
|
13
|
+
|
|
14
|
+
`core.catch` did the same as `client.tryCatch` of `@procedures/client`. `CoreCatchInputSchema`, `CoreCatchInput`, `CoreCatchOutput` and `CoreCatchOutputSchema` are removed too. `client.tryCatch` gives no context name: a call of its `try` or `catch` operand needs no `$when: "catch"`.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [d919678]
|
|
19
|
+
- Updated dependencies [057d69a]
|
|
20
|
+
- Updated dependencies [b2a1a1e]
|
|
21
|
+
- Updated dependencies [057d69a]
|
|
22
|
+
- Updated dependencies [057d69a]
|
|
23
|
+
- Updated dependencies [057d69a]
|
|
24
|
+
- Updated dependencies [057d69a]
|
|
25
|
+
- Updated dependencies [057d69a]
|
|
26
|
+
- Updated dependencies [afd6a19]
|
|
27
|
+
- Updated dependencies [057d69a]
|
|
28
|
+
- Updated dependencies [2fd2398]
|
|
29
|
+
- Updated dependencies [3d76cb7]
|
|
30
|
+
- Updated dependencies [0ecc788]
|
|
31
|
+
- Updated dependencies [4c51727]
|
|
32
|
+
- Updated dependencies [4e751da]
|
|
33
|
+
- @procedures/client@0.4.0
|
|
34
|
+
- @procedures/dag@0.4.0
|
|
35
|
+
- @procedures/fs@0.4.0
|
|
36
|
+
- @procedures/git@0.4.0
|
|
37
|
+
- @procedures/shell@0.4.0
|
|
38
|
+
- @procedures/pnpm@0.4.0
|
|
39
|
+
|
|
3
40
|
## 0.3.0
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
npm install @procedures/lib
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
`client-lib` gives the procedures that manage the packages of the monorepo
|
|
9
|
+
`client-lib` gives the procedures that manage the packages of the monorepo.
|
|
10
10
|
|
|
11
11
|
| Procedure | Function |
|
|
12
12
|
|---|---|
|
|
@@ -16,11 +16,14 @@ npm install @procedures/lib
|
|
|
16
16
|
| `lib.rename` | Rename a package in each file of the workspace |
|
|
17
17
|
| `lib.graph` | Give the dependency graph of the workspace packages, with its cycles |
|
|
18
18
|
| `ecosystem.procedures` | List the procedures of the packages |
|
|
19
|
-
| `dag.traverse` | Start a procedure for each package, in the order of their dependencies |
|
|
20
|
-
| `core.catch` | Start a deferred call, and give the error to a handler call |
|
|
21
19
|
|
|
22
20
|
Until October 2026, `client-lib` also had `lib.install`, `lib.pull` and `lib.refresh`, for one repository per package. The monorepo does not need them, and they are gone ([DECISIONS-2026-10.md](../documentation/DECISIONS-2026-10.md)).
|
|
23
21
|
|
|
22
|
+
In version 0.3.0 and before, `client-lib` also had two runners of programs:
|
|
23
|
+
|
|
24
|
+
- `dag.traverse` moved to [`client-dag`](../client-dag) (`@procedures/dag`), with the same name. It gets the packages from `lib.scan` of this package. Thus a host registers the two modules.
|
|
25
|
+
- `core.catch` is removed. It did the same as `client.tryCatch` of `@procedures/client`. Use `client.tryCatch`.
|
|
26
|
+
|
|
24
27
|
## Use
|
|
25
28
|
|
|
26
29
|
```typescript
|
|
@@ -89,47 +92,8 @@ node packages/mark/dist/cli.js lib graph
|
|
|
89
92
|
|
|
90
93
|
Input: `rootPath`, `namespace` and `includeMetadata`. The output lists the procedures of the packages that have a `client.procedures` field.
|
|
91
94
|
|
|
92
|
-
## `dag.traverse`
|
|
93
|
-
|
|
94
|
-
`dag.traverse` starts the `visit` procedure once for each package, with `cwd` set to the folder of the package. A package starts after the packages that it depends on.
|
|
95
|
-
|
|
96
|
-
| Field | Default | Function |
|
|
97
|
-
|---|---|---|
|
|
98
|
-
| `visit` | | A procedure path, or a call with `$when: "$parent"` (or `$never`) |
|
|
99
|
-
| `filter` | | Only these package names |
|
|
100
|
-
| `root` | | Only this package and the packages that it depends on |
|
|
101
|
-
| `rootPath` | the workspace | The workspace root |
|
|
102
|
-
| `concurrency` | 4 | The number of visits at the same time |
|
|
103
|
-
| `serialize` | `auto` | When the visits in one git repository start one at a time: `auto` (when the visit uses a `git` procedure), `repository` (always) or `none` |
|
|
104
|
-
| `continueOnError` | false | Continue after a failed visit |
|
|
105
|
-
| `dryRun` | false | Give the plan only |
|
|
106
|
-
|
|
107
|
-
All packages of the monorepo are in one git repository. Concurrent `git add` commands fail on `index.lock`, so `auto` starts git visits one at a time (deep dive DATA-17).
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
await client.exec(["dag", "traverse"], {
|
|
111
|
-
visit: { $proc: ["pnpm", "run"], input: { script: "build" }, $when: "$parent" },
|
|
112
|
-
root: "@procedures/fs",
|
|
113
|
-
});
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
`dag.traverse` has the tag `runs-refs`: it starts the refs of its input. Thus a server with an `expose` rule lets it use only exposed procedures. A call in `visit` with `$when: "dag.traverse"` waits for this runner ([PROGRAM-FORMAT.md](../documentation/PROGRAM-FORMAT.md), section 5).
|
|
117
|
-
|
|
118
|
-
## `core.catch`
|
|
119
|
-
|
|
120
|
-
`core.catch` starts the `try` call. When it fails, `core.catch` starts the `handler` call with the error in its input (`success: false`, `error`, `proc`). Give both calls `$when: "catch"`, so that they wait for this runner.
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
await client.exec(["core", "catch"], {
|
|
124
|
-
try: { $proc: ["git", "commit"], input: { message: "auto" }, $when: "catch" },
|
|
125
|
-
handler: { $proc: ["client", "identity"], input: { value: { continue: true } }, $when: "catch" },
|
|
126
|
-
});
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
The output gives `success`, `result`, `error` and `continue`. The calls of the `try` input start inside the error handling (deep dive DATA-22).
|
|
130
|
-
|
|
131
95
|
## Related packages
|
|
132
96
|
|
|
133
|
-
- `client-dag`: the graph algorithms of `dag.traverse`.
|
|
97
|
+
- `client-dag`: the graph algorithms of `lib.graph`, and the procedure `dag.traverse`, which uses `lib.scan`.
|
|
134
98
|
- `client-procedure`: `procedure.new`, the scaffold of a procedure.
|
|
135
99
|
- `mark`: the CLI that starts these procedures.
|