@procedures/mark 0.3.0 → 0.5.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 CHANGED
@@ -1,5 +1,80 @@
1
1
  # @procedures/mark
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a47bee6: The hosts can confine the file procedures to a root (roadmap R33).
8
+
9
+ - `confineFsProcedures(registry, root)` of `@procedures/fs` replaces the handler of each `fs.*` procedure of a registry with the handler of `createFsModule({ root })`. It adds no procedure. A nested `fs.*` call of another procedure is confined too. The root must be a folder that exists.
10
+ - `mark --fs-root <folder>` confines the `fs.*` procedures of each mode and host of `mark`: a command, the REPL, `--server`, `serve` and `mcp`. Give the flag before the command.
11
+ - A `mark` command uses a CLI server only when the server has the same root. The lockfile of `@procedures/peer` has the new field `fsRoot`, and `findServer()` compares it.
12
+ - `procedure-server --fs-root <folder>` and `mark serve --fs-root <folder>` confine the procedures of the server.
13
+ - The MCP server reads `MCP_FS_ROOT`, and `mark mcp` has the flag `--fs-root`. `fs` is not a tool namespace, so the tools do not change.
14
+ - A path outside the root gives `FORBIDDEN` with the reason `outside-root`. A procedure that reads files with `node:fs`, or that starts a program, is not confined.
15
+ - `@procedures/lib/cli-flags` has the global flags `--fs-root` and `--events`, and the field `repeatable`.
16
+ - a47bee6: The hosts serve the remote events (`documentation/EVENTS.md`).
17
+
18
+ - `hostPolicy()` takes the option `events`: the topic rule, with an optional bus, `allow` function and buffer. `procedureServerOptions()` gives it to the `ProcedureServer`, which pins `events.subscribe`. `HostPolicy` has the new field `events`.
19
+ - `procedure-server` and `mark serve` have the option `--events <patterns>`. The option is repeatable, and it takes comma-separated patterns: exact names, prefixes (`orders.*`) or `*`. `parseTopicPatterns()` checks them.
20
+ - `mark --server` has the same option `--events`.
21
+ - These hosts always serve `events.subscribe`. Without `--events`, they serve no topic, and each subscription gets `TOPIC_NOT_FOUND`. The bus is the global bus, which is also the `ctx.bus` of their procedures.
22
+ - The MCP server serves no events, because its transport carries only MCP.
23
+ - `mark --port`, `--host`, `--transport` and `--events` without `--server` are an error now, also before `serve` and `mcp`. Before, `mark --port 4000 serve` ignored `--port`.
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [0f75644]
28
+ - Updated dependencies [09e5566]
29
+ - Updated dependencies [ab77f75]
30
+ - Updated dependencies [a47bee6]
31
+ - Updated dependencies [a47bee6]
32
+ - Updated dependencies [64120d9]
33
+ - Updated dependencies [64120d9]
34
+ - Updated dependencies [bc74091]
35
+ - @procedures/client@0.5.0
36
+ - @procedures/server@0.5.0
37
+ - @procedures/mcp-dev-tools@0.5.0
38
+ - @procedures/peer@0.5.0
39
+ - @procedures/lib@0.5.0
40
+ - @procedures/procedure@0.5.0
41
+ - @procedures/cli-run@0.5.0
42
+ - @procedures/pnpm@0.5.0
43
+ - @procedures/shell@0.5.0
44
+ - @procedures/vitest@0.5.0
45
+
46
+ ## 0.4.0
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [d919678]
51
+ - Updated dependencies [057d69a]
52
+ - Updated dependencies [b2a1a1e]
53
+ - Updated dependencies [057d69a]
54
+ - Updated dependencies [057d69a]
55
+ - Updated dependencies [057d69a]
56
+ - Updated dependencies [057d69a]
57
+ - Updated dependencies [057d69a]
58
+ - Updated dependencies [afd6a19]
59
+ - Updated dependencies [057d69a]
60
+ - Updated dependencies [2fd2398]
61
+ - Updated dependencies [3fefa43]
62
+ - Updated dependencies [cc3f5f6]
63
+ - Updated dependencies [bae25e2]
64
+ - Updated dependencies [4c51727]
65
+ - Updated dependencies [d42d716]
66
+ - Updated dependencies [4e751da]
67
+ - @procedures/client@0.4.0
68
+ - @procedures/lib@0.4.0
69
+ - @procedures/mcp-dev-tools@0.4.0
70
+ - @procedures/procedure@0.4.0
71
+ - @procedures/shell@0.4.0
72
+ - @procedures/server@0.4.0
73
+ - @procedures/peer@0.4.0
74
+ - @procedures/cli-run@0.4.0
75
+ - @procedures/pnpm@0.4.0
76
+ - @procedures/vitest@0.4.0
77
+
3
78
  ## 0.3.0
4
79
 
5
80
  ### Minor Changes
package/README.md CHANGED
@@ -130,10 +130,11 @@ The package provides a `mark` binary for command-line usage.
130
130
 
131
131
  ```bash
132
132
  mark [global options] <path...> [positional...] [--options]
133
- mark serve [--procedures pkgs] [--port N] [--token T | --no-token] [--expose patterns]
134
- mark mcp [--bundles list] [--tool-timeout ms] [--debug]
135
- mark --server [--port N] [--host H] [--transport http|websocket|both]
133
+ mark serve [--procedures pkgs] [--port N] [--token T | --no-token] [--expose patterns] [--events topics] [--fs-root folder]
134
+ mark mcp [--bundles list] [--tool-timeout ms] [--read-only] [--http port] [--fs-root folder] [--debug]
135
+ mark --server [--port N] [--host H] [--transport http|websocket|both] [--events topics]
136
136
  mark -i
137
+ mark --fs-root <folder> <command | --server | -i | serve | mcp>
137
138
  ```
138
139
 
139
140
  The bin is `dist/bin.js`. `node dist/cli.js` also runs the CLI. Importing `@procedures/mark` runs nothing.
@@ -151,6 +152,38 @@ The bin is `dist/bin.js`. `node dist/cli.js` also runs the CLI. Importing `@proc
151
152
 
152
153
  `mark mcp <procedure>` runs an `mcp.*` procedure (for example `mark mcp listTools`), not the server. Each host gets its policy from `hostPolicy()` of `@procedures/client`.
153
154
 
155
+ #### Remote events of the hosts
156
+
157
+ `mark --server` and `mark serve` always serve the procedure `events.subscribe` ([EVENTS.md](../documentation/EVENTS.md)):
158
+
159
+ - `--events <patterns>` gives the topics that a peer can subscribe to: exact names (`orders.created`), prefixes (`orders.*`) or `*`. Repeat the flag, or separate the patterns with commas.
160
+ - Without `--events`, the host serves no topic. Each subscription gets `TOPIC_NOT_FOUND`.
161
+ - The bus is the global bus of the process. The procedures get it as `ctx.bus`, so a procedure publishes with `ctx.bus.emit()`.
162
+ - The token of the host applies to a subscription. The hosts have no capability limits, so they permit each subscription to a topic of the rule.
163
+ - `mark mcp` serves no events: MCP carries only the tool calls, and `events.subscribe` is not a tool.
164
+
165
+ ```bash
166
+ mark --server --transport both --events "orders.*"
167
+ mark serve --procedures ./my-procedures.js --events orders.created --events audit.created
168
+ ```
169
+
170
+ #### The root of the file procedures
171
+
172
+ `--fs-root <folder>` confines each path of the `fs.*` procedures to the folder (roadmap R33). It applies to each mode and host of `mark`:
173
+
174
+ - A command in this process, the REPL (`-i`) and the CLI server (`--server`): the registry of `mark` gets the root.
175
+ - `mark serve` and `mark mcp`: the root goes to their servers. `mark mcp` also reads `MCP_FS_ROOT`.
176
+ - A path outside the folder gives `FORBIDDEN` with the reason `outside-root`. A relative path starts at the folder.
177
+ - The nested `fs.*` calls of the other commands are confined too. For example, `mark --fs-root ./data lib scan` cannot list the packages of a workspace outside `./data`.
178
+ - Give `--fs-root` before the command. After the command, it is an error, because the procedures loaded without it.
179
+ - A command uses a CLI server only when the server has the same root. The lockfile of the server records its root.
180
+ - A procedure that reads files with `node:fs`, or that starts a program, is not confined. The [README of the MCP server](../impl-mcp-dev/README.md) lists them.
181
+
182
+ ```bash
183
+ mark --fs-root ./data fs read notes.txt
184
+ mark --fs-root ./data --server
185
+ ```
186
+
154
187
  #### Global Options
155
188
 
156
189
  A flag before the command path is a global flag. After the path, a flag is the command's flag when the command declares it. Otherwise it is a global flag. For example, `mark docker compose down -v` gives `-v` (volumes) to the command. To show the version, write `mark -v`. `mark lib audit` lists the command flags that hide a global flag.
@@ -163,7 +196,8 @@ A flag before the command path is a global flag. After the path, a flag is the c
163
196
  | `--format <format>` | `-f` | Override output format (text, json, table, streaming) |
164
197
  | `--local` | | Run the command in this process, not on the CLI server |
165
198
  | `--json <json>` | | Execute raw procedure reference |
166
- | `--server` | | Start the CLI server (with `--port`, `--host`, `--transport`) |
199
+ | `--fs-root <folder>` | | Confine each path of `fs.*` to the folder, also in the nested calls. Give it before the command. |
200
+ | `--server` | | Start the CLI server (with `--port`, `--host`, `--transport`, `--events`) |
167
201
  | `--interactive` | `-i` | Start the REPL |
168
202
 
169
203
  #### Exit Codes and Failures