@wirecat/cli-base 0.50.3 → 0.51.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 +44 -0
- package/README.md +5 -4
- package/dist/commands/contracts.d.ts +19 -0
- package/dist/commands/contracts.js +207 -0
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands/index.js +1 -0
- package/dist/dev/audit.d.ts +5 -0
- package/dist/dev/audit.js +67 -6
- package/dist/dev/capabilities.d.ts +20 -0
- package/dist/dev/capabilities.js +48 -0
- package/dist/dev/lint.js +18 -5
- package/dist/dev/main.js +76 -6
- package/dist/dev/shared-contracts.d.ts +13 -0
- package/dist/dev/shared-contracts.js +85 -0
- package/dist/standards/audit.d.ts +1 -0
- package/dist/standards/audit.js +11 -1
- package/dist/standards/flags-how.js +6 -0
- package/dist/standards/flags-what.js +35 -0
- package/dist/standards/vocabulary.js +10 -1
- package/docs/standards/README.md +1 -0
- package/docs/standards/accounts.md +1 -2
- package/docs/standards/ci.md +5 -4
- package/docs/standards/commands.md +2 -2
- package/docs/standards/comparisons.md +133 -0
- package/docs/standards/mcp.md +27 -29
- package/docs/standards/permissions.md +1 -1
- package/package.json +1 -1
package/docs/standards/mcp.md
CHANGED
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## Scope
|
|
4
4
|
|
|
5
|
-
How a CLI serves agents over MCP: the tools it exposes, how they are built from the command tree, and
|
|
6
|
-
permission level makes visible.
|
|
5
|
+
How a CLI serves agents over MCP: the tools it exposes, how they are built from the command tree, and how permission levels control availability and execution.
|
|
7
6
|
|
|
8
7
|
**MCP** (Model Context Protocol) is how an AI agent asks a program what it can do (`tools/list`) and then calls it. A
|
|
9
8
|
**tool** is a name, a description, an input schema and the code that runs when it is called.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
1. **Rules** — what is true on cli-core 0.321.0, the version these rules were checked against. Each has a `WC-MCP` id.
|
|
14
|
-
2. **[Planned — not built yet](#planned--not-built-yet)** — the approved design that replaces hand-written tools. It
|
|
15
|
-
has no ids, because it is not true yet. Do not write code that expects it.
|
|
10
|
+
The rules below define the MCP contract. [Tools generated from commands](#tools-generated-from-commands)
|
|
11
|
+
explains how cli-core builds and filters the catalogue.
|
|
16
12
|
|
|
17
13
|
Rule ids on this page are `WC-MCP-<n>`. How to read a rule, how ids work and which rule wins are in the
|
|
18
14
|
[index](README.md).
|
|
@@ -86,18 +82,25 @@ Both declare the answer envelope (a list `{ items, page, … }` or one thing `{
|
|
|
86
82
|
- **Exceptions:** none.
|
|
87
83
|
- **Applies to:** all CLIs. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
88
84
|
|
|
89
|
-
|
|
85
|
+
<a id="wc-mcp-6--the-profiles-permissions-decide-what-is-offered-and-what-runs"></a>
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
not offered when a key it reads, such as `messages`, is `deny`. The list is built when the server starts. The personal
|
|
93
|
-
server reads the permissions again on every call, so a stricter level refuses the next call at once; a command allowed
|
|
94
|
-
after start-up appears only after a restart.
|
|
87
|
+
### WC-MCP-6 · Permissions change availability, not command existence
|
|
95
88
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
CLI help and discovery retain commands regardless of profile permissions. MCP listings and searches also
|
|
90
|
+
retain commands whose own permission, a required read permission or a process read-only lock prevents execution.
|
|
91
|
+
They report current `availability`: `available: false`, a reason and the permission key where applicable.
|
|
92
|
+
Permitted commands report `available: true`. Arguments and answer schemas remain discoverable either way.
|
|
93
|
+
|
|
94
|
+
Availability is permission information, not an execution grant. Every call rechecks the current rules before
|
|
95
|
+
performing work. Changes to profile levels update discovery availability without erasing commands or requiring
|
|
96
|
+
agents to conclude that a capability does not exist. With a named profile, CLI help and discovery annotate the
|
|
97
|
+
same local permission decision; discovery without a profile remains independent of account configuration.
|
|
98
|
+
|
|
99
|
+
- **Why:** an agent must distinguish a supported capability that is currently blocked from an unknown command.
|
|
100
|
+
- **Enforced by:** `cli-core: src/mcp/mcp.test.ts`; custom servers need the same contract.
|
|
101
|
+
- **Example:** `{ "messages.send": "deny" }` leaves `messages send` searchable with `availability: { available: false, reason: "the profile denies messages.send", permission: "messages.send" }`; calling it returns `permission_error`.
|
|
102
|
+
- **Exceptions:** transport exclusions, such as an interactive login or an unbounded process, are independent of permissions and remain documented.
|
|
103
|
+
- **Applies to:** all CLIs. **Since:** cli-core 0.408.0. **Rulings:** owner, 2026-10-24.
|
|
101
104
|
|
|
102
105
|
### WC-MCP-7 · Over MCP, `ask` counts as `allow`, and no server shows a form
|
|
103
106
|
|
|
@@ -187,26 +190,22 @@ and every write goes through the write guard ([WC-PERM-13](permissions.md#wc-per
|
|
|
187
190
|
- **Exceptions:** none.
|
|
188
191
|
- **Applies to:** all CLIs. **Since:** cli-base 0.44.0. **Rulings:** none.
|
|
189
192
|
|
|
190
|
-
|
|
193
|
+
<a id="planned--not-built-yet"></a>
|
|
191
194
|
|
|
192
|
-
|
|
193
|
-
release says it is done, the rules above describe what runs.
|
|
195
|
+
## Tools generated from commands
|
|
194
196
|
|
|
195
|
-
|
|
197
|
+
cli-core builds its personal and bot MCP catalogues from the command tree with `toolsFromCommands`
|
|
198
|
+
(`src/mcp/agent.ts`). Permission keys limit what each profile can call, including writes.
|
|
196
199
|
|
|
197
200
|
- **Tools come from commands.** The catalogue is generated from the command tree, the same data as `commands --json`.
|
|
198
201
|
A call runs the command itself, in-process, and hands back the answer object. Permissions, `ask`, effects, answers
|
|
199
|
-
and errors are
|
|
202
|
+
and errors are the CLI's own, because they are the same code. Calls share the CLI execution path.
|
|
200
203
|
- **`mcp: false` hides a command from MCP servers.** It is set on a command or a group and covers everything below it.
|
|
201
204
|
Agents that use the CLI directly are not affected.
|
|
202
|
-
|
|
203
|
-
`mcp: false` on each command it reaches.
|
|
204
|
-
- **Not built today:** no MCP server reads it yet, so setting it hides nothing.
|
|
205
|
+
`commands --json` shows `mcp: false` on each command it reaches, and cli-core omits it from the catalogue.
|
|
205
206
|
- **`mcp: false` on an option** leaves that option out of the tool's input. The first use is
|
|
206
207
|
`messages delete --for-everyone`, because an agent never deletes for everyone ([WC-PERM-11](permissions.md)).
|
|
207
|
-
|
|
208
|
-
`mcp: false` on that option alone.
|
|
209
|
-
- **Not built today:** no MCP server reads it yet, so setting it hides nothing.
|
|
208
|
+
cli-base's `annotateOption(option, { mcp: false })` sets it; cli-core omits that option from the tool input.
|
|
210
209
|
- **Never offered, by rule:** a command with a `lifetime` (`persistent`, such as `serve` and `watch`, or `interactive`,
|
|
211
210
|
such as `session start`). An agent call must return.
|
|
212
211
|
- **One server per subtree.** The personal server is built from the program without its `bot` group; the bot server
|
|
@@ -214,7 +213,6 @@ What will change:
|
|
|
214
213
|
- **The profile still decides at run time** what is listed (WC-MCP-6).
|
|
215
214
|
- **The whole catalogue is pinned** in each CLI's `contracts/mcp-tools.json`, so a command that becomes visible to
|
|
216
215
|
agents shows up as a diff in its pull request.
|
|
217
|
-
- **Every surface moves**, in this order: drive, the bot servers, memo, zoom, then the tg and max personal servers.
|
|
218
216
|
|
|
219
217
|
## Sources
|
|
220
218
|
|
|
@@ -47,7 +47,7 @@ way for a command the owner types and for an agent over MCP. A config file that
|
|
|
47
47
|
### WC-PERM-2 · There are four levels: `deny`, `readonly`, `ask`, `allow`
|
|
48
48
|
|
|
49
49
|
- `deny` — nothing, not even a read. The command answers `permission_error` (exit 5) before it connects, and an agent
|
|
50
|
-
|
|
50
|
+
still discovers the command, marked unavailable with its permission reason ([WC-MCP-6](mcp.md)).
|
|
51
51
|
- `readonly` — reads work, writes answer `permission_error`. On a key that only writes, such as `messages.delete`, it
|
|
52
52
|
is the same as `deny`.
|
|
53
53
|
- `ask` — a write asks first. See WC-PERM-9 for a terminal and [WC-MCP-7](mcp.md) for an agent.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "The parts every command line tool needs: output modes, terminal rendering, error model, exit codes, credentials, clocks",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|