@wirecat/cli-base 0.108.0 → 0.110.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 CHANGED
@@ -8,6 +8,64 @@ 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.110.0 — 17.11.2026
12
+
13
+ ### Added
14
+
15
+ - **`node-ci.yml` warns about each test over 3 s** ([WC-TEST-20](docs/standards/testing.md#wc-test-20--one-test-time-limit-of-15-s-and-each-test-runs-within-3-s)).
16
+ The test run also writes Vitest's JSON report to `coverage/tests.json`, and a `slow tests` step runs
17
+ `cli-dev slow-tests` on it: the slowest tests and files in the log, and a warning annotation for each test over 3 s.
18
+ It never fails the job. With `test-shards` it runs in the `coverage` job on the merged report, so every shard's
19
+ tests count. A run with no report or no `cli-dev` gets a notice instead. A caller gets it by moving its
20
+ `uses: …/node-ci.yml@<sha>` pin; the 3 s warning needs `@wirecat/cli-base` 0.107.0 or later in its lockfile, and an
21
+ older one prints only the slowest tests. No `vitest.config.ts` changes.
22
+ - **The vocabulary has `upload`, `publish`, `unpublish` and `stale`, and the flag `--tab <id>`.** drive-cli and
23
+ notion-cli kept `files upload` as an override and cli-core's shared `memories stale` and `memories extract --tab` in
24
+ a baseline; yandex-disk-cli needs the same words and `files publish` / `files unpublish` for a public link. A new
25
+ documents CLI now passes `cli-dev lint` without either.
26
+ `cli-dev lint` fails on a baseline or override entry the vocabulary now covers: at their next bump, drive-cli drops
27
+ `files upload`, `memories stale` and `memories extract --tab` from `lint/baseline/`, and notion-cli drops
28
+ `memories stale`, `memories extract --tab` and its `files upload` override.
29
+ - **`meta.query`: what a search made of its query before it searched.** An optional, typed block of the answer
30
+ envelope's `meta`: `{ chat?: { word, chat_id, title }, respelled?: [{ word, tried }] }`. `chat` says a word of the
31
+ query named one chat and the search ran in it; `respelled` lists each unknown word and the known spellings tried in
32
+ its place. A program or an MCP client reads the decision instead of parsing the note. `meta` stays strict: any other
33
+ key is still refused. See
34
+ [WC-OUT-7](docs/standards/output.md#wc-out-7--put-the-facts-about-the-run-in-meta).
35
+
36
+ ### Changed — may break callers
37
+
38
+ - **`node-ci.yml` names the test reporters on the command line**: `default`, `github-actions` and `json`, in the
39
+ unsharded test run and in the shard merge. That is Vitest's own default in CI plus the JSON report, but it replaces
40
+ any `reporters` a caller sets in `vitest.config.ts`; none sets one today.
41
+
42
+ ### Fixed
43
+
44
+ - **`cli-dev slow-tests` with no report names the file and how to write it**, and exits 1, instead of a stack trace.
45
+
46
+ ## 0.109.0 — 16.11.2026
47
+
48
+ ### Added
49
+
50
+ - **`apiSkillFiles` writes the API part of a CLI's agent skill from the manifest and the command tree**: an index,
51
+ `references/api.md`, and one file per tag, `references/api/api-<group>.md`, which an agent reads with
52
+ `<cli> skill show api-<group>`. Usage, arguments and flags come only from `describeProgram`, matched to each
53
+ operation by `api_operation`; a mismatch either way, two commands for one operation, two tags with one file name, a
54
+ hand-written part that would hide a generated one, or a `SKILL.md` that does not link the index stops the
55
+ generation. Vendor text is cut to one line and escaped. The manifest adds the call, effect, sign-in scopes, permission keys, paging
56
+ and body schema. No examples are made up. `writeArtifacts` takes `owns`, folders that hold only generated files, so a
57
+ file no longer generated is stale under `--check` and removed when writing.
58
+ [Kit surface](docs/standards/kit-surface.md#the-api-part-of-the-agent-skill)
59
+
60
+ ### Changed — may break callers
61
+
62
+ - **`cli-dev ready` needs every contract of the CLI's category, not one.** A contract the CLI does not run goes in
63
+ `lint/contract-exceptions.json` with its reason (`[{ "contract": "crmSyncContract", "reason": "…" }]`); the row
64
+ then shows partially with the reason, and the exit code does not wait for it. An exception without a reason, for
65
+ another category's contract, for one that runs, listed twice, or for every contract is not verified, as is a file
66
+ that is not a JSON list. A CLI that ran one contract of several and was verified under 0.108.0 now exits 1 until it
67
+ runs or excepts the rest. [New CLI](docs/standards/new-cli.md#done-when)
68
+
11
69
  ## 0.108.0 — 16.11.2026
12
70
 
13
71
  ### Added
@@ -18,6 +18,7 @@ export { adaptOpenApi, OpenApiError } from "./openapi.js";
18
18
  export { detectPagination } from "./pagination.js";
19
19
  export { type PatchedSpec, type PatchSpecOptions, patchSpec, type SpecPatch } from "./patch.js";
20
20
  export { type AuthOverride, applyNames, applyOverrides, applyPagination, applyPermissionRule, CodegenError, type CommandNames, type GenerateOptions, generate, type PermissionRule, READING_POST_REASON, validateModel, type WriteOptions, writeArtifacts, } from "./pipeline.js";
21
+ export { API_SKILL_GROUPS, API_SKILL_INDEX, type ApiSkillOptions, apiSkillFiles } from "./skill.js";
21
22
  export { upgradeToOpenApi3 } from "./swagger.js";
22
23
  export { typesGenerator } from "./typescript.js";
23
24
  export { type ValibotOptions, valibotGenerator } from "./valibot.js";
@@ -17,6 +17,7 @@ export { adaptOpenApi, OpenApiError } from "./openapi.js";
17
17
  export { detectPagination } from "./pagination.js";
18
18
  export { patchSpec } from "./patch.js";
19
19
  export { applyNames, applyOverrides, applyPagination, applyPermissionRule, CodegenError, generate, READING_POST_REASON, validateModel, writeArtifacts, } from "./pipeline.js";
20
+ export { API_SKILL_GROUPS, API_SKILL_INDEX, apiSkillFiles } from "./skill.js";
20
21
  export { upgradeToOpenApi3 } from "./swagger.js";
21
22
  export { typesGenerator } from "./typescript.js";
22
23
  export { valibotGenerator } from "./valibot.js";
@@ -69,6 +69,11 @@ export interface WriteOptions {
69
69
  check?: boolean;
70
70
  /** The consumer's formatter, so a check compares what would actually be committed. */
71
71
  format?: (path: string, content: string) => string;
72
+ /**
73
+ * Folders, relative to `root`, that hold only generated files: a file there that was not generated this time (a
74
+ * group that left the spec) is stale too, and removed when writing.
75
+ */
76
+ owns?: readonly string[];
72
77
  }
73
78
  /** Paths whose committed content differs from what was generated — written, or with `check`, only reported. */
74
79
  export declare const writeArtifacts: (artifacts: readonly GeneratedArtifact[], options: WriteOptions) => string[];
@@ -1,5 +1,5 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
- import { dirname, extname, join } from "node:path";
1
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
+ import { dirname, extname, join, posix } from "node:path";
3
3
  import { identifier, kebab } from "./names.js";
4
4
  import { answerPaths, detectPagination, requestParameters } from "./pagination.js";
5
5
  export class CodegenError extends Error {
@@ -382,5 +382,19 @@ export const writeArtifacts = (artifacts, options) => {
382
382
  mkdirSync(dirname(target), { recursive: true });
383
383
  writeFileSync(target, content);
384
384
  }
385
+ const generated = new Set(artifacts.map((artifact) => posix.normalize(artifact.path)));
386
+ for (const owned of options.owns ?? []) {
387
+ const folder = posix.normalize(owned).replace(/\/+$/, "");
388
+ if (!existsSync(join(options.root, folder)))
389
+ continue;
390
+ for (const entry of readdirSync(join(options.root, folder), { withFileTypes: true })) {
391
+ const path = posix.join(folder, entry.name);
392
+ if (!entry.isFile() || generated.has(path))
393
+ continue;
394
+ stale.push(path);
395
+ if (!options.check)
396
+ rmSync(join(options.root, path));
397
+ }
398
+ }
385
399
  return stale;
386
400
  };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The API part of a CLI's agent skill: `references/api.md`, a short index, and `references/api/api-<group>.md`, one
3
+ * file per first tag of the operations, so an agent loads only the group it needs (`<cli> skill show api-<group>`). Each command,
4
+ * its usage, arguments and flags come from the built program's command tree, as `--help` prints them; the manifest
5
+ * adds only what the API says: the HTTP call, the effect, sign-in scopes, permission keys and paging.
6
+ */
7
+ import type { CommandInfo } from "../commands/registry.js";
8
+ import type { ManifestOperation } from "./manifest.js";
9
+ import type { GeneratedArtifact } from "./model.js";
10
+ export interface ApiSkillOptions {
11
+ /** The command word `skill show` runs under: `notion`. */
12
+ cli: string;
13
+ /** The skill's folder, beside its SKILL.md: `skills/notion-cli`. */
14
+ folder: string;
15
+ /**
16
+ * The files already in that folder, relative to it, as `skillFiles` lists them: `skill show` finds a part by its
17
+ * base name, so a hand-written `api-pages.md` elsewhere would hide the generated one.
18
+ */
19
+ files: readonly string[];
20
+ /** The service, for the headings: `Notion`. */
21
+ service: string;
22
+ operations: readonly ManifestOperation[];
23
+ /** The SKILL.md beside these files, as text: an agent reaches them only through its link to `references/api.md`. */
24
+ skill: string;
25
+ /** `describeProgram(createProgram())`: the generated commands carry `api_operation`. */
26
+ commands: readonly CommandInfo[];
27
+ banner: string;
28
+ }
29
+ export declare const API_SKILL_INDEX = "references/api.md";
30
+ export declare const API_SKILL_GROUPS = "references/api";
31
+ /**
32
+ * Throws `CodegenError` when an operation has no command or a generated command names no operation: a flag is
33
+ * never taken from anywhere but the command tree. Sorted, and with no version or date, so `generate:check` holds.
34
+ */
35
+ export declare const apiSkillFiles: (options: ApiSkillOptions) => GeneratedArtifact[];
@@ -0,0 +1,171 @@
1
+ import { flatten } from "../commands/registry.js";
2
+ import { kebab } from "./names.js";
3
+ import { CodegenError } from "./pipeline.js";
4
+ export const API_SKILL_INDEX = "references/api.md";
5
+ export const API_SKILL_GROUPS = "references/api";
6
+ const firstLine = (value) => (value ?? "").split(/\r\n|[\r\n\u2028\u2029]/)[0]?.trim() ?? "";
7
+ /**
8
+ * Vendor text becomes instructions an agent follows: its first line only, HTML and every Markdown mark escaped, and
9
+ * always after a label, so no heading, list, fence or link can start it.
10
+ */
11
+ const text = (value) => firstLine(value)
12
+ .replaceAll("&", "&amp;")
13
+ .replaceAll("<", "&lt;")
14
+ .replaceAll(">", "&gt;")
15
+ .replace(/[\\`*_[\]~|]/g, "\\$&");
16
+ /** A code span; in a table cell `|` still ends the cell, so it is escaped there. */
17
+ const code = (value, cell = false) => {
18
+ const plain = value.replace(/[\r\n\u2028\u2029]+/g, " ").replaceAll("`", "'");
19
+ return `\`${cell ? plain.replaceAll("|", "\\|") : plain}\``;
20
+ };
21
+ const pages = (pagination) => {
22
+ const sent = (parameter) => `${code(parameter.name)} (${parameter.in})`;
23
+ const limit = "limit" in pagination && pagination.limit ? `; page size in ${sent(pagination.limit)}` : "";
24
+ const items = pagination.items ? `; items in ${code(pagination.items)}` : "";
25
+ const total = "total" in pagination && pagination.total ? `; the count of all in ${code(pagination.total)}` : "";
26
+ switch (pagination.style) {
27
+ case "cursor": {
28
+ const more = pagination.hasMore ? `; ${code(pagination.hasMore)} is false on the last page` : "";
29
+ return `cursor: send ${sent(pagination.cursor)}, read the next one from ${code(pagination.next)}${items}${more}${limit}`;
30
+ }
31
+ case "offset":
32
+ return `offset: send ${sent(pagination.offset)}, raised by the items read so far${items}${total}${limit}`;
33
+ case "page":
34
+ return `page number: send ${sent(pagination.page)}, one more for each page${items}${total}${limit}`;
35
+ case "link":
36
+ return `the answer's ${code(pagination.next)} is the next page's address${items}`;
37
+ }
38
+ };
39
+ const flagRow = (option) => `| ${code(option.flags, true)} | ${option.mandatory ? "yes" : "no"} | ${text(option.description)} |`;
40
+ const section = (operation, command) => {
41
+ const call = operation.binding.kind === "http" ? `${operation.binding.method} ${operation.binding.path}` : operation.binding.name;
42
+ const scopes = (operation.security ?? []).map((requirement) => Object.entries(requirement)
43
+ .map(([scheme, list]) => (list.length > 0 ? `${scheme} (${list.join(", ")})` : scheme))
44
+ .join(" and "));
45
+ const lines = [
46
+ `## ${code(command.usage)}`,
47
+ "",
48
+ `- What: ${text(operation.summary ?? command.summary ?? command.description) || operation.id}`,
49
+ `- Call: ${code(call)}, effect: ${operation.effect}${operation.deprecated ? ", deprecated" : ""}`,
50
+ ];
51
+ if (scopes.length > 0)
52
+ lines.push(`- Sign-in: ${scopes.map(text).join("; or ")}`);
53
+ if (operation.permissions && operation.permissions.length > 0)
54
+ lines.push(`- Permission keys: ${operation.permissions.map((permission) => code(permission.key)).join(", ")}`);
55
+ if (operation.pagination)
56
+ lines.push(`- Pages: ${pages(operation.pagination)}`);
57
+ if (operation.request?.schema)
58
+ lines.push(`- Body: ${code(operation.request.schema)}${operation.request.required ? ", required" : ""}`);
59
+ if (command.arguments.length > 0) {
60
+ lines.push("", "| Argument | Required | What |", "|---|---|---|");
61
+ for (const argument of command.arguments)
62
+ lines.push(`| ${code(argument.name, true)} | ${argument.required ? "yes" : "no"} | ${text(argument.description)} |`);
63
+ }
64
+ if (command.options.length > 0) {
65
+ lines.push("", "| Flag | Required | What |", "|---|---|---|");
66
+ for (const option of command.options)
67
+ lines.push(flagRow(option));
68
+ }
69
+ return [...lines, ""];
70
+ };
71
+ /**
72
+ * Throws `CodegenError` when an operation has no command or a generated command names no operation: a flag is
73
+ * never taken from anywhere but the command tree. Sorted, and with no version or date, so `generate:check` holds.
74
+ */
75
+ export const apiSkillFiles = (options) => {
76
+ const generated = flatten(options.commands).filter((command) => command.origin === "generated" && command.api_operation);
77
+ const byOperation = new Map();
78
+ const problems = [];
79
+ for (const command of generated) {
80
+ const id = command.api_operation ?? "";
81
+ const earlier = byOperation.get(id);
82
+ if (earlier)
83
+ problems.push(`${earlier.path.join(" ")} and ${command.path.join(" ")} both name operation ${id}`);
84
+ byOperation.set(id, command);
85
+ }
86
+ const ids = new Set(options.operations.map((operation) => operation.id));
87
+ const linked = /\]\(\s*(\.\/)?references\/api\.md(#[^)]*)?\s*\)/.test(options.skill.replace(/<!--[\s\S]*?-->/g, ""));
88
+ const hidden = options.files.filter((file) => {
89
+ const base = file.split("/").at(-1)?.replace(/\.md$/, "") ?? "";
90
+ const ours = file === API_SKILL_INDEX || file.startsWith(`${API_SKILL_GROUPS}/`);
91
+ return !ours && file.endsWith(".md") && (base === "api" || base.startsWith("api-"));
92
+ });
93
+ if (!linked)
94
+ problems.push(`SKILL.md does not link ${API_SKILL_INDEX}`);
95
+ for (const file of hidden)
96
+ problems.push(`${file} would hide a generated part of the same name in skill show`);
97
+ for (const operation of options.operations)
98
+ if (!byOperation.has(operation.id))
99
+ problems.push(`operation ${operation.id} has no command in the program`);
100
+ for (const command of generated)
101
+ if (!ids.has(command.api_operation ?? ""))
102
+ problems.push(`${command.path.join(" ")} names operation ${command.api_operation}, not in the manifest`);
103
+ const groups = new Map();
104
+ for (const operation of options.operations) {
105
+ const tag = operation.tags[0] ?? "untagged";
106
+ const name = kebab(tag);
107
+ const group = groups.get(name);
108
+ if (!name)
109
+ problems.push(`tag "${tag}" of ${operation.id} has no Latin letter or digit for a file name`);
110
+ else if (group && group.tag !== tag)
111
+ problems.push(`tags "${group.tag}" and "${tag}" both make the file api-${name}.md`);
112
+ else if (group)
113
+ group.operations.push(operation);
114
+ else
115
+ groups.set(name, { tag, operations: [operation] });
116
+ }
117
+ if (problems.length > 0)
118
+ throw new CodegenError(problems);
119
+ const parentPaths = new Set(generated.map((command) => command.path.slice(0, -1).join(" ")));
120
+ const parents = flatten(options.commands).filter((command) => parentPaths.has(command.path.join(" ")));
121
+ const names = [...groups.keys()].sort();
122
+ const commandOf = (operation) => byOperation.get(operation.id);
123
+ const program = options.cli;
124
+ const index = [
125
+ `<!-- ${options.banner} -->`,
126
+ "",
127
+ `# ${text(options.service)} API`,
128
+ "",
129
+ `Every operation of the ${text(options.service)} API this CLI offers is a command of its own. Read only the group`,
130
+ `you need: ${code(`${program} skill show api-<group>`)} prints it, as does the file \`api/api-<group>.md\` beside`,
131
+ "this one. Each command lists its usage and flags as `--help` prints them.",
132
+ "",
133
+ "Effects: `read` changes nothing; `write` changes the service; `destructive` deletes or overwrites there.",
134
+ "",
135
+ ];
136
+ for (const parent of parents) {
137
+ if (parent.options.length === 0)
138
+ continue;
139
+ index.push(`Options of ${code(parent.usage)} for every command under it:`, "", "| Flag | Required | What |");
140
+ index.push("|---|---|---|");
141
+ for (const option of parent.options)
142
+ index.push(flagRow(option));
143
+ index.push("");
144
+ }
145
+ index.push("| Group | Read with | Commands | read | write | destructive |", "|---|---|---|---|---|---|");
146
+ for (const name of names) {
147
+ const { tag, operations } = groups.get(name);
148
+ const count = (effect) => operations.filter((operation) => operation.effect === effect).length;
149
+ index.push(`| ${text(tag)} | ${code(`${program} skill show api-${name}`, true)} | ${operations.length} | ${count("read")} | ` +
150
+ `${count("write")} | ${count("destructive")} |`);
151
+ }
152
+ const files = names.map((name) => {
153
+ const { tag, operations } = groups.get(name);
154
+ const usage = (operation) => commandOf(operation).usage;
155
+ // Code-unit order: a locale's collation would differ between machines and fail generate:check.
156
+ const sorted = [...operations].sort((one, other) => usage(one) < usage(other) ? -1 : usage(one) > usage(other) ? 1 : 0);
157
+ return {
158
+ path: `${options.folder}/${API_SKILL_GROUPS}/api-${name}.md`,
159
+ content: [
160
+ `<!-- ${options.banner} -->`,
161
+ "",
162
+ `# ${text(options.service)} API: ${text(tag)}`,
163
+ "",
164
+ ...sorted.flatMap((operation) => section(operation, commandOf(operation))),
165
+ ]
166
+ .join("\n")
167
+ .replace(/\n+$/, "\n"),
168
+ };
169
+ });
170
+ return [{ path: `${options.folder}/${API_SKILL_INDEX}`, content: `${index.join("\n")}\n` }, ...files];
171
+ };
package/dist/dev/main.js CHANGED
@@ -37,7 +37,8 @@ import { binNameWarnings, describeWarnings, hostsWarnings, WCAT_RULES } from "./
37
37
  const USAGE = `usage: cli-dev <command> [options]
38
38
 
39
39
  slow-tests [report] [count] the slowest tests and files (report: coverage/tests.json, count: 20);
40
- warns on stderr about each test over 3 s, and still exits 0
40
+ warns on stderr about each test over 3 s, and still exits 0;
41
+ exits 1 when the report is missing
41
42
  next-version <wanted> <latest> <versions-json>
42
43
  the version bin/release publishes, given npm's answers
43
44
  version [--sync] [--file <path>] package.json's version against src/version.ts
@@ -916,6 +917,10 @@ export const main = async (argv, io) => {
916
917
  switch (command) {
917
918
  case "slow-tests": {
918
919
  const [file = "coverage/tests.json", count = "20"] = args;
920
+ if (!existsSync(join(io.cwd, file))) {
921
+ io.err(`no test report at ${file}: run vitest with --reporter=json --outputFile.json=${file} first`);
922
+ return 1;
923
+ }
919
924
  const parsed = JSON.parse(readFileSync(join(io.cwd, file), "utf8"));
920
925
  const { out, warning } = slowTests(parsed, io.cwd, Number(count));
921
926
  io.out(out);
@@ -17,7 +17,7 @@ export interface ReadyRow {
17
17
  export interface ReadyReport {
18
18
  category?: string;
19
19
  rows: ReadyRow[];
20
- /** The fix of the first row that is not verified, or nothing when every row is verified or unsupported. */
20
+ /** The fix of the first row that has one; a row partially verified only by excepted contracts has none. */
21
21
  next?: string;
22
22
  }
23
23
  export declare const designCategory: (design: string) => string | undefined;
@@ -26,5 +26,5 @@ export declare const READY_TESTS = "coverage/ready-tests.json";
26
26
  export declare const readyReport: (io: DevIo, shell: Shell) => ReadyReport;
27
27
  export declare const readyText: (report: ReadyReport) => string;
28
28
  export declare const ready: (args: string[], io: DevIo, shell: Shell) => number;
29
- export declare const READY_USAGE = " ready [--json] runs the CLI's checks in order (typecheck and lint, tests and its\n category's cli-core contracts, the family audit, docs:check,\n generate:check, smoke, security:no-leak,\n deps:check) and reads the live-check record; prints each row as\n verified, partially, not verified or unsupported with its evidence,\n and the one next step; exits 1 until every row is verified or\n unsupported";
29
+ export declare const READY_USAGE = " ready [--json] runs the CLI's checks in order (typecheck and lint, tests and its\n category's cli-core contracts, the family audit, docs:check,\n generate:check, smoke, security:no-leak,\n deps:check) and reads the live-check record; prints each row as\n verified, partially, not verified or unsupported with its evidence,\n and the one next step; exits 1 while a row has a fix (a category\n contract excepted with its reason in lint/contract-exceptions.json\n shows partially and needs none)";
30
30
  export {};
package/dist/dev/ready.js CHANGED
@@ -110,6 +110,35 @@ const scriptRow = (id, title, runs, extra = []) => {
110
110
  : {}),
111
111
  };
112
112
  };
113
+ /** `[{ "contract": "crmSyncContract", "reason": "…" }]`: a category contract this CLI does not run, and why. */
114
+ const EXCEPTIONS = "lint/contract-exceptions.json";
115
+ const contractExceptions = (cwd) => {
116
+ const path = join(cwd, EXCEPTIONS);
117
+ if (!existsSync(path))
118
+ return { entries: [], problems: [] };
119
+ let parsed;
120
+ try {
121
+ parsed = JSON.parse(readFileSync(path, "utf8"));
122
+ }
123
+ catch (error) {
124
+ return { entries: [], problems: [`is not valid JSON: ${error instanceof Error ? error.message : error}`] };
125
+ }
126
+ if (!Array.isArray(parsed))
127
+ return { entries: [], problems: ['is not a list of { "contract", "reason" }'] };
128
+ const entries = [];
129
+ const problems = [];
130
+ parsed.forEach((entry, index) => {
131
+ if (!isRecord(entry) || typeof entry.contract !== "string" || !entry.contract) {
132
+ problems.push(`entry ${index + 1} is not { "contract", "reason" }`);
133
+ return;
134
+ }
135
+ if (entries.some((seen) => seen.contract === entry.contract))
136
+ problems.push(`${entry.contract} is listed twice`);
137
+ entries.push({ contract: entry.contract, reason: typeof entry.reason === "string" ? entry.reason.trim() : "" });
138
+ });
139
+ return { entries, problems };
140
+ };
141
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
113
142
  const CATEGORY_NAMES = CATEGORY_CONTRACTS.flatMap((entry) => entry.names);
114
143
  const contractsRow = (cwd, category, runs, report) => {
115
144
  const title = "Tests and category contracts";
@@ -136,18 +165,44 @@ const contractsRow = (cwd, category, runs, report) => {
136
165
  });
137
166
  const ran = new Set(calls.filter(({ file }) => ranInReport(report, file) === undefined).map((call) => call.contract));
138
167
  const notRun = contracts.filter((contract) => !ran.has(contract));
168
+ const { entries: exceptions, problems } = contractExceptions(cwd);
169
+ const reasonOf = (contract) => exceptions.find((entry) => entry.contract === contract)?.reason;
170
+ const wrong = [
171
+ ...problems,
172
+ ...exceptions.filter((entry) => !entry.reason).map((entry) => `${entry.contract} has no reason`),
173
+ ...exceptions
174
+ .filter((entry) => !contracts.includes(entry.contract))
175
+ .map((entry) => `${entry.contract} is no contract of "${category}"`),
176
+ ...exceptions.filter((entry) => ran.has(entry.contract)).map((entry) => `${entry.contract} runs now`),
177
+ ];
178
+ const excepted = notRun.filter((contract) => reasonOf(contract));
179
+ const missing = notRun.filter((contract) => !reasonOf(contract));
139
180
  const row = scriptRow("contracts", title, runs, [
140
181
  ...evidence,
141
- ...(notRun.length > 0 && ran.size > 0 ? [`not run: ${notRun.join(", ")}`] : []),
182
+ ...excepted.map((contract) => `not run, excepted in ${EXCEPTIONS}: ${contract} — ${reasonOf(contract)}`),
183
+ ...(missing.length > 0 ? [`not run: ${missing.join(", ")}`] : []),
184
+ ...wrong.map((problem) => `${EXCEPTIONS}: ${problem}`),
142
185
  ]);
143
- if (ran.size > 0)
186
+ if (row.fix)
144
187
  return row;
145
- return {
146
- ...row,
147
- status: row.status === "verified" ? "partially" : row.status,
148
- evidence: [...row.evidence, `no test that ran calls ${contracts.join(" or ")}`],
149
- fix: row.fix ?? `run cli-core's ${contracts[0]} in a test (testing.md), then run cli-dev ready again`,
150
- };
188
+ if (wrong.length > 0)
189
+ return { ...row, status: "not verified", fix: `correct ${EXCEPTIONS}: ${wrong[0]}, then run cli-dev ready again` };
190
+ if (missing.length > 0)
191
+ return {
192
+ ...row,
193
+ status: ran.size > 0 ? "partially" : "not verified",
194
+ fix: `run cli-core's ${missing[0]} in a test (testing.md), or except it in ${EXCEPTIONS} with its reason, ` +
195
+ "then run cli-dev ready again",
196
+ };
197
+ // Every contract excepted leaves the row checking nothing.
198
+ if (ran.size === 0)
199
+ return {
200
+ ...row,
201
+ status: "not verified",
202
+ fix: `run at least one of ${contracts.join(", ")} in a test (testing.md), then run cli-dev ready again`,
203
+ };
204
+ // An exception is a known gap, not a check that passed; it needs no fix, so it does not hold back `next`.
205
+ return excepted.length > 0 ? { ...row, status: "partially" } : row;
151
206
  };
152
207
  const liveRow = (cwd, shell, version) => {
153
208
  const title = "Live check against the service";
@@ -214,7 +269,7 @@ export const readyReport = (io, shell) => {
214
269
  scriptRow("deps", "Dependencies", run("deps:check")),
215
270
  liveRow(cwd, shell, packageVersion(cwd)),
216
271
  ];
217
- const next = rows.find((row) => row.status === "not verified" || row.status === "partially")?.fix;
272
+ const next = rows.find((row) => row.fix)?.fix;
218
273
  return { ...(category ? { category } : {}), rows, ...(next ? { next } : {}) };
219
274
  };
220
275
  const MARK = {
@@ -231,7 +286,12 @@ export const readyText = (report) => {
231
286
  for (const evidence of row.evidence)
232
287
  lines.push(`${" ".repeat(width + 2)}${evidence}`);
233
288
  }
234
- lines.push("", report.next ? `next: ${report.next}` : "next: nothing; every check is verified or does not apply");
289
+ const excepted = report.rows.filter((row) => row.status === "partially").map((row) => row.title);
290
+ lines.push("", report.next
291
+ ? `next: ${report.next}`
292
+ : excepted.length > 0
293
+ ? `next: nothing to do; partially, by declared exceptions: ${excepted.join(", ")}`
294
+ : "next: nothing; every check is verified or does not apply");
235
295
  return lines.join("\n");
236
296
  };
237
297
  export const ready = (args, io, shell) => {
@@ -245,5 +305,6 @@ export const READY_USAGE = ` ready [--json] runs the CLI'
245
305
  generate:check, smoke, security:no-leak,
246
306
  deps:check) and reads the live-check record; prints each row as
247
307
  verified, partially, not verified or unsupported with its evidence,
248
- and the one next step; exits 1 until every row is verified or
249
- unsupported`;
308
+ and the one next step; exits 1 while a row has a fix (a category
309
+ contract excepted with its reason in lint/contract-exceptions.json
310
+ shows partially and needs none)`;
@@ -34,6 +34,13 @@ export const KNOWLEDGE_FLAGS = [
34
34
  meaning: "at most this many characters read",
35
35
  unit: "characters",
36
36
  },
37
+ {
38
+ name: "--tab",
39
+ value: "<id>",
40
+ role: "target",
41
+ type: "id",
42
+ meaning: "one tab of a document, by its id: only its text is read",
43
+ },
37
44
  {
38
45
  name: "--tag",
39
46
  value: "<name>",
@@ -2,6 +2,6 @@ export { EFFECT_LEVELS, type EffectLevel, type Effects, effectsSchema, writes }
2
2
  export { BASE_REASONS, COMMON_DETAILS, CRASH_CODE, CRASH_REASON, defineReasons, type ErrorObject, type ErrorReason, errorObjectSchema, } from "./errors.js";
3
3
  export { defineLogEvents, isContentKey, LOG_ATTRIBUTE_KEYS, LOG_EVENTS, LOG_SEVERITIES, type LogEvent, type LogRecord, type LogSeverity, logAttributesJsonSchema, logEventProblems, logRecordSchema, traceIdOf, } from "./log.js";
4
4
  export { takenMinutes } from "./monthly.js";
5
- export { COMPACT_FLAG, clockMeta, type Issue, type ItemEnvelope, isoTime, issueSchema, itemEnvelopeSchema, jsonlEndSchema, jsonlItemSchema, jsonlOf, type ListEnvelope, type ListResult, listEnvelopeSchema, localTime, MAX_NEXT_STEPS, type Meta, type Missing, metaSchema, missingSchema, type NextStep, nextStepSchema, type Page, pageSchema, type Ranking, rankingSchema, reference, type Total, totalSchema, } from "./output.js";
5
+ export { COMPACT_FLAG, clockMeta, type Issue, type ItemEnvelope, isoTime, issueSchema, itemEnvelopeSchema, jsonlEndSchema, jsonlItemSchema, jsonlOf, type ListEnvelope, type ListResult, listEnvelopeSchema, localTime, MAX_NEXT_STEPS, type Meta, type Missing, metaSchema, missingSchema, type NextStep, nextStepSchema, type Page, pageSchema, type Query, querySchema, type Ranking, rankingSchema, reference, type Total, totalSchema, } from "./output.js";
6
6
  export { fill, jsonSchemaOf, RegistryError } from "./registry.js";
7
7
  export { defineSteps, SAME_COMMAND, STEPS, type StepDefinition, type StepInput, type StepTarget, stepOf, } from "./steps.js";
@@ -2,6 +2,6 @@ export { EFFECT_LEVELS, effectsSchema, writes } from "./effects.js";
2
2
  export { BASE_REASONS, COMMON_DETAILS, CRASH_CODE, CRASH_REASON, defineReasons, errorObjectSchema, } from "./errors.js";
3
3
  export { defineLogEvents, isContentKey, LOG_ATTRIBUTE_KEYS, LOG_EVENTS, LOG_SEVERITIES, logAttributesJsonSchema, logEventProblems, logRecordSchema, traceIdOf, } from "./log.js";
4
4
  export { takenMinutes } from "./monthly.js";
5
- export { COMPACT_FLAG, clockMeta, isoTime, issueSchema, itemEnvelopeSchema, jsonlEndSchema, jsonlItemSchema, jsonlOf, listEnvelopeSchema, localTime, MAX_NEXT_STEPS, metaSchema, missingSchema, nextStepSchema, pageSchema, rankingSchema, reference, totalSchema, } from "./output.js";
5
+ export { COMPACT_FLAG, clockMeta, isoTime, issueSchema, itemEnvelopeSchema, jsonlEndSchema, jsonlItemSchema, jsonlOf, listEnvelopeSchema, localTime, MAX_NEXT_STEPS, metaSchema, missingSchema, nextStepSchema, pageSchema, querySchema, rankingSchema, reference, totalSchema, } from "./output.js";
6
6
  export { fill, jsonSchemaOf, RegistryError } from "./registry.js";
7
7
  export { defineSteps, SAME_COMMAND, STEPS, stepOf, } from "./steps.js";
@@ -104,6 +104,22 @@ export declare const rankingSchema: v.StrictObjectSchema<{
104
104
  }, undefined>, undefined>;
105
105
  readonly ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
106
106
  }, undefined>;
107
+ /**
108
+ * What a search made of its query before it searched: `chat` when a word of it named one chat and the search ran
109
+ * there, `respelled` for each unknown word and the known spellings tried in its place. A program reads it instead of
110
+ * parsing the note.
111
+ */
112
+ export declare const querySchema: v.StrictObjectSchema<{
113
+ readonly chat: v.OptionalSchema<v.StrictObjectSchema<{
114
+ readonly word: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
115
+ readonly chat_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
116
+ readonly title: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
117
+ }, undefined>, undefined>;
118
+ readonly respelled: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
119
+ readonly word: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
120
+ readonly tried: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
121
+ }, undefined>, undefined>, undefined>;
122
+ }, undefined>;
107
123
  export declare const metaSchema: v.StrictObjectSchema<{
108
124
  readonly run_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
109
125
  readonly duration_ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
@@ -138,6 +154,17 @@ export declare const metaSchema: v.StrictObjectSchema<{
138
154
  }, undefined>, undefined>;
139
155
  readonly ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
140
156
  }, undefined>, undefined>;
157
+ readonly query: v.OptionalSchema<v.StrictObjectSchema<{
158
+ readonly chat: v.OptionalSchema<v.StrictObjectSchema<{
159
+ readonly word: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
160
+ readonly chat_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
161
+ readonly title: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
162
+ }, undefined>, undefined>;
163
+ readonly respelled: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
164
+ readonly word: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
165
+ readonly tried: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
166
+ }, undefined>, undefined>, undefined>;
167
+ }, undefined>, undefined>;
141
168
  }, undefined>;
142
169
  /**
143
170
  * `meta.now`, `meta.now_local` and `meta.timezone` for an answer an agent plans by (WC-TIME-7): the moment in UTC, the
@@ -244,6 +271,17 @@ export declare const listEnvelopeSchema: <T extends v.GenericSchema>(item: T) =>
244
271
  }, undefined>, undefined>;
245
272
  readonly ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
246
273
  }, undefined>, undefined>;
274
+ readonly query: v.OptionalSchema<v.StrictObjectSchema<{
275
+ readonly chat: v.OptionalSchema<v.StrictObjectSchema<{
276
+ readonly word: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
277
+ readonly chat_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
278
+ readonly title: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
279
+ }, undefined>, undefined>;
280
+ readonly respelled: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
281
+ readonly word: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
282
+ readonly tried: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
283
+ }, undefined>, undefined>, undefined>;
284
+ }, undefined>, undefined>;
247
285
  }, undefined>;
248
286
  }, undefined>;
249
287
  export declare const itemEnvelopeSchema: <T extends v.GenericSchema>(item: T) => v.StrictObjectSchema<{
@@ -323,6 +361,17 @@ export declare const itemEnvelopeSchema: <T extends v.GenericSchema>(item: T) =>
323
361
  }, undefined>, undefined>;
324
362
  readonly ms: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
325
363
  }, undefined>, undefined>;
364
+ readonly query: v.OptionalSchema<v.StrictObjectSchema<{
365
+ readonly chat: v.OptionalSchema<v.StrictObjectSchema<{
366
+ readonly word: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
367
+ readonly chat_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
368
+ readonly title: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
369
+ }, undefined>, undefined>;
370
+ readonly respelled: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
371
+ readonly word: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
372
+ readonly tried: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
373
+ }, undefined>, undefined>, undefined>;
374
+ }, undefined>, undefined>;
326
375
  }, undefined>;
327
376
  }, undefined>;
328
377
  export type NextStep = v.InferOutput<typeof nextStepSchema>;
@@ -331,6 +380,7 @@ export type Page = v.InferOutput<typeof pageSchema>;
331
380
  export type Issue = v.InferOutput<typeof issueSchema>;
332
381
  export type Meta = v.InferOutput<typeof metaSchema>;
333
382
  export type Ranking = v.InferOutput<typeof rankingSchema>;
383
+ export type Query = v.InferOutput<typeof querySchema>;
334
384
  export interface ListEnvelope<T> {
335
385
  items: T[];
336
386
  page: Page;
@@ -95,6 +95,15 @@ export const rankingSchema = v.strictObject({
95
95
  })),
96
96
  ms: v.pipe(v.number(), v.integer(), v.minValue(0)),
97
97
  });
98
+ /**
99
+ * What a search made of its query before it searched: `chat` when a word of it named one chat and the search ran
100
+ * there, `respelled` for each unknown word and the known spellings tried in its place. A program reads it instead of
101
+ * parsing the note.
102
+ */
103
+ export const querySchema = v.strictObject({
104
+ chat: v.optional(v.strictObject({ word: text, chat_id: text, title: v.nullable(text) })),
105
+ respelled: v.optional(v.array(v.strictObject({ word: text, tried: v.pipe(v.array(text), v.minLength(1)) }))),
106
+ });
98
107
  export const metaSchema = v.strictObject({
99
108
  run_id: text,
100
109
  duration_ms: v.pipe(v.number(), v.integer(), v.minValue(0)),
@@ -108,6 +117,7 @@ export const metaSchema = v.strictObject({
108
117
  now_local: v.optional(localTime),
109
118
  window: v.optional(v.strictObject({ since: v.optional(isoTime), until: v.optional(isoTime) })),
110
119
  ranking: v.optional(rankingSchema),
120
+ query: v.optional(querySchema),
111
121
  });
112
122
  const offsetOf = (at, zone) => {
113
123
  const name = new Intl.DateTimeFormat("en-US", { timeZone: zone, timeZoneName: "longOffset" })
@@ -143,6 +143,10 @@ const verbs = [
143
143
  ["export", "write from the store to a file"],
144
144
  ["import", "bring a file or list the user gives into the store or the messenger, once"],
145
145
  ["download", "save a file from the source to this machine"],
146
+ ["upload", "put a file from this machine on the source"],
147
+ ["publish", "open a thing to anyone who has its public link"],
148
+ ["unpublish", "close a thing's public link"],
149
+ ["stale", "mark a saved memory as out of date, keeping it"],
146
150
  ["transcribe", "turn speech into text"],
147
151
  ["extract", "read the text inside files already on this machine into the store"],
148
152
  ["migrate", "bring a file up to this build's schema"],
@@ -117,12 +117,14 @@ plus community itself. cli-template follows every rule here as a CLI does
117
117
  catches that merge skew the same hour, not at the next release.
118
118
  - **Enforced by:** `main.yml:validation` · `node-ci.yml:check` · `node-ci.yml:bun` · `node-ci.yml:secrets`.
119
119
  - **Example:** `main.yml` calls the repository's own `ci.yml`, which calls cli-base `node-ci.yml`. That runs
120
- `pnpm lint`, `pnpm typecheck`, `pnpm test:coverage` and `pnpm build`. With `cli: true` it then runs one named step
121
- per CLI script: `contracts:check`, `contracts:upgrade`, `security:no-leak`, `version:check`, `generate:check`,
122
- `test:matrix:check`, `docs:check`, `package:check`, `lint:commands`, and `parity:check` with `parity: true`. Then
123
- the project's `checks` lines, a Bun job, and a gitleaks scan of the whole history. The shared workflow owns the CLI
124
- steps: the repository's `ci.yml` names a step it cannot run yet in `skip`, with the reason beside it, and puts only
125
- its extra checks in `checks` (tg and max: `pnpm check:agent-docs`).
120
+ `pnpm lint`, `pnpm typecheck`, `pnpm test:coverage` and `pnpm build`, then warns about each test over 3 s from that
121
+ run's JSON report ([WC-TEST-20](testing.md#wc-test-20--one-test-time-limit-of-15-s-and-each-test-runs-within-3-s)).
122
+ With `cli: true` it then runs one named step per CLI script: `contracts:check`, `contracts:upgrade`,
123
+ `security:no-leak`, `version:check`, `generate:check`, `test:matrix:check`, `docs:check`, `package:check`,
124
+ `lint:commands`, and `parity:check` with `parity: true`. Then the project's `checks` lines, a Bun job, and a
125
+ gitleaks scan of the whole history. The shared workflow owns the CLI steps: the repository's `ci.yml` names a step
126
+ it cannot run yet in `skip`, with the reason beside it, and puts only its extra checks in `checks` (tg and max:
127
+ `pnpm check:agent-docs`).
126
128
  - **Exceptions:** platform suites (Windows, macOS, install checks) are skipped here and run at release, monthly or on
127
129
  request. Nothing in this run publishes or tags. cli-docs runs its full validation before each deployment and monthly
128
130
  instead; community has no build to validate.
@@ -140,6 +140,34 @@ hosts a link points at (`downloader.disk.yandex.ru`, `*.disk.yandex.net`), and r
140
140
  scheme or with the `auth` header. A CLI writes only its scenarios. `looseObjects` lets unknown fields through, for a
141
141
  source whose subtypes the definitions cannot tell apart.
142
142
 
143
+ ### The API part of the agent skill
144
+
145
+ `apiSkillFiles({ cli, folder, files, service, skill, operations, commands, banner })` writes the API part of the
146
+ CLI's skill, in the shape of [openapi-to-skills](https://github.com/neutree-ai/openapi-to-skills): `references/api.md`,
147
+ a short index of the groups with their effects, and `references/api/api-<group>.md`, one file per group. An
148
+ operation's group is its first tag; one without a tag is in `api-untagged.md`. A tag with no Latin letter or digit
149
+ cannot name a file and stops the generation. An agent reads
150
+ the index, then only the group it needs, with `<cli> skill show api-<group>`. The `skill` command already ships and
151
+ shows every file beside `SKILL.md`; nothing else is needed.
152
+
153
+ - `commands` is `describeProgram(createProgram())` from the built program, made with the CLI's own copy of cli-base.
154
+ Each command's usage, arguments and flags come from there, as `--help` prints them; a flag is never made up from
155
+ the spec. An operation and its command are matched by the command's `api_operation`. An operation without a
156
+ command, a generated command whose operation is not in the manifest, and two commands for one operation stop the
157
+ generation.
158
+ - The manifest adds what only the API knows: the HTTP call, the effect, sign-in scopes, permission keys, paging
159
+ (named by the API's parameters and answer fields) and the request body's schema. Vendor text is cut to its first
160
+ line, its HTML and Markdown marks are escaped, and it always follows a label, since an installed skill is
161
+ instructions an agent follows.
162
+ - There are no examples: the manifest has none, and the generated commands carry none.
163
+ - `skill` is the text of `SKILL.md`, which must link `references/api.md`, or the agent never finds the files.
164
+ `files` is `skillFiles(<SKILL.md URL>)`: `skill show` finds a part by its base name, so a hand-written `api.md` or
165
+ `api-<name>.md` elsewhere in the folder, which would hide a generated one, stops the generation.
166
+ - Run it after the build, beside the commands page, and write it with
167
+ `writeArtifacts(files, { root, check, owns: ["skills/<cli>/references/api"] })`: `owns` makes a file of a group
168
+ that left the spec stale, so `generate:check` catches it, and `pnpm generate` removes it. The output holds no
169
+ version or date, so a version bump leaves it current.
170
+
143
171
  ### Provenance
144
172
 
145
173
  The coverage page lists every operation, with its call, command, effect and how far its request body can be trusted
@@ -20,7 +20,7 @@ Rule ids on this page are `WC-LAY-<n>`. How to read a rule, how ids work and whi
20
20
  - `bin/`: the repository's own scripts, such as `bin/release` and a wrapper that runs the local build;
21
21
  - `scripts/`: development scripts in TypeScript or JavaScript;
22
22
  - `docs/`: user pages; `docs/dev/`: developer pages;
23
- - `lint/`: `baseline/` and `overrides.json` for the command lint;
23
+ - `lint/`: `baseline/` and `overrides.json` for the command lint, `contract-exceptions.json` for `cli-dev ready`;
24
24
  - `contracts/`: the offline contract plan and its snapshots;
25
25
  - `config/wirecat/`: the shared presets;
26
26
  - `skills/`: the agent skill the package ships;
@@ -183,7 +183,11 @@ All of these pass on `main`, before the first release. `cli-dev ready` runs the
183
183
  order and prints what each one proves: verified (a script passed, a test runs the category's cli-core contract, the
184
184
  live-check record is of this code), partially, not verified, or unsupported (a check that cannot apply: the live
185
185
  check in cli-template itself). A contract call counts only when vitest's report shows its test file ran with no test
186
- skipped. A missing script is not verified. `--json` gives the same rows and the one next
186
+ skipped, and every contract of the category must run. A CLI that cannot run one lists it in
187
+ `lint/contract-exceptions.json` as `[{ "contract": "crmSyncContract", "reason": "…" }]`; the row then shows
188
+ partially with the reason, and the exception does not hold back the exit code. An exception without a reason, for
189
+ another category's contract, for a contract that runs, or for every contract is not verified. A missing script is
190
+ not verified. `--json` gives the same rows and the one next
187
191
  step to an agent. It never runs the live check: that is the owner's run against their account.
188
192
 
189
193
  - `pnpm standards:check`
@@ -82,7 +82,7 @@ JSON Schema 2020-12.
82
82
 
83
83
  - **Why:** `run_id` finds the run later, and `complete` says whether the answer can be trusted as whole.
84
84
  - **Enforced by:** review only.
85
- - **Example:** `{ run_id, duration_ms, accounts?, complete, issues?, truncated?, timezone?, window?, ranking? }`.
85
+ - **Example:** `{ run_id, duration_ms, accounts?, complete, issues?, truncated?, timezone?, window?, ranking?, query? }`.
86
86
  `timezone`
87
87
  names the zone a time without one was read or shown in, and `window` the UTC bounds a date filter used
88
88
  ([Time](time.md)). `complete: false` with
@@ -90,7 +90,10 @@ JSON Schema 2020-12.
90
90
  answer. Neither one means another page exists: that is `page.has_more`. `ranking` says what a hosted model did to
91
91
  the order of a search's hits: `{ applied, reason_id?, provider, model, endpoint, sent, cost_usd, usage?, ms }`, with
92
92
  `reason_id` (such as `harder.timeout`) when its order was not used and `cost_usd: null` for a model with no known
93
- price. A program reads it instead of parsing a sentence.
93
+ price. `query` says what a search made of its query before it searched: `{ chat?, respelled? }`, with
94
+ `chat: { word, chat_id, title }` when a word named one chat and the search ran there, and
95
+ `respelled: [{ word, tried }]` for each unknown word and the known spellings tried in its place. A program reads
96
+ these instead of parsing a sentence.
94
97
  - **Exceptions:** none.
95
98
  - **Applies to:** all CLIs. **Since:** cli-base 0.41.0. **Rulings:** none.
96
99
 
@@ -274,13 +274,14 @@ a captured answer, beside it or in the table it comes from.
274
274
  Every repository sets `testTimeout: 15_000` in `vitest.config.ts`. A test that builds big data, such as a thousand
275
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
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.
277
+ shrunk before a release runner fails it. cli-base's `node-ci.yml` shows the same warning on every run, from the
278
+ merged report when the tests run in shards, and never fails the job.
278
279
 
279
280
  - **Why:** twice a release failed on a slow GitHub runner with no real wait involved, only CPU work: cli-core's test
280
281
  of 1200 meetings, and zoom-cli's `src/answer-entities.test.ts` at 6.9 s against vitest's default 5 s. Each
281
282
  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
283
  test passed in one and failed in another.
283
- - **Enforced by:** `pnpm test:slow`.
284
+ - **Enforced by:** `pnpm test:slow` · `node-ci.yml:check` · `node-ci.yml:coverage`.
284
285
  - **Example:** `vitest.config.ts` has `test: { testTimeout: 15_000 }`. A test that checks paging over many meetings
285
286
  builds as many as it needs to cross two pages, not 1200. `pnpm test:slow` ends with
286
287
  `warning: 1 test takes over 3 s, …` and the test's line on stderr; it still exits 0.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-base",
3
- "version": "0.108.0",
3
+ "version": "0.110.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",