@wirecat/cli-base 0.65.1 → 0.65.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 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.2 — 29.10.2026
12
+
13
+ ### Fixed
14
+
15
+ - **`defineQuery` checks a registry object once per process.** A later call with the same object returns it at once.
16
+ An MCP server rebuilds its commands on every tool call, and each build re-ran every field's example through the
17
+ query parser. A registry changed after its first check is not checked again: build a new object instead.
18
+
11
19
  ## 0.65.1 — 29.10.2026
12
20
 
13
21
  ### Fixed
@@ -34,8 +34,12 @@ export const exampleProblems = (registry) => {
34
34
  ...defaults,
35
35
  ].filter((entry) => entry.problem !== undefined);
36
36
  };
37
+ // A long-lived process (an MCP server) rebuilds its commands on every call with the same module-level registries.
38
+ const checked = new WeakSet();
37
39
  /** One list's query: field names unique and snake_case, every example and default runs. Throws naming every problem. */
38
40
  export const defineQuery = (registry) => {
41
+ if (checked.has(registry))
42
+ return registry;
39
43
  const names = registry.fields.map((field) => field.name);
40
44
  const problems = [
41
45
  ...duplicates(names).map((name) => `"${name}" is listed twice`),
@@ -44,6 +48,7 @@ export const defineQuery = (registry) => {
44
48
  ];
45
49
  if (problems.length > 0)
46
50
  throw new RegistryError(`${registry.entity} query`, problems);
51
+ checked.add(registry);
47
52
  return registry;
48
53
  };
49
54
  const SPAN = ["span", "alternative", "guide"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-base",
3
- "version": "0.65.1",
3
+ "version": "0.65.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",