@wirecat/cli-base 0.106.0 → 0.107.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 +38 -0
- package/dist/dev/main.js +6 -2
- package/dist/dev/slow-tests.d.ts +5 -1
- package/dist/dev/slow-tests.js +14 -2
- package/docs/standards/README.md +1 -1
- package/docs/standards/testing.md +22 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,44 @@ 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.107.0 — 16.11.2026
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`adaptOpenApi` reads the OpenAPI 3.1 unions Notion's API file uses**, which it refused before, so a CLI no longer
|
|
16
|
+
rewrites its spec around them. OpenAPI 3.1 takes these keywords from JSON Schema 2020-12
|
|
17
|
+
([Schema Object](https://spec.openapis.org/oas/v3.1.0.html#schema-object)):
|
|
18
|
+
- a `{"type": "null"}` member of `oneOf` or `anyOf` makes the union `nullable`; with one member left, the result is
|
|
19
|
+
that member, nullable, under the outer description. `type: [..., "null"]` beside `oneOf` or `anyOf` makes the
|
|
20
|
+
union nullable too, which it silently did not before;
|
|
21
|
+
- `anyOf` is a union, as `oneOf` is: a generated union passes when any member matches, and `oneOf`'s "exactly one" was
|
|
22
|
+
never checked. A schema with both stops generation;
|
|
23
|
+
- an `allOf` with one union member, inline or behind a `$ref`, becomes a union of `allOf`s: A and (B or C) is
|
|
24
|
+
(A and B) or (A and C). A null member of that union is left out, not made nullable: null would also have to pass
|
|
25
|
+
A, which is an object. A reference to a base with a `discriminator` keeps its meaning and is not looked through;
|
|
26
|
+
two union members, or a union that reaches itself this way, stop generation;
|
|
27
|
+
- a field that is only ever `null` (`{"type": "null"}`, `type: ["null"]`) is `unknown`: the model has no null type,
|
|
28
|
+
and accepting more is the same trade as ignoring `not`.
|
|
29
|
+
|
|
30
|
+
`exclusiveMinimum`, `exclusiveMaximum` and `maxProperties` are still refused.
|
|
31
|
+
- **`cli-dev slow-tests` (`pnpm test:slow`) warns on stderr about each test over 3 s**, and still exits 0. A slow CI
|
|
32
|
+
runner takes up to five times as long, so such a test fails the 15 s limit there while it passes on your machine;
|
|
33
|
+
twice it failed a release. Shrink the test's data; a longer timeout on that one test is not the fix.
|
|
34
|
+
- **A new rule in the handbook's [Testing](docs/standards/testing.md) page**: every repository sets
|
|
35
|
+
`testTimeout: 15_000` in `vitest.config.ts`, and a test that builds big data runs within 3 s on a developer
|
|
36
|
+
machine. A CLI on vitest's default 5 s adds the line to its `vitest.config.ts`; the template seeds it only into new
|
|
37
|
+
CLIs.
|
|
38
|
+
- **`invitation` is a shared view word**: the text that invites people to a meeting. cli-core's shared
|
|
39
|
+
`meetings invitation` passed the command lint only through a CLI's own baseline (zoom-cli's
|
|
40
|
+
`lint/baseline/unknown-verb.json`); that baseline line can go once a CLI builds on this version.
|
|
41
|
+
|
|
42
|
+
### Changed — may break callers
|
|
43
|
+
|
|
44
|
+
- **Generated types write a map as `{ [key: string]: T }`, not `Record<string, T>`.** A type alias may name itself
|
|
45
|
+
inside an index signature, not inside `Record`, so a JSON value type (string, number, boolean, null, arrays and maps
|
|
46
|
+
of itself) compiles. Every `types.ts` with a map changes, so `generate --check` reports it stale until the CLI
|
|
47
|
+
regenerates once after this bump. The types mean the same.
|
|
48
|
+
|
|
11
49
|
## 0.106.0 — 16.11.2026
|
|
12
50
|
|
|
13
51
|
### Added
|
package/dist/dev/main.js
CHANGED
|
@@ -35,7 +35,8 @@ import { matrixPage, matrixRows, parseArgvLog } from "./test-matrix.js";
|
|
|
35
35
|
import { binNameWarnings, describeWarnings, hostsWarnings, WCAT_RULES } from "./wcat-lint.js";
|
|
36
36
|
const USAGE = `usage: cli-dev <command> [options]
|
|
37
37
|
|
|
38
|
-
slow-tests [report] [count] the slowest tests and files (report: coverage/tests.json, count: 20)
|
|
38
|
+
slow-tests [report] [count] the slowest tests and files (report: coverage/tests.json, count: 20);
|
|
39
|
+
warns on stderr about each test over 3 s, and still exits 0
|
|
39
40
|
next-version <wanted> <latest> <versions-json>
|
|
40
41
|
the version bin/release publishes, given npm's answers
|
|
41
42
|
version [--sync] [--file <path>] package.json's version against src/version.ts
|
|
@@ -914,7 +915,10 @@ export const main = async (argv, io) => {
|
|
|
914
915
|
case "slow-tests": {
|
|
915
916
|
const [file = "coverage/tests.json", count = "20"] = args;
|
|
916
917
|
const parsed = JSON.parse(readFileSync(join(io.cwd, file), "utf8"));
|
|
917
|
-
|
|
918
|
+
const { out, warning } = slowTests(parsed, io.cwd, Number(count));
|
|
919
|
+
io.out(out);
|
|
920
|
+
if (warning)
|
|
921
|
+
io.err(warning);
|
|
918
922
|
return 0;
|
|
919
923
|
}
|
|
920
924
|
case "next-version": {
|
package/dist/dev/slow-tests.d.ts
CHANGED
|
@@ -10,4 +10,8 @@ export interface VitestReport {
|
|
|
10
10
|
}[];
|
|
11
11
|
}[];
|
|
12
12
|
}
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const SLOW_TEST_MS = 3000;
|
|
14
|
+
export declare const slowTests: (report: VitestReport, cwd: string, count: number) => {
|
|
15
|
+
out: string;
|
|
16
|
+
warning?: string;
|
|
17
|
+
};
|
package/dist/dev/slow-tests.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// A fifth of the 15 s limit every repository sets (WC-TEST-20): a slow CI runner takes up to five times as long.
|
|
2
|
+
export const SLOW_TEST_MS = 3000;
|
|
1
3
|
export const slowTests = (report, cwd, count) => {
|
|
2
4
|
const relative = (path) => path.slice(cwd.length + 1);
|
|
3
5
|
const tests = report.testResults
|
|
@@ -6,11 +8,21 @@ export const slowTests = (report, cwd, count) => {
|
|
|
6
8
|
const files = report.testResults
|
|
7
9
|
.map((result) => ({ ms: result.endTime - result.startTime, file: result.name }))
|
|
8
10
|
.sort((a, b) => b.ms - a.ms);
|
|
11
|
+
const line = ({ ms, file, test }) => `${ms.toFixed(0).padStart(6)} ms ${relative(file)} ${test}`;
|
|
9
12
|
const total = tests.reduce((sum, test) => sum + test.ms, 0);
|
|
10
|
-
|
|
13
|
+
const over = tests.filter((test) => test.ms > SLOW_TEST_MS);
|
|
14
|
+
const out = [
|
|
11
15
|
`${tests.length} tests, ${(total / 1000).toFixed(1)} s of test time\n\nslowest tests:`,
|
|
12
|
-
...tests.slice(0, count).map(
|
|
16
|
+
...tests.slice(0, count).map(line),
|
|
13
17
|
"\nslowest files:",
|
|
14
18
|
...files.slice(0, 10).map(({ ms, file }) => `${ms.toFixed(0).padStart(6)} ms ${relative(file)}`),
|
|
15
19
|
].join("\n");
|
|
20
|
+
if (over.length === 0)
|
|
21
|
+
return { out };
|
|
22
|
+
const warning = [
|
|
23
|
+
`warning: ${over.length} ${over.length === 1 ? "test takes" : "tests take"} over ${SLOW_TEST_MS / 1000} s, ` +
|
|
24
|
+
"a fifth of the 15 s test limit; a slow CI runner fails them. Shrink their data (WC-TEST-20):",
|
|
25
|
+
...over.map(line),
|
|
26
|
+
].join("\n");
|
|
27
|
+
return { out, warning };
|
|
16
28
|
};
|
package/docs/standards/README.md
CHANGED
|
@@ -38,7 +38,7 @@ the four steps that need a person. A new CLI is ready for its first release when
|
|
|
38
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` | 19 | Sandbox, no network, no real waits, one test time limit, 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` | 22 | 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 |
|
|
@@ -97,7 +97,8 @@ and which run after merge is in [CI](ci.md).
|
|
|
97
97
|
- **Enforced by:** review only.
|
|
98
98
|
- **Example:** waits go through an injected `SleepLike`, and `fakeClock()` from `@wirecat/cli-base/testing` records
|
|
99
99
|
them without waiting. A test harness passes `sleep: async () => {}`. `pnpm test:slow` lists the 20 slowest tests
|
|
100
|
-
and the 10 slowest files
|
|
100
|
+
and the 10 slowest files, and warns about each test over 3 s
|
|
101
|
+
([WC-TEST-20](#wc-test-20--one-test-time-limit-of-15-s-and-each-test-runs-within-3-s)). A test may wait for a local process or server it started, for example polling its
|
|
101
102
|
status with `vi.waitFor` and a timeout shorter than the test's own; that waits for an event, not for time. A
|
|
102
103
|
fixed sleep or `setTimeout` is still a wait for real time.
|
|
103
104
|
- **Exceptions:** none. A new wait in the code gets a seam, never a longer test timeout.
|
|
@@ -268,6 +269,26 @@ a captured answer, beside it or in the table it comes from.
|
|
|
268
269
|
vocabulary.
|
|
269
270
|
- **Applies to:** all CLIs that talk to a provider. **Since:** cli-base 0.80.1. **Rulings:** none.
|
|
270
271
|
|
|
272
|
+
### WC-TEST-20 · One test time limit of 15 s, and each test runs within 3 s
|
|
273
|
+
|
|
274
|
+
Every repository sets `testTimeout: 15_000` in `vitest.config.ts`. A test that builds big data, such as a thousand
|
|
275
|
+
meetings or a long conversation, sizes it so the test runs within 3 s on a developer machine: a fifth of the limit,
|
|
276
|
+
because a slow CI runner takes up to five times as long. `pnpm test:slow` warns about each test over 3 s, so it is
|
|
277
|
+
shrunk before a release runner fails it.
|
|
278
|
+
|
|
279
|
+
- **Why:** twice a release failed on a slow GitHub runner with no real wait involved, only CPU work: cli-core's test
|
|
280
|
+
of 1200 meetings, and zoom-cli's `src/answer-entities.test.ts` at 6.9 s against vitest's default 5 s. Each
|
|
281
|
+
repository had its own limit (15 s in cli-core and tg-cli, 5 s in zoom-cli, gcal-cli and max-cli), so the same
|
|
282
|
+
test passed in one and failed in another.
|
|
283
|
+
- **Enforced by:** `pnpm test:slow`.
|
|
284
|
+
- **Example:** `vitest.config.ts` has `test: { testTimeout: 15_000 }`. A test that checks paging over many meetings
|
|
285
|
+
builds as many as it needs to cross two pages, not 1200. `pnpm test:slow` ends with
|
|
286
|
+
`warning: 1 test takes over 3 s, …` and the test's line on stderr; it still exits 0.
|
|
287
|
+
- **Exceptions:** none. A longer timeout on one test is not the fix: cli-core #2980 gave the 1200-meeting test 60 s,
|
|
288
|
+
and the next slower runner fails it again. The macOS and Windows jobs of cli-base's `node-ci.yml` pass
|
|
289
|
+
`--testTimeout=20000` because those runners are slower for every test, not for one.
|
|
290
|
+
- **Applies to:** all CLIs and the shared packages. **Since:** cli-base 0.107.0. **Rulings:** owner, 2026-11-16.
|
|
291
|
+
|
|
271
292
|
## Sources
|
|
272
293
|
|
|
273
294
|
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.
|
|
3
|
+
"version": "0.107.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",
|