@wirecat/cli-base 0.65.2 → 0.65.3

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
@@ -8,6 +8,14 @@ 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.65.3 — 30.10.2026
12
+
13
+ ### Added
14
+
15
+ - **A rule against per-call state in the command tree** (`WC-ARCH-22`, [Architecture](docs/standards/architecture.md)):
16
+ the tree is built once per process and a call's state lives in a per-call context. cli-core's `run()` still
17
+ rebuilds the tree per call and is the named exception until that is reworked.
18
+
11
19
  ## 0.65.2 — 29.10.2026
12
20
 
13
21
  ### Fixed
@@ -34,7 +34,7 @@ the four steps that need a person. A new CLI is ready for its first release when
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
36
  | [Permissions](permissions.md) | `PERM` | 22 | Levels, keys, defaults, hard limits, the write guard and its journal |
37
- | [Architecture](architecture.md) | `ARCH` | 17 | Layers, dependency direction, vendor types, what goes in which package |
37
+ | [Architecture](architecture.md) | `ARCH` | 18 | Layers, dependency direction, vendor types, what goes in which package, the command tree built once |
38
38
  | [Lifecycle](lifecycle.md) | `LIFE` | 15 | Opening late, who closes, deadlines, long-running commands, the `serve` relay, resumable syncs and their request budget, the run log |
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 |
@@ -230,6 +230,25 @@ out of search and listed under `skipped`, with the hint to run that CLI once.
230
230
  - **Applies to:** cli-core and every CLI with a provider of its own. **Since:** cli-base 0.53.0. **Rulings:** none
231
231
  (Wave 3 requirements 3.2).
232
232
 
233
+ ### WC-ARCH-22 · Build the command tree once; keep each call's state out of it
234
+
235
+ The Commander tree — commands, options, help, actions — describes the CLI and is the same for every call, so it is
236
+ built once per process. What belongs to one call (its streams, signal, deadline, environment, profile and parsed
237
+ options, its hooks) lives in a per-call context that the action receives, never on the `Command` objects.
238
+
239
+ - **Why:** state written into a shared tree leaks into the next call. Commander restores option values to what they
240
+ were before the *first* parse, so a profile set on the tree before parsing becomes every later call's starting
241
+ value, and a hook added per call runs once more each time. Building a fresh tree per call avoids the leak but costs
242
+ an MCP server ~16 ms per tool call for tg.
243
+ - **Enforced by:** review only.
244
+ - **Example:** a check that always gives the same answer for the same definition (`defineQuery`'s examples,
245
+ `assertSharedContracts`) runs once per definition, not per build. A new per-call value goes into the call's context,
246
+ not into `setOptionValue`, `hook` or `provide` on the tree.
247
+ - **Exceptions:** cli-core's `run()` still builds a fresh tree per call, because it writes the call's environment,
248
+ a `preAction` hook and the profile into it; moving that to a per-call context is
249
+ [CORE-41](https://github.com/WireCatLabs/cli-core/blob/main/docs/dev/BACKLOG_LATER.md). New code does not add to it.
250
+ - **Applies to:** cli-core's command skeleton and every CLI built on it. **Since:** cli-base 0.65.3. **Rulings:** none.
251
+
233
252
  ## Sources
234
253
 
235
254
  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.65.2",
3
+ "version": "0.65.3",
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",