@wirecat/cli-base 0.80.0 → 0.80.2
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 +19 -0
- package/dist/standards/flags-crm.d.ts +2 -0
- package/dist/standards/flags-crm.js +38 -0
- package/dist/standards/flags-what.js +7 -0
- package/dist/standards/vocabulary.js +3 -1
- package/docs/standards/README.md +7 -5
- package/docs/standards/architecture.md +15 -5
- package/docs/standards/lifecycle.md +39 -4
- package/docs/standards/new-cli.md +28 -3
- package/docs/standards/permissions.md +34 -2
- package/docs/standards/testing.md +21 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,25 @@ Versions before 0.8.0 are in the [git tags](https://github.com/WireCatLabs/cli-b
|
|
|
8
8
|
Every entry says what changed as a caller sees it, why, and what to watch for — the rules are
|
|
9
9
|
[`docs/dev/CONVENTIONS.md`](docs/dev/CONVENTIONS.md#the-changelog).
|
|
10
10
|
|
|
11
|
+
## 0.80.2 — 06.11.2026
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **CRM flags in the vocabulary** (role `value`): `--pipeline <pipeline>`, `--stage <stage>`, `--amount <decimal>`,
|
|
16
|
+
`--currency <code>`, `--close-date <date>` and `--owner <user>`. cli-core's shared `deals` and `leads` write commands
|
|
17
|
+
(`create`, `update`) take them, so a CRM CLI that mounts them needs no lint override. `--owner` is the CRM user a
|
|
18
|
+
record is assigned to, not `--assignee`, which names people by their stored UID.
|
|
19
|
+
|
|
20
|
+
## 0.80.1 — 06.11.2026
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **`--field <key=value>` is a vocabulary flag** (role `value`): sets one named field on a write, and is repeated for
|
|
25
|
+
more, as `gh api --field key=value` does. b24 sets a CRM's custom fields with it on `create` and `update`. The issue
|
|
26
|
+
first asked for `--set`, but max-cli's `--set <id>` already names a sticker set, and one flag must keep one meaning.
|
|
27
|
+
- **`fields` in the resource vocabulary:** a record type's field definitions, with code, label, type and options, such
|
|
28
|
+
as a CRM's custom fields (`b24 <profile> fields list deals`).
|
|
29
|
+
|
|
11
30
|
## 0.80.0 — 06.11.2026
|
|
12
31
|
|
|
13
32
|
### Added
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const CRM_FLAGS = [
|
|
2
|
+
{
|
|
3
|
+
name: "--pipeline",
|
|
4
|
+
value: "<pipeline>",
|
|
5
|
+
role: "value",
|
|
6
|
+
type: "string",
|
|
7
|
+
meaning: "a CRM pipeline: pipeline:<id>, or a name only one pipeline has",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: "--stage",
|
|
11
|
+
value: "<stage>",
|
|
12
|
+
role: "value",
|
|
13
|
+
type: "string",
|
|
14
|
+
meaning: "a stage of the record's pipeline, by the CRM's id or its name",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "--amount",
|
|
18
|
+
value: "<decimal>",
|
|
19
|
+
role: "value",
|
|
20
|
+
type: "string",
|
|
21
|
+
meaning: "a sum of money as a decimal, such as 1500.50, in --currency",
|
|
22
|
+
},
|
|
23
|
+
{ name: "--currency", value: "<code>", role: "value", type: "string", meaning: "an ISO 4217 code, such as EUR" },
|
|
24
|
+
{
|
|
25
|
+
name: "--close-date",
|
|
26
|
+
value: "<date>",
|
|
27
|
+
role: "value",
|
|
28
|
+
type: "time",
|
|
29
|
+
meaning: "the day a deal or lead is expected to close, YYYY-MM-DD",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "--owner",
|
|
33
|
+
value: "<user>",
|
|
34
|
+
role: "value",
|
|
35
|
+
type: "id",
|
|
36
|
+
meaning: "the CRM user a record is assigned to, by the CRM's id",
|
|
37
|
+
},
|
|
38
|
+
];
|
|
@@ -731,6 +731,13 @@ export const WHAT_FLAGS = [
|
|
|
731
731
|
type: "id",
|
|
732
732
|
meaning: "never show this chat in it; repeat it for more",
|
|
733
733
|
},
|
|
734
|
+
{
|
|
735
|
+
name: "--field",
|
|
736
|
+
value: "<key=value>",
|
|
737
|
+
role: "value",
|
|
738
|
+
type: "string",
|
|
739
|
+
meaning: "set one named field on a write, as key=value; repeat it for more",
|
|
740
|
+
},
|
|
734
741
|
{
|
|
735
742
|
name: "--file",
|
|
736
743
|
value: "<file>",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { CALENDAR_FLAGS } from "./flags-calendar.js";
|
|
3
|
+
import { CRM_FLAGS } from "./flags-crm.js";
|
|
3
4
|
import { HOW_FLAGS } from "./flags-how.js";
|
|
4
5
|
import { MAIL_FLAGS } from "./flags-mail.js";
|
|
5
6
|
import { PRIVACY_FLAGS } from "./flags-privacy.js";
|
|
@@ -264,6 +265,7 @@ const collections = [
|
|
|
264
265
|
["stages", "steps of a pipeline, each open, won or lost"],
|
|
265
266
|
["products", "goods and services the owner sells, with their prices"],
|
|
266
267
|
["users", "people who work in the owner's account at a service, such as a CRM's employees"],
|
|
268
|
+
["fields", "a record type's field definitions: code, label, type and options, such as a CRM's custom fields"],
|
|
267
269
|
[
|
|
268
270
|
"identities",
|
|
269
271
|
"ways to reach a person or an organization: an account in one messenger or mailbox, an e-mail address, a phone",
|
|
@@ -394,5 +396,5 @@ export const VOCABULARY = defineVocabulary({
|
|
|
394
396
|
],
|
|
395
397
|
views: views.map(([entry, meaning]) => ({ word: entry, meaning })),
|
|
396
398
|
roots: roots.map(([entry, meaning]) => ({ word: entry, meaning })),
|
|
397
|
-
flags: [...HOW_FLAGS, ...WHAT_FLAGS, ...PRIVACY_FLAGS, ...CALENDAR_FLAGS, ...MAIL_FLAGS],
|
|
399
|
+
flags: [...HOW_FLAGS, ...WHAT_FLAGS, ...PRIVACY_FLAGS, ...CALENDAR_FLAGS, ...MAIL_FLAGS, ...CRM_FLAGS],
|
|
398
400
|
});
|
package/docs/standards/README.md
CHANGED
|
@@ -33,12 +33,12 @@ the four steps that need a person. A new CLI is ready for its first release when
|
|
|
33
33
|
| [Output](output.md) | `OUT` | 24 | Data on stdout only, envelopes, errors, exit codes, partial answers, projection |
|
|
34
34
|
| [MCP](mcp.md) | `MCP` | 13 | The MCP tools, how they come from commands, what each permission shows |
|
|
35
35
|
| [Accounts](accounts.md) | `ACCT` | 12 | The explicit profile, reads across accounts, scope flags, linked identities, sign-in commands |
|
|
36
|
-
| [Permissions](permissions.md) | `PERM` |
|
|
36
|
+
| [Permissions](permissions.md) | `PERM` | 23 | Levels, keys, defaults, hard limits, the write guard and its journal, handing the keys to cli-core |
|
|
37
37
|
| [Architecture](architecture.md) | `ARCH` | 19 | Layers, dependency direction, vendor types, what goes in which package, the command tree built once |
|
|
38
|
-
| [Lifecycle](lifecycle.md) | `LIFE` |
|
|
38
|
+
| [Lifecycle](lifecycle.md) | `LIFE` | 16 | Opening late, who closes, deadlines, long-running commands, the `serve` relay, resumable syncs and their request budget, the run log, provider requests inside the run |
|
|
39
39
|
| [Store](store.md) | `STORE` | 14 | Store areas, account scope, migrations, test isolation |
|
|
40
40
|
| [Data model](data-model.md) | `DATA` | 9 | Core entities, entities and source records, `external_id`, field names, links and duplicates, files, calendar entries |
|
|
41
|
-
| [Testing](testing.md) | `TEST` |
|
|
41
|
+
| [Testing](testing.md) | `TEST` | 18 | Sandbox, no network, no real waits, leak tests, coverage, contracts, test matrix, parity, fakes as strict as the service |
|
|
42
42
|
| [Security](security.md) | `SECR` | 24 | Secrets, logs, keyring, argv, error text, untrusted text, scanners, workflow hardening, reporting, OAuth sign-in and which app it uses, meeting secrets, keyring in moved-folder runs |
|
|
43
43
|
| [Documents](docs.md) | `DOC` | 21 | User pages and developer pages, generated pages, current facts, changelog, repository page |
|
|
44
44
|
| [Comparisons](comparisons.md) | `CMP` | 11 | Which tools a comparison page lists, rows as user tasks, agents and safety, where others are better, proof of marks |
|
|
@@ -71,7 +71,7 @@ Every rule has the same shape. A rule may add a sentence or a short list under i
|
|
|
71
71
|
### WC-<AREA>-<n> · <the rule, in one short sentence>
|
|
72
72
|
|
|
73
73
|
- **Why:** <one line>.
|
|
74
|
-
- **Enforced by:** <check names in backticks, joined by " · ">,
|
|
74
|
+
- **Enforced by:** <check names in backticks, joined by " · ">, "review only", or "review only, check planned: <the check>".
|
|
75
75
|
- **Example:** <a command or a piece of code that keeps the rule>.
|
|
76
76
|
- **Exceptions:** <when the rule does not apply>, or "none".
|
|
77
77
|
- **Applies to:** <all CLIs, or which ones>. **Since:** cli-base <version>. **Rulings:** <ids>, or "none".
|
|
@@ -85,7 +85,9 @@ Every rule has the same shape. A rule may add a sentence or a short list under i
|
|
|
85
85
|
- a check in another repository, as `<repo>: <check>`, such as `cli-core: pnpm parity:check` or
|
|
86
86
|
`cli-core: biome noRestrictedImports`. `<repo>` is the repository's name on GitHub: `cli-core`, `cli-testing`,
|
|
87
87
|
`cli-docs`, `community`, `tg-cli`, `max-cli`, `cli-memo`, `drive-cli`, `zoom-cli`, `whatsapp-cli` or `gcal-cli`. `<app>`
|
|
88
|
-
stands for each CLI the rule applies to, when every one of them runs that check in its own repository
|
|
88
|
+
stands for each CLI the rule applies to, when every one of them runs that check in its own repository;
|
|
89
|
+
- no check yet: "review only", or "review only, check planned: <the check>" when one is designed but not built.
|
|
90
|
+
The planned check is plain words, not backticks, so nobody reads it as a check that runs.
|
|
89
91
|
- **Since** is the cli-base release whose handbook first carried the rule. A feature can be older than its rule.
|
|
90
92
|
|
|
91
93
|
## How ids work
|
|
@@ -81,17 +81,27 @@ at start-up and the `serve` relay are in [Lifecycle](lifecycle.md); the store's
|
|
|
81
81
|
|
|
82
82
|
### WC-ARCH-5 · Build a feature that another provider could have as a shared command behind a capability
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
A shared domain is built in cli-core before the first CLI of its kind: its commands and its write port. Until they
|
|
85
|
+
land, that CLI builds only its connection to the service: the transport, the mappers from the provider's answers to
|
|
86
|
+
cli-core's entities, and the adapter behind cli-core's ports. CRM is the first domain built this way; others follow.
|
|
87
|
+
|
|
88
|
+
- **Why:** a command written once in cli-core gives every provider of a kind the same path, flags and output. A CLI
|
|
89
|
+
that builds the commands first ships a second shape for the same paths and entity, and cli-core's later breaks it.
|
|
85
90
|
- **Enforced by:** review only.
|
|
86
91
|
- **Example:** topics and polls are port groups and shared commands in cli-core. A messenger that lacks a capability
|
|
87
92
|
refuses the command; it does not silently do less. A bot is another messenger with fewer capabilities, and tg and
|
|
88
93
|
max share the bot code. Calendars have the same shape: cli-core's `addCalendarCommands` builds `calendars`,
|
|
89
94
|
`sync`, `store status`, `events` and `search` over the `CalendarSource` and `CalendarWriter` ports, and mounts
|
|
90
|
-
`calendars busy` or the event writes only when the provider has them.
|
|
95
|
+
`calendars busy` or the event writes only when the provider has them. CRM: cli-core builds `addCrmCommands`
|
|
96
|
+
(`deals`, `leads`, `pipelines`, `stages`) and a write port (`create`, `update`, `move`, `close`, `remove`, each
|
|
97
|
+
with its `operation_id`); b24 builds the Bitrix24 transport, the mappers and the adapter, and mounts cli-core's
|
|
98
|
+
commands.
|
|
91
99
|
- **Exceptions:** a feature stays in one CLI only when the other providers cannot have it, such as MAX's socket server,
|
|
92
|
-
Telegram's app registration, or gcal's generated `api` commands.
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
Telegram's app registration, or gcal's generated `api` commands. Known gap, as of 2026-11-06: b24 has its own CRM
|
|
101
|
+
reads and writes, built before cli-core's, and moves to cli-core's when they land.
|
|
102
|
+
- **Applies to:** messenger CLIs (tg, max, wa), calendar CLIs (gcal) and CRM CLIs (b24). **Since:** cli-base 0.41.0
|
|
103
|
+
(CRM, and the shared domain built first: cli-base 0.80.1). **Rulings:** NEED-820, NEED-440, NEED-301, NEED-444,
|
|
104
|
+
NEED-2298.
|
|
95
105
|
|
|
96
106
|
### WC-ARCH-6 · Replace a use case, not a command
|
|
97
107
|
|
|
@@ -139,12 +139,25 @@ command fails with `timeout` (exit 9).
|
|
|
139
139
|
|
|
140
140
|
### WC-LIFE-9 · Never let an abort hide a write that was in flight
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
The same holds when a write's answer is lost: a timeout, a reset connection or a server error after the request
|
|
143
|
+
left. The transport sends a write once and never resends it on its own, with or without an idempotency key. The one
|
|
144
|
+
exception is a provider that a live check
|
|
145
|
+
([WC-TEST-18](testing.md#wc-test-18--check-the-real-service-by-hand-never-in-the-test-suite)) showed keeps one copy
|
|
146
|
+
for a repeated key; the transport names that check where it resends. Otherwise the command fails with
|
|
147
|
+
`outcome_unknown` and names the write's `operation_id`, and the caller repeats it only with `--operation-id`
|
|
148
|
+
([WC-OUT-20](output.md#wc-out-20--mark-a-failure-safe-to-retry-only-when-repeating-it-cannot-do-harm)).
|
|
149
|
+
|
|
150
|
+
- **Why:** a caller that sees "cancelled" might repeat a send that already went out. A transport that resends on its
|
|
151
|
+
own makes the same second write with nobody asking: bitrix24-cli resent writes up to three times with an
|
|
152
|
+
idempotency key that nobody had checked the portal honours.
|
|
153
|
+
- **Enforced by:** `cli-core: src/cli/deadline.test.ts` · `cli-core: src/cli/execution.test.ts` · a CLI's own
|
|
154
|
+
transport: review only, check planned: a transport test that a write whose answer is lost is sent once and ends in
|
|
155
|
+
outcome_unknown.
|
|
144
156
|
- **Example:** when a timeout or a signal cuts a write that already left, the run fails with `outcome_unknown` and
|
|
145
|
-
names the write's `operation_id`. It is never retried automatically.
|
|
157
|
+
names the write's `operation_id`. It is never retried automatically. A read may still be retried by the transport.
|
|
146
158
|
- **Exceptions:** none.
|
|
147
|
-
- **Applies to:** CLIs that run on cli-core's `run()
|
|
159
|
+
- **Applies to:** CLIs that run on cli-core's `run()`; the transport's single send, every CLI that writes to a
|
|
160
|
+
provider. **Since:** cli-base 0.41.0 (a lost answer and the single send: cli-base 0.80.1). **Rulings:** none.
|
|
148
161
|
|
|
149
162
|
### WC-LIFE-10 · Mark a long command `cooperative` when it should stop at its own pace and keep its work
|
|
150
163
|
|
|
@@ -284,6 +297,28 @@ status command answers how far it is
|
|
|
284
297
|
- **Applies to:** every CLI with a sync. **Since:** cli-base 0.65.0. **Rulings:** the owner's deadlines and request
|
|
285
298
|
budgets (2026-10-27).
|
|
286
299
|
|
|
300
|
+
## Requests to the provider
|
|
301
|
+
|
|
302
|
+
### WC-LIFE-17 · Send every request to the provider inside cli-core's command run, with the run's events
|
|
303
|
+
|
|
304
|
+
A command reaches the provider only inside its run: `baseContext(command, …).run((events) => …)`, a cli-core command
|
|
305
|
+
factory, or `startRecording` in a program of its own. It hands that run's `events` to the transport. A helper that
|
|
306
|
+
builds settings with `resolveSettings` and calls the provider outside the run loses everything the run gives.
|
|
307
|
+
|
|
308
|
+
- **Why:** outside the run there is no `--timeout` deadline
|
|
309
|
+
([WC-LIFE-5](#wc-life-5--bound-every-one-shot-command-by-a-deadline)), no record of a success, no request in the
|
|
310
|
+
run's events, no `run_id` or `duration_ms` in `meta`, and none of an MCP server's stricter levels. bitrix24-cli's
|
|
311
|
+
own `contextOf` shipped that way, and `missing-run-log` passed, since cli-core keeps every failed command as a run
|
|
312
|
+
anyway.
|
|
313
|
+
- **Enforced by:** review only, check planned: a cli-core test kit contract that runs each remote command against the
|
|
314
|
+
CLI's fake with --record and expects a run named after the command, the request in its events, and a timeout (exit
|
|
315
|
+
9) from a fake that never answers.
|
|
316
|
+
- **Example:** gcal's `api` command calls
|
|
317
|
+
`baseContext(command, configuration.resolveSettings).run((events) => use(googleApi({ ...options, events })))`.
|
|
318
|
+
`b24 work deals list --json` answers a `run_id` that names `deals-list`.
|
|
319
|
+
- **Exceptions:** known gap, as of 2026-11-06: beeline's `session` commands build their own context and enter no run.
|
|
320
|
+
- **Applies to:** every CLI that reaches a provider. **Since:** cli-base 0.80.1. **Rulings:** none.
|
|
321
|
+
|
|
287
322
|
## Sources
|
|
288
323
|
|
|
289
324
|
These documents explain the rules on this page in more detail. Where one of them disagrees with this page, this page
|
|
@@ -138,9 +138,34 @@ All of these pass on `main`, before the first release:
|
|
|
138
138
|
- `pnpm docs:check`, with `--pages`, and the CLI's `generate:check`
|
|
139
139
|
- the changelog guard on a pull request
|
|
140
140
|
- `pnpm release:check`
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
- a live check of the real service before each release
|
|
142
|
+
([WC-TEST-18](testing.md#wc-test-18--check-the-real-service-by-hand-never-in-the-test-suite)), recorded in the
|
|
143
|
+
repository: the version, the date, the script and pass or fail. The owner runs it, or says yes to an agent's run.
|
|
144
|
+
|
|
145
|
+
Two more tests are a fresh agent's, since no machine check reads how a command runs.
|
|
146
|
+
|
|
147
|
+
**After every slice** (one planned piece of work, merged), an implementation review. Give the agent this handbook,
|
|
148
|
+
the repository, the plan, the public exports of cli-core and cli-base (their `package.json` exports and type
|
|
149
|
+
declarations in `node_modules`) and the source of the reference CLIs that `AGENTS.md` names. It answers each item
|
|
150
|
+
below with a `file:line`:
|
|
151
|
+
|
|
152
|
+
1. Each command that reaches the provider does so inside cli-core's run
|
|
153
|
+
([WC-LIFE-17](lifecycle.md#wc-life-17--send-every-request-to-the-provider-inside-cli-cores-command-run-with-the-runs-events)).
|
|
154
|
+
2. Each helper the CLI wrote (a context, a transport, a retry, a pacer, paging, an error mapper) names the cli-core
|
|
155
|
+
or cli-base export that already does it, or says "none found" with the search it ran.
|
|
156
|
+
3. Each provider field name, method name and error code has a source: a documentation link or a captured answer
|
|
157
|
+
([WC-TEST-19](testing.md#wc-test-19--a-fake-refuses-what-the-real-service-refuses-and-every-provider-name-has-a-source)).
|
|
158
|
+
4. No hand-written command sits in a group that cli-core owns or will own
|
|
159
|
+
([WC-ARCH-5](architecture.md#wc-arch-5--build-a-feature-that-another-provider-could-have-as-a-shared-command-behind-a-capability)).
|
|
160
|
+
5. Each pattern taken from a reference CLI keeps this handbook; a reference can be wrong.
|
|
161
|
+
6. Scripts in `bin/` and examples in the docs use flags and `--json` fields that exist.
|
|
162
|
+
7. One pass or fail line for each "review only" rule on the [Permissions](permissions.md),
|
|
163
|
+
[Lifecycle](lifecycle.md) and [Security](security.md) pages.
|
|
164
|
+
|
|
165
|
+
Its report goes in the slice's pull request, and each finding is fixed there or listed as a follow-up.
|
|
166
|
+
|
|
167
|
+
**Before the first release**, an audit. Give a fresh agent only this handbook's [index](README.md), the new repository
|
|
168
|
+
and the cli-base workflow files its own workflows pin
|
|
144
169
|
([WC-CI-8](ci.md#wc-ci-8--call-cli-base-node-ciyml-from-ciyml-pinned-to-a-tag-or-commit)), and ask it to audit the
|
|
145
170
|
CLI. Every gap it lists is either a gap in the CLI, to fix before the first release, or a hole in the
|
|
146
171
|
handbook, to fix here.
|
|
@@ -347,6 +347,15 @@ A messenger's keys come from its resources (`messages`, `chats`). Any other CLI
|
|
|
347
347
|
`events.delete.series`, is checked by every path that can do the same thing, the CLI's own generic API commands
|
|
348
348
|
included. A gcal `api` call that deletes an event with `sendUpdates: "all"` checks `events.notify` as well as
|
|
349
349
|
its own `api.calendar.events.delete`; otherwise the generic path is a way round the shared key.
|
|
350
|
+
- **Command keys on every path.** The same holds for a command's own key. Every path that reaches a provider method
|
|
351
|
+
also checks the key of each command that does the same thing: the passthrough `api call <method>`, and a field
|
|
352
|
+
that implies another action. A deal's stage in an `update` or `create` body is a move, so it checks `deals.move`
|
|
353
|
+
as well as `deals.update`. The run checks each key through its keyed write guard; `commandPermissions({ alsoChecks })`
|
|
354
|
+
declares the same keys, so `--dry-run` shows each one. gcal's `events update` declares the `api.calendar.events.*`
|
|
355
|
+
keys its run checks.
|
|
356
|
+
- **Passthrough methods.** A passthrough command maps each provider method it knows to its keys. A method that is not
|
|
357
|
+
in the map is `ask`. A method family that can message people or publish (send mail, post to a feed, notify, open a
|
|
358
|
+
chat) is `deny` until the owner allows it.
|
|
350
359
|
- **Read-only lock and guard.** `<PREFIX>_READ_ONLY` refuses every write to the service, as in WC-PERM-12. Every
|
|
351
360
|
write runs through cli-core's write guard with `permissionDefaults: configuration.permissions.defaults`
|
|
352
361
|
(cli-core 0.455.0), so `ask` is a y/N question at a terminal (WC-PERM-9) and every attempt goes into the send journal
|
|
@@ -355,7 +364,9 @@ A messenger's keys come from its resources (`messages`, `chats`). Any other CLI
|
|
|
355
364
|
`commandPermissions`; a CLI made from it adds the call with its first such command.
|
|
356
365
|
|
|
357
366
|
- **Why:** one permission model for every CLI; a CLI-own layer drifts from the shared one and is audited by nobody.
|
|
358
|
-
- **Enforced by:** `cli-core: src/cli/command-permissions.test.ts` · `cli-core: src/calendar/cli/writes.test.ts
|
|
367
|
+
- **Enforced by:** `cli-core: src/cli/command-permissions.test.ts` · `cli-core: src/calendar/cli/writes.test.ts` ·
|
|
368
|
+
a CLI's own passthrough and implied actions: review only, check planned: a table test that each write method the
|
|
369
|
+
passthrough reaches, and each field that implies another action, checks the command key.
|
|
359
370
|
- **Example:** a calendar CLI takes cli-core's `CALENDAR_WRITE_DEFAULTS` and `CALENDAR_WRITE_KEYS`
|
|
360
371
|
(`@wirecat/cli-core/calendar`, cli-core 0.458.0). By this rule `events create`, `update`, `respond` and `move` are
|
|
361
372
|
`allow` and `events delete` is `ask`. `events.delete.series` (every occurrence of a repeating series, in every
|
|
@@ -367,7 +378,28 @@ A messenger's keys come from its resources (`messages`, `chats`). Any other CLI
|
|
|
367
378
|
`remote-meetings` key with `levelFor`, and memo uses cli-core's permissions for the shared commands only. None of
|
|
368
379
|
them declares `commandPermissions` yet.
|
|
369
380
|
- **Applies to:** every CLI that writes and is not a messenger. **Since:** cli-base 0.64.0 (the levels and the shared
|
|
370
|
-
keys on every path: cli-base 0.65.0
|
|
381
|
+
keys on every path: cli-base 0.65.0; command keys on every path and passthrough methods: cli-base 0.80.1).
|
|
382
|
+
**Rulings:** NEED-1857, NEED-1883.
|
|
383
|
+
|
|
384
|
+
### WC-PERM-23 · Hand cli-core the whole configuration with its permission table, and the MCP server the same table
|
|
385
|
+
|
|
386
|
+
The program definition passes `configuration` as it is, not a struct of its parts. `{ resolveSettings }` alone drops
|
|
387
|
+
`permissions`: cli-core then skips the check of each command's key, so a `deny` on a read stops nothing, and
|
|
388
|
+
`--dry-run` shows no key. The MCP server gets the same table: `appMcpCommand(IDENTITY, configuration, …)`, or
|
|
389
|
+
`toolsFromCommands(commands, { permissions: configuration.permissions, … })` in a server of the CLI's own. Otherwise
|
|
390
|
+
each tool's `available` and `level` come from the messenger's keys, not the CLI's.
|
|
391
|
+
|
|
392
|
+
- **Why:** a `deny` that stops nothing is worse than no setting, since the owner believes it holds. bitrix24-cli
|
|
393
|
+
ignored every read `deny`, on the command line and over MCP, for three releases. The type accepts the partial
|
|
394
|
+
struct, so nothing warned.
|
|
395
|
+
- **Enforced by:** review only, check planned: a cli-dev lint probe that sets the first remote command to deny in an
|
|
396
|
+
empty home and expects exit 5 before any request, on the command line and over MCP.
|
|
397
|
+
- **Example:** gcal's `src/program.ts` passes `configuration` to the definition and to
|
|
398
|
+
`appMcpCommand(IDENTITY, configuration, …)`. With `{ "deals": "deny" }` in the profile, `b24 work deals list`
|
|
399
|
+
exits 5 (`permission_error`) and sends nothing.
|
|
400
|
+
- **Exceptions:** known gaps, as of 2026-11-06: beeline's definition passes only `resolveSettings`, and the MCP
|
|
401
|
+
servers of cli-template, b24 and beeline call `toolsFromCommands` without `permissions`.
|
|
402
|
+
- **Applies to:** every CLI on cli-core's `run()`. **Since:** cli-base 0.80.1. **Rulings:** none.
|
|
371
403
|
|
|
372
404
|
## Sources
|
|
373
405
|
|
|
@@ -241,6 +241,27 @@ and which run after merge is in [CI](ci.md).
|
|
|
241
241
|
chat (the chat with themselves). It never writes to another person, and still runs only with the owner's yes.
|
|
242
242
|
- **Applies to:** all CLIs that talk to a real account. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
243
243
|
|
|
244
|
+
### WC-TEST-19 · A fake refuses what the real service refuses, and every provider name has a source
|
|
245
|
+
|
|
246
|
+
A fake provider, a scripted adapter or a local fake server
|
|
247
|
+
([WC-TEST-3](#wc-test-3--no-test-contacts-a-provider-or-the-network)), checks each request the way the service does.
|
|
248
|
+
It refuses an unknown method, an unknown field in a select, a filter or a body, an unknown parameter and a missing
|
|
249
|
+
required field, with the error the service gives. Its vocabulary comes from the provider's published schema or a
|
|
250
|
+
captured answer, kept as a fixture of names only, never typed from memory. The same holds for every provider field
|
|
251
|
+
name, method name and error code in the CLI's code: each has a source, a link to the provider's documentation page or
|
|
252
|
+
a captured answer, beside it or in the table it comes from.
|
|
253
|
+
|
|
254
|
+
- **Why:** a fake that accepts anything passes a test for a request the service refuses. bitrix24-cli asked for three
|
|
255
|
+
invented field names; every test passed, and the owner's portal refused each whole call over one unknown name.
|
|
256
|
+
- **Enforced by:** review only, check planned: a strict fake helper in cli-base testing, built from a captured or
|
|
257
|
+
documented schema, that refuses unknown fields and parameters.
|
|
258
|
+
- **Example:** gcal checks every request against its generated Google Discovery manifest before it leaves
|
|
259
|
+
(`validateRequest` in `src/api-contract.ts`), so a test cannot send a parameter Google does not know. A CRM fake
|
|
260
|
+
refuses an unknown `select` name with the portal's own error, from a captured `crm.item.fields` answer.
|
|
261
|
+
- **Exceptions:** a fake for an unofficial protocol with no schema keeps the names seen in captured frames as its
|
|
262
|
+
vocabulary.
|
|
263
|
+
- **Applies to:** all CLIs that talk to a provider. **Since:** cli-base 0.80.1. **Rulings:** none.
|
|
264
|
+
|
|
244
265
|
## Sources
|
|
245
266
|
|
|
246
267
|
These documents explain the rules on this page in more detail. Where one of them disagrees with this page, this page
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.2",
|
|
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",
|