@wirecat/cli-base 0.97.0 → 0.99.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/dist/commands/document.js +1 -1
  3. package/dist/commands/registry.d.ts +2 -1
  4. package/dist/dev/adopt.d.ts +6 -0
  5. package/dist/dev/adopt.js +43 -0
  6. package/dist/dev/audit.js +9 -2
  7. package/dist/dev/conformance.d.ts +5 -0
  8. package/dist/dev/conformance.js +24 -4
  9. package/dist/dev/family.d.ts +10 -0
  10. package/dist/dev/family.js +41 -0
  11. package/dist/dev/lint.d.ts +5 -0
  12. package/dist/dev/lint.js +32 -7
  13. package/dist/dev/main.js +157 -21
  14. package/dist/dev/network.js +19 -4
  15. package/dist/dev/shared-contracts.js +2 -0
  16. package/dist/http/index.d.ts +23 -2
  17. package/dist/http/index.js +61 -0
  18. package/dist/release/fragments.d.ts +17 -0
  19. package/dist/release/fragments.js +108 -0
  20. package/dist/release/index.d.ts +2 -0
  21. package/dist/release/index.js +2 -0
  22. package/dist/release/level.d.ts +2 -0
  23. package/dist/release/level.js +52 -0
  24. package/dist/standards/audit.d.ts +6 -1
  25. package/dist/standards/audit.js +28 -3
  26. package/dist/standards/flags-account.d.ts +3 -0
  27. package/dist/standards/flags-account.js +36 -0
  28. package/dist/standards/lint.d.ts +17 -1
  29. package/dist/standards/lint.js +22 -5
  30. package/dist/standards/tables.d.ts +1 -1
  31. package/dist/standards/tables.js +1 -1
  32. package/dist/standards/vocabulary.js +3 -0
  33. package/dist/wcat/manifest.d.ts +6 -0
  34. package/dist/wcat/manifest.js +14 -1
  35. package/docs/standards/accounts.md +3 -3
  36. package/docs/standards/commands.md +7 -3
  37. package/docs/standards/layout.md +1 -1
  38. package/docs/standards/lifecycle.md +4 -6
  39. package/docs/standards/output.md +2 -2
  40. package/docs/standards/releases.md +6 -4
  41. package/docs/standards/testing.md +1 -1
  42. package/docs/standards/toolchain.md +7 -3
  43. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ /** The version level a changelog section needs: `Added` a minor, a break a major (a minor before 1.0.0). */
2
+ const LEVELS = ["patch", "minor", "major"];
3
+ const parse = (version) => version.split(".").map(Number);
4
+ const raised = (from, to) => {
5
+ const [a = 0, b = 0] = parse(from);
6
+ const [x = 0, y = 0] = parse(to);
7
+ if (x !== a)
8
+ return "major";
9
+ return y !== b ? "minor" : "patch";
10
+ };
11
+ // Before 1.0.0 the minor carries what a major would; a fix-only release is the only patch.
12
+ const needed = (version, section) => {
13
+ const breaks = /^### (Changed — may break callers|Removed)$/m.test(section);
14
+ if (breaks)
15
+ return (parse(version)[0] ?? 0) >= 1 ? "major" : "minor";
16
+ return /^### Added$/m.test(section) ? "minor" : "patch";
17
+ };
18
+ const raise = (from, level) => {
19
+ const [a = 0, b = 0, c = 0] = parse(from);
20
+ if (level === "major")
21
+ return `${a + 1}.0.0`;
22
+ return level === "minor" ? `${a}.${b + 1}.0` : `${a}.${b}.${c + 1}`;
23
+ };
24
+ const later = (x, y) => {
25
+ const [a, b] = [parse(x), parse(y)];
26
+ const i = a.findIndex((n, k) => n !== b[k]);
27
+ return i === -1 || (a[i] ?? 0) > (b[i] ?? 0) ? x : y;
28
+ };
29
+ const sections = (changelog) => {
30
+ const [top, below] = [...changelog.matchAll(/^## (\S+).*$/gm)];
31
+ if (!top || !below?.[1])
32
+ return undefined;
33
+ return { version: top[1], previous: below[1], section: changelog.slice(top.index, below.index) };
34
+ };
35
+ // The next free number on npm is a patch; the top section may need a minor or major over the version below it.
36
+ export const levelledVersion = (changelog, next) => {
37
+ const parts = sections(changelog);
38
+ if (!parts)
39
+ return next;
40
+ return later(next, raise(parts.previous, needed(next, parts.section)));
41
+ };
42
+ export const versionLevelProblem = (changelog) => {
43
+ const parts = sections(changelog);
44
+ if (!parts?.version || !/^\d+\.\d+\.\d+$/.test(parts.version))
45
+ return undefined;
46
+ const { version, previous, section } = parts;
47
+ const want = needed(version, section);
48
+ const got = raised(previous, version);
49
+ if (LEVELS.indexOf(got) >= LEVELS.indexOf(want))
50
+ return undefined;
51
+ return `${version} raises the ${got} version over ${previous}, but its changelog needs a ${want} release`;
52
+ };
@@ -22,7 +22,10 @@ declare const parityGroupSchema: v.StrictObjectSchema<{
22
22
  /** Permanent differences, each with its reason; they count against the override budget of the group. */
23
23
  readonly differences: v.ArraySchema<v.StrictObjectSchema<{
24
24
  readonly rule: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a lower-case word, words joined by -">]>;
25
- /** `<clis> <path> <flag>`; with `absent` or `only`, only `<path> <flag>`: the CLI list is whoever else was compared. */
25
+ /**
26
+ * `<clis> <path> <flag>`; with `absent` or `only`, only `<path> <flag>`: the CLI list is whoever else was compared.
27
+ * same-entity-schema and same-error-reason name no CLI list either: `entity hit`, `reason profile.unknown: code`.
28
+ */
26
29
  readonly target: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>;
27
30
  readonly expected: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, undefined>;
28
31
  /** The CLI that lacks the path or flag by design; the rest must agree, so other CLIs joining do not stale it. */
@@ -30,6 +33,8 @@ declare const parityGroupSchema: v.StrictObjectSchema<{
30
33
  /** The one CLI that has the path or flag by design; every other CLI compared must lack it. */
31
34
  readonly only: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a lower-case word, words joined by -">]>, undefined>;
32
35
  readonly reason: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "must not be empty">]>, v.MinLengthAction<string, 10, "say why, in a sentence">]>;
36
+ /** Warns from 14 days before and fails 14 days after, as a lint override does. */
37
+ readonly review_after: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoDateAction<string, "a date, YYYY-MM-DD">]>, undefined>;
33
38
  }, undefined>, undefined>;
34
39
  }, undefined>;
35
40
  export type ParityGroup = v.InferOutput<typeof parityGroupSchema>;
@@ -51,7 +51,10 @@ const parityGroupSchema = v.strictObject({
51
51
  /** Permanent differences, each with its reason; they count against the override budget of the group. */
52
52
  differences: v.array(v.strictObject({
53
53
  rule: word,
54
- /** `<clis> <path> <flag>`; with `absent` or `only`, only `<path> <flag>`: the CLI list is whoever else was compared. */
54
+ /**
55
+ * `<clis> <path> <flag>`; with `absent` or `only`, only `<path> <flag>`: the CLI list is whoever else was compared.
56
+ * same-entity-schema and same-error-reason name no CLI list either: `entity hit`, `reason profile.unknown: code`.
57
+ */
55
58
  target: text,
56
59
  expected: v.optional(text),
57
60
  /** The CLI that lacks the path or flag by design; the rest must agree, so other CLIs joining do not stale it. */
@@ -59,6 +62,8 @@ const parityGroupSchema = v.strictObject({
59
62
  /** The one CLI that has the path or flag by design; every other CLI compared must lack it. */
60
63
  only: v.optional(word),
61
64
  reason: v.pipe(text, v.minLength(10, "say why, in a sentence")),
65
+ /** Warns from 14 days before and fails 14 days after, as a lint override does. */
66
+ review_after: v.optional(v.pipe(v.string(), v.isoDate("a date, YYYY-MM-DD"))),
62
67
  })),
63
68
  });
64
69
  export const defineParityGroups = (input) => parseRegistry("parity groups", v.array(parityGroupSchema), input, (groups) => [
@@ -93,8 +98,28 @@ const MEMO_DOCTOR_DEEP = {
93
98
  reason: "memo's doctor --deep also checks its own store (cli-memo #672); cli-core's shared doctor leaves --deep to " +
94
99
  "each CLI, and no other CLI has one",
95
100
  };
101
+ // The family audit measured these first in cli-base 0.98.0, as warnings; they fail since NEED-2578, and these were the
102
+ // differences on that day. The target names no CLI list: whoever shares the entity or reason, the difference holds.
103
+ const review = (rule, target, reason) => ({ rule, target, reason, review_after: "2026-11-27" });
104
+ const ENTITY = "same-entity-schema";
105
+ const REASON = "same-error-reason";
106
+ const MESSENGERS_SINCE_0_98 = [
107
+ review(ENTITY, "entity contact_context", "max, tg and wa print it in different schemas (measured 2026-11-13)"),
108
+ review(ENTITY, "entity contact_preparation", "max, tg and wa print it in different schemas (measured 2026-11-13)"),
109
+ review(ENTITY, "entity linked_person", "max, tg and wa print it in different schemas (measured 2026-11-13)"),
110
+ ];
111
+ const FAMILY_SINCE_0_98 = [
112
+ review(ENTITY, "entity api_method", "b24's schema differs from drive and gcal's (measured 2026-11-13)"),
113
+ review(ENTITY, "entity scheduled_job", "three schemas: b24, mail, memo / gcal / max, tg (measured 2026-11-13)"),
114
+ review(ENTITY, "entity hit", "three schemas: b24, memo, zm / gcal / max, tg, wa (measured 2026-11-13)"),
115
+ review(ENTITY, "entity deal", "b24's CRM deal and memo's differ (measured 2026-11-13)"),
116
+ review(ENTITY, "entity lead", "b24's CRM lead and memo's differ (measured 2026-11-13)"),
117
+ review(ENTITY, "entity product", "b24's CRM product and memo's differ (measured 2026-11-13)"),
118
+ review(REASON, "reason ai.address-refused=model.address-refused", "one failure under two names; cli-core 0.650.0 keeps one"),
119
+ review(REASON, "reason profile.unknown: code", "b24 gives it not_found, drive validation_error (measured 2026-11-13)"),
120
+ ];
96
121
  export const PARITY_GROUPS = defineParityGroups([
97
- { name: "messengers", members: ["tg", "max"], covers: "tree", differences: [] },
122
+ { name: "messengers", members: ["tg", "max"], covers: "tree", differences: MESSENGERS_SINCE_0_98 },
98
123
  {
99
124
  name: "all",
100
125
  members: ["tg", "max", "memo", "drive", "zm", "wa"],
@@ -116,7 +141,7 @@ export const PARITY_GROUPS = defineParityGroups([
116
141
  name: "gcal-shared",
117
142
  members: ["tg", "max", "memo", "drive", "zm", "wa", "gcal"],
118
143
  covers: ["commands", "upgrade", "notes", "meetings"],
119
- differences: [],
144
+ differences: FAMILY_SINCE_0_98,
120
145
  },
121
146
  // bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's meetings take call recordings, not
122
147
  // zoom-cli's: both are compared on the root commands every CLI shares, the way gcal and mail are on theirs.
@@ -0,0 +1,3 @@
1
+ import type { VocabularyFlag } from "./vocabulary.js";
2
+ /** The words cli-core's shared sign-in and account commands use in every CLI. */
3
+ export declare const ACCOUNT_FLAGS: VocabularyFlag[];
@@ -0,0 +1,36 @@
1
+ /** The words cli-core's shared sign-in and account commands use in every CLI. */
2
+ export const ACCOUNT_FLAGS = [
3
+ {
4
+ name: "--client-id",
5
+ value: "<id>",
6
+ role: "mode",
7
+ type: "id",
8
+ meaning: "sign in through the owner's own OAuth app with this client ID instead of WireCat's (WC-SECR-25)",
9
+ },
10
+ {
11
+ name: "--client-file",
12
+ value: "<file>",
13
+ role: "mode",
14
+ type: "path",
15
+ meaning: "sign in through the owner's own OAuth app read from this client JSON instead of WireCat's (WC-SECR-25)",
16
+ },
17
+ {
18
+ name: "--keep-data",
19
+ role: "mode",
20
+ type: "switch",
21
+ meaning: "remove the account but leave what the store holds of it, still searchable",
22
+ },
23
+ {
24
+ name: "--delete-data",
25
+ role: "mode",
26
+ type: "switch",
27
+ meaning: "remove the account and delete what the store and the tool's files hold of it",
28
+ },
29
+ {
30
+ name: "--answer-stdin",
31
+ role: "mode",
32
+ type: "switch",
33
+ meaning: "a sign-in step asks its question as a JSON line and reads the answer from stdin",
34
+ },
35
+ { name: "--hide-phone", role: "output", type: "switch", meaning: "leave the phone number out of the answer" },
36
+ ];
@@ -35,8 +35,24 @@ export declare const overridesSchema: v.ArraySchema<v.StrictObjectSchema<{
35
35
  export type Override = v.InferOutput<typeof overridesSchema>[number];
36
36
  /** What the schemas cannot say, so they stay convertible to JSON Schema: no entry twice. */
37
37
  export declare const baselineProblems: (targets: readonly string[]) => string[];
38
- /** No entry twice, and none past its `review_after` on `today` (YYYY-MM-DD, the caller's clock). */
38
+ /**
39
+ * Days around an override's `review_after` that only warn: a review comes due without turning every CI run of the CLI
40
+ * red on one morning, and a shared word due in several CLIs at once gets two weeks to land its fix.
41
+ */
42
+ export declare const REVIEW_GRACE_DAYS = 14;
43
+ /** An exception that expires: a lint override, or a parity group's difference, which may leave the date out. */
44
+ export interface Dated {
45
+ rule: string;
46
+ target: string;
47
+ review_after?: string;
48
+ owner?: string;
49
+ }
50
+ /** Entries more than `REVIEW_GRACE_DAYS` past their `review_after` on `today` (YYYY-MM-DD). */
51
+ export declare const overdue: (entries: readonly Dated[], today: string) => string[];
52
+ /** No entry twice, and none overdue. */
39
53
  export declare const overridesProblems: (entries: readonly Override[], today: string) => string[];
54
+ /** Entries whose `review_after` is at most `REVIEW_GRACE_DAYS` away on either side: due soon, or due and not failing yet. */
55
+ export declare const overridesDueSoon: (entries: readonly Dated[], today: string, check?: string) => string[];
40
56
  export declare const OVERRIDE_BUDGET = 10;
41
57
  /** More overrides of one rule than this, across every CLI, and the rule itself is due for review. */
42
58
  export declare const OVERRIDE_RULE_REVIEW = 3;
@@ -44,7 +44,7 @@ export const LINT_RULES = defineLintRules([
44
44
  },
45
45
  {
46
46
  id: "command-example-count",
47
- severity: "medium",
47
+ severity: "low",
48
48
  scope: "command",
49
49
  summary: "a leaf command has one to three examples; generated commands are exempt",
50
50
  },
@@ -150,13 +150,30 @@ export const overrideSchema = v.strictObject({
150
150
  export const overridesSchema = v.array(overrideSchema);
151
151
  /** What the schemas cannot say, so they stay convertible to JSON Schema: no entry twice. */
152
152
  export const baselineProblems = (targets) => duplicates(targets).map((target) => `"${target}" is listed twice`);
153
- /** No entry twice, and none past its `review_after` on `today` (YYYY-MM-DD, the caller's clock). */
153
+ /**
154
+ * Days around an override's `review_after` that only warn: a review comes due without turning every CI run of the CLI
155
+ * red on one morning, and a shared word due in several CLIs at once gets two weeks to land its fix.
156
+ */
157
+ export const REVIEW_GRACE_DAYS = 14;
158
+ const shiftDays = (date, days) => new Date(Date.parse(`${date}T00:00:00Z`) + days * 86_400_000).toISOString().slice(0, 10);
159
+ const ask = (entry) => (entry.owner ? `; ask ${entry.owner}` : "");
160
+ /** Entries more than `REVIEW_GRACE_DAYS` past their `review_after` on `today` (YYYY-MM-DD). */
161
+ export const overdue = (entries, today) => entries
162
+ .filter((entry) => entry.review_after !== undefined && shiftDays(entry.review_after, REVIEW_GRACE_DAYS) < today)
163
+ .map((entry) => `"${entry.rule} ${entry.target}" was due for review on ${entry.review_after}${ask(entry)}`);
164
+ /** No entry twice, and none overdue. */
154
165
  export const overridesProblems = (entries, today) => [
155
166
  ...duplicates(entries.map((entry) => `${entry.rule} ${entry.target}`)).map((both) => `"${both}" is listed twice`),
156
- ...entries
157
- .filter((entry) => entry.review_after < today)
158
- .map((entry) => `"${entry.rule} ${entry.target}" was due for review on ${entry.review_after}; ask ${entry.owner}`),
167
+ ...overdue(entries, today),
159
168
  ];
169
+ /** Entries whose `review_after` is at most `REVIEW_GRACE_DAYS` away on either side: due soon, or due and not failing yet. */
170
+ export const overridesDueSoon = (entries, today, check = "lint") => entries.flatMap((entry) => entry.review_after !== undefined &&
171
+ entry.review_after <= shiftDays(today, REVIEW_GRACE_DAYS) &&
172
+ shiftDays(entry.review_after, REVIEW_GRACE_DAYS) >= today
173
+ ? [
174
+ `"${entry.rule} ${entry.target}" is due for review on ${entry.review_after} and fails ${check} after ${shiftDays(entry.review_after, REVIEW_GRACE_DAYS)}${ask(entry)}`,
175
+ ]
176
+ : []);
160
177
  export const OVERRIDE_BUDGET = 10;
161
178
  /** More overrides of one rule than this, across every CLI, and the rule itself is due for review. */
162
179
  export const OVERRIDE_RULE_REVIEW = 3;
@@ -1,5 +1,5 @@
1
1
  export { AUDIT_BLOCKS, AUDIT_RULES, type AuditRule, defineAuditRules, defineParityGroups, defineRequiredRoots, PARITY_GROUPS, type ParityGroup, REQUIRED_ROOTS, type RequiredRoot, } from "./audit.js";
2
2
  export { defineFieldRules, FIELD_RULES, type FieldRule } from "./fields.js";
3
3
  export { defineIdentifiers, IDENTIFIERS, type Identifier } from "./identifiers.js";
4
- export { baselineProblems, baselineSchema, defineLintRules, LINT_RULES, LINT_SEVERITIES, type LintRule, type LintSeverity, OVERRIDE_BUDGET, OVERRIDE_RULE_REVIEW, type Override, overridesProblems, overridesSchema, rulesForReview, } from "./lint.js";
4
+ export { baselineProblems, baselineSchema, defineLintRules, LINT_RULES, LINT_SEVERITIES, type LintRule, type LintSeverity, OVERRIDE_BUDGET, OVERRIDE_RULE_REVIEW, type Override, overridesDueSoon, overridesProblems, overridesSchema, REVIEW_GRACE_DAYS, rulesForReview, } from "./lint.js";
5
5
  export { defineVocabulary, FLAG_ROLES, FLAG_TYPES, type FlagRole, type FlagType, VOCABULARY, type Vocabulary, type VocabularyFlag, type VocabularyNoun, type VocabularyVerb, vocabularySchema, } from "./vocabulary.js";
@@ -1,5 +1,5 @@
1
1
  export { AUDIT_BLOCKS, AUDIT_RULES, defineAuditRules, defineParityGroups, defineRequiredRoots, PARITY_GROUPS, REQUIRED_ROOTS, } from "./audit.js";
2
2
  export { defineFieldRules, FIELD_RULES } from "./fields.js";
3
3
  export { defineIdentifiers, IDENTIFIERS } from "./identifiers.js";
4
- export { baselineProblems, baselineSchema, defineLintRules, LINT_RULES, LINT_SEVERITIES, OVERRIDE_BUDGET, OVERRIDE_RULE_REVIEW, overridesProblems, overridesSchema, rulesForReview, } from "./lint.js";
4
+ export { baselineProblems, baselineSchema, defineLintRules, LINT_RULES, LINT_SEVERITIES, OVERRIDE_BUDGET, OVERRIDE_RULE_REVIEW, overridesDueSoon, overridesProblems, overridesSchema, REVIEW_GRACE_DAYS, rulesForReview, } from "./lint.js";
5
5
  export { defineVocabulary, FLAG_ROLES, FLAG_TYPES, VOCABULARY, vocabularySchema, } from "./vocabulary.js";
@@ -1,4 +1,5 @@
1
1
  import * as v from "valibot";
2
+ import { ACCOUNT_FLAGS } from "./flags-account.js";
2
3
  import { CALENDAR_FLAGS } from "./flags-calendar.js";
3
4
  import { CRM_FLAGS } from "./flags-crm.js";
4
5
  import { HOW_FLAGS } from "./flags-how.js";
@@ -166,6 +167,7 @@ const verbs = [
166
167
  "look at a source before taking anything from it: a chat link without joining, a mailbox without importing",
167
168
  ],
168
169
  ["send", "send a message"],
170
+ ["call", "call one provider API method by its own name, generated from the provider's method list"],
169
171
  ["edit", "change a sent message"],
170
172
  ["forward", "send an existing message on to another chat"],
171
173
  ["pin", "pin a message or chat"],
@@ -422,6 +424,7 @@ export const VOCABULARY = defineVocabulary({
422
424
  ...HOW_FLAGS,
423
425
  ...WHAT_FLAGS,
424
426
  ...PRIVACY_FLAGS,
427
+ ...ACCOUNT_FLAGS,
425
428
  ...CALENDAR_FLAGS,
426
429
  ...MAIL_FLAGS,
427
430
  ...KNOWLEDGE_FLAGS,
@@ -8,6 +8,12 @@ import { type CommandInfo } from "../commands/registry.js";
8
8
  import type { WcatTool } from "./describe.js";
9
9
  export declare const MANIFEST_FORMAT = 2;
10
10
  export declare const MANIFEST_FILE = "contracts/wirecat.json";
11
+ /**
12
+ * Hosts every CLI may reach through the shared packages rather than its own code: npm for the update check, Hugging
13
+ * Face for the models search, speech and pictures use, GitHub releases for the ONNX runtime and the speech detector,
14
+ * and the hosts both redirect their files to. `cli-dev manifest` adds them to the hosts a CLI declares.
15
+ */
16
+ export declare const SHARED_HOSTS: readonly string[];
11
17
  /** Desktop's `plain_word`: letters, digits and `._:=,/+@-`, at most two leading dashes, `--` alone, `{name}` slots. */
12
18
  export declare const PLAIN_WORD: RegExp;
13
19
  declare const signInSchema: v.StrictObjectSchema<{
@@ -11,6 +11,19 @@ import { issuesOf, jsonSchemaOf, SNAKE_CASE } from "../standards/registry.js";
11
11
  import { PROGRAM_PREFIX, TOOL_NAME } from "./names.js";
12
12
  export const MANIFEST_FORMAT = 2;
13
13
  export const MANIFEST_FILE = "contracts/wirecat.json";
14
+ /**
15
+ * Hosts every CLI may reach through the shared packages rather than its own code: npm for the update check, Hugging
16
+ * Face for the models search, speech and pictures use, GitHub releases for the ONNX runtime and the speech detector,
17
+ * and the hosts both redirect their files to. `cli-dev manifest` adds them to the hosts a CLI declares.
18
+ */
19
+ export const SHARED_HOSTS = [
20
+ "registry.npmjs.org",
21
+ "huggingface.co",
22
+ "*.huggingface.co",
23
+ "*.hf.co",
24
+ "github.com",
25
+ "*.githubusercontent.com",
26
+ ];
14
27
  /** Desktop's `plain_word`: letters, digits and `._:=,/+@-`, at most two leading dashes, `--` alone, `{name}` slots. */
15
28
  export const PLAIN_WORD = /^(?:--|-{0,2}(?:[A-Za-z0-9]|\{[A-Za-z]+\})(?:[A-Za-z0-9._:=,/+@-]|\{[A-Za-z]+\})*)$/;
16
29
  const plainWord = v.pipe(v.string(), v.maxLength(100, "a command word is at most 100 characters"), v.regex(PLAIN_WORD, (issue) => `${JSON.stringify(issue.input)} is not a plain word: letters, digits and ._:=,/+@-, at most two leading dashes, -- alone and {name} slots; no spaces, quotes or shell syntax`));
@@ -205,7 +218,7 @@ export const buildManifest = ({ identity, commands, pkg, skills }) => {
205
218
  ...(identity.hosts
206
219
  ? {
207
220
  network: {
208
- hosts: [...identity.hosts],
221
+ hosts: [...new Set([...identity.hosts, ...SHARED_HOSTS])],
209
222
  ...(identity.userHosts ? { user_hosts: identity.userHosts } : {}),
210
223
  },
211
224
  }
@@ -185,12 +185,12 @@ Every CLI that signs in has four commands under `session`:
185
185
  - **Enforced by:** review only.
186
186
  - **Example:** `gcal personal session status` answers whether the `personal` profile holds a Google login;
187
187
  `gcal session list` lists `personal` and `work` with no profile named.
188
- - **Exceptions:** known gaps, as of 2026-10-27:
188
+ - **Exceptions:** known gaps, as of 2026-11-12 (gcal and mail have all four):
189
189
  - tg, max and wa have `session start` and `session end`, no `session status`, and list their profiles with
190
190
  `account list` instead of `session list`.
191
191
  - drive has `session start`, `session list` and `session end`, and no `session status`.
192
- - zm has `session start` and `session status`, and no `session end` or `session list`.
193
- - memo signs in per mail account with `mail add` and has no `session` group.
192
+ - zm has `session start`, `session status` and `session end`, and no `session list`.
193
+ - memo has no `session` group: it has no profiles and reads the stores of the other CLIs, mail's among them.
194
194
 
195
195
  A CLI that adds a missing command adds it under `session`; a renamed path keeps no alias
196
196
  ([WC-CMD-8](commands.md#wc-cmd-8--keep-no-aliases-a-renamed-path-stops-working-in-the-release-that-renames-it)).
@@ -461,7 +461,9 @@ right one, never `not_found`.
461
461
  The CLI's `WCAT` identity lists every internet host it contacts in `hosts` (`["api.acme.example"]`, `[]` for none):
462
462
  lower-case hostnames with no scheme, port or path, and a leading `*.` only before two labels or more. A host the
463
463
  person chooses (a mail server, a page to read) is named in words in `userHosts`, and the CLI adds the configured host
464
- to the list at run time. `cli-dev manifest` writes them to `network` in `contracts/wirecat.json`. The CLI's own source
464
+ to the list at run time. `cli-dev manifest` writes them to `network` in `contracts/wirecat.json`, with the hosts the
465
+ shared packages reach for every CLI (`SHARED_HOSTS`: npm for the update check, Hugging Face and GitHub releases
466
+ for local models). The CLI's own source
465
467
  sends HTTP only through `hostFetch` from `@wirecat/cli-base/http`, which refuses any other host before a byte leaves
466
468
  the machine and checks every redirect.
467
469
 
@@ -474,7 +476,8 @@ the machine and checks every redirect.
474
476
  `const fetch = hostFetch({ hosts: WCAT.hosts ?? [] })`. `raw-network` reports `src/api.ts node:https` for an
475
477
  import of `node:https`, and `src/api.ts fetch` for the global `fetch` called or handed on as a value
476
478
  (`options.fetch ?? fetch`); `undeclared-host` reports `collector.acme.dev`, naming the files, for a URL whose host
477
- the shipped manifest does not list.
479
+ the shipped manifest does not list. A URL inside a sentence, such as a help link in printed text, is not reported;
480
+ one that starts a string is, because nothing tells it apart from a request's address.
478
481
  - **Exceptions:** network code that cannot use `hostFetch` (a socket protocol, a provider SDK) says why in
479
482
  `lint/overrides.json`, and still lists its hosts. The lint is not a sandbox: a dependency, a computed URL or `eval`
480
483
  passes it, which is why Desktop also scans the package and flags what it finds. A shipped manifest without
@@ -482,7 +485,8 @@ the machine and checks every redirect.
482
485
  no hosts yet; the warning becomes a failure once they do. With no manifest at all, the run only says the check is
483
486
  skipped.
484
487
  - **Applies to:** all CLIs, and third-party CLIs that join `wcat`. **Since:** the release after cli-base 0.84.0; the
485
- global fetch as a value and the missing-hosts warning since the release after 0.93.0.
488
+ global fetch as a value and the missing-hosts warning since the release after 0.93.0; the shared hosts, and URLs
489
+ inside a sentence left out of `undeclared-host`, since the release after 0.98.0.
486
490
  **Rulings:** none.
487
491
 
488
492
  ## Sources
@@ -26,7 +26,7 @@ Rule ids on this page are `WC-LAY-<n>`. How to read a rule, how ids work and whi
26
26
  - `skills/`: the agent skill the package ships;
27
27
  - `CHANGELOG.md`, `CLAUDE.md`, `SECURITY.md`, `README.md`, `LICENSE`;
28
28
  - git-ignored, on the working machine only: `CLEANUP.md`, `HANDOFF.md`, plans and journals.
29
- - **Exceptions:** a folder the CLI has no use for may be missing; memo has no `contracts/` yet. A product folder may
29
+ - **Exceptions:** a folder the CLI has no use for may be missing. A product folder may
30
30
  be added, such as `spec/` for a protocol or API description.
31
31
  - **Applies to:** all CLIs. **Since:** cli-base 0.41.0. **Rulings:** none.
32
32
 
@@ -20,13 +20,11 @@ and [WC-SECR-2](security.md#wc-secr-2--a-log-keeps-only-known-attribute-keys-and
20
20
 
21
21
  ### Who follows these rules today
22
22
 
23
- - **WC-LIFE-15:** tg, max, wa, gcal and the template. drive, memo and zm do not keep runs yet; each is adding them on a
24
- `feat/runs` branch (2026-10-25). zm's `resolveSettings` also returns `keepFailedRuns: false`, which turns off the
25
- failure log cli-core's `run` would keep.
23
+ - **WC-LIFE-15:** tg, max, wa, gcal, mail, drive, memo, zm and the template.
26
24
  - **WC-LIFE-16:** cli-core's shared calendar `sync`, from cli-core 0.464.0 (cli-core #2118); gcal has it. The
27
25
  deadlines of WC-LIFE-5 come with the same release. cli-core's shared CRM `sync`, from cli-core 0.591.0 (cli-core
28
26
  #2553), declares `cooperative` and `partial` and takes `--max-pages`; b24 has it. The other syncs (`messages sync`
29
- in tg, max and wa, drive's `sync`, memo's mail import, zm's `recordings sync`) are cooperative but spend no request
27
+ in tg, max and wa, drive's `sync`, mail's `sync`, zm's `recordings sync`) are cooperative but spend no request
30
28
  budget yet. gcal sets `requestMs` to 1.5 s, b24 to 1 s: a Bitrix24 portal allows 2 requests a second, shared by
31
29
  every app and webhook.
32
30
 
@@ -207,10 +205,10 @@ before its deadline.
207
205
  ### WC-LIFE-13 · A rerun goes on from where the last run stopped, and starting over is an option
208
206
 
209
207
  - **Why:** a rerun that lists or pages everything again repeats the work the kill cut short.
210
- - **Enforced by:** `drive-cli: src/sync.test.ts` · `cli-memo: src/mail/import.test.ts`.
208
+ - **Enforced by:** `drive-cli: src/sync.test.ts`.
211
209
  - **Example:** a rerun skips what is stored and does not redo the listing or paging that got there. The position
212
210
  lives in the store when the store already holds it: tg and max keep the held stretch of each chat, so
213
- `messages sync --all` skips a chat held to its newest message; memo keeps a resume point per mail folder; zm keeps
211
+ `messages sync --all` skips a chat held to its newest message; zm keeps
214
212
  the checkpoint of `recordings sync`. Otherwise it lives in a checkpoint file,
215
213
  `<state>/checkpoints/<profile>/<job>.json`, written with `saveCheckpoint` and read with `readCheckpoint` from
216
214
  `@wirecat/cli-core/background`. The write is atomic, and a torn file reads as no checkpoint: one run from the start,
@@ -137,7 +137,7 @@ JSON Schema 2020-12.
137
137
 
138
138
  - **Why:** an agent that reads one CLI's answer can read the other's.
139
139
  - **Enforced by:** `same-path-contract` (weekly audit; it does not block a pull request yet) · `same-entity-schema`
140
- (not wired yet: no CLI passes its schemas to the audit).
140
+ (the family audit, which reads every CLI's schemas).
141
141
  - **Example:** what only one messenger knows goes under `provider_metadata`, never as a top-level field one CLI has and
142
142
  the other lacks.
143
143
  - **Exceptions:** none.
@@ -190,7 +190,7 @@ whole or partial.
190
190
  ### WC-OUT-15 · Branch on `code` and `reason`, never on `message`
191
191
 
192
192
  - **Why:** the message is for a person and may change. The code and reason are the contract.
193
- - **Enforced by:** `same-error-reason` (not wired yet: no CLI passes its reasons to the audit).
193
+ - **Enforced by:** `same-error-reason` (the family audit, which reads every CLI's reasons).
194
194
  - **Example:** `reason` is a registered dotted id, such as `query.too-large`, defined with `defineReasons` where it is
195
195
  raised. `details` keeps only registered keys, and never a `cause`.
196
196
  - **Exceptions:** none.
@@ -220,10 +220,12 @@ and fails a first release (the base version is `0.0.0`) whose `package.json` ins
220
220
  After the live check of the real service passes
221
221
  ([WC-TEST-18](testing.md#wc-test-18--check-the-real-service-by-hand-never-in-the-test-suite)),
222
222
  `cli-dev live record --script <its script>` appends `<version> <commit> <date> <script> <tree>` to
223
- `docs/dev/live-checks.txt`, committed in the release pull request; `<tree>` is a SHA-256 of `git ls-tree HEAD -- src
224
- package.json pnpm-lock.yaml`. `bin/release` runs `cli-dev live check` first: it refuses a version with no line, and
225
- one whose `src/`, `package.json` or lockfile differ from the files the record hashed. The commit is information only;
226
- a line from before cli-base 0.80.8 has no `<tree>` and is still compared with its commit.
223
+ `docs/dev/live-checks.txt`, committed in the release pull request; `<tree>` is `v2:` and a SHA-256 of
224
+ `git ls-tree -r HEAD -- src package.json pnpm-lock.yaml` without the files that never ship: `*.test.*`, `src/testing/`,
225
+ `__snapshots__/` and `__fixtures__/`. A merge that changes only those needs no new live check. `bin/release` runs
226
+ `cli-dev live check` first: it refuses a version with no line, and one whose shipped files differ from the files the
227
+ record hashed. The commit is information only. A `<tree>` without `v2:` was written before cli-base 0.98.0 and is
228
+ still compared with every file; a line from before cli-base 0.80.8 has no `<tree>` and is compared with its commit.
227
229
 
228
230
  - **Why:** every automated check passed on bitrix24-cli while it ignored `deny` on reads; a release that says what
229
231
  was checked, and a live check bound to the code released, are what a reviewer reads instead of the whole diff.
@@ -209,7 +209,7 @@ and which run after merge is in [CI](ci.md).
209
209
  update check, MCP logins and lock files that only cli-core writes do not count. Tests still keep them in the
210
210
  sandboxed home, like every other path
211
211
  ([WC-TEST-1](#wc-test-1--point-every-path-a-test-could-write-at-a-temporary-directory)).
212
- - **Applies to:** all CLIs with local state. wa has no upgrade contract yet. **Since:** cli-base 0.41.0. **Rulings:** none.
212
+ - **Applies to:** all CLIs with local state. **Since:** cli-base 0.41.0. **Rulings:** none.
213
213
 
214
214
  ### WC-TEST-15 · A refactor keeps `commands --json` and the MCP tool list as they were
215
215
 
@@ -209,10 +209,14 @@ no-unbounded-spread ([WC-TOOL-12](#wc-tool-12--do-not-spread-a-list-of-user-data
209
209
  comes out when the shared package catches up. A word the CLI needs that the vocabulary does not have yet goes in
210
210
  `lint/overrides.json`, never in the baseline: its `reason` links the cli-base pull request or issue that adds the
211
211
  word, and it comes out in the change that takes the cli-base release with the word. The shared package's words
212
- go in the baseline, as above; the CLI's own go in the overrides, where the count and the date keep them few. A permanent exception also goes in `lint/overrides.json`, with `rule`, `target`, `reason`, `owner`
212
+ go in the baseline, as above; the CLI's own go in the overrides, where the count and the date keep them few. Once cli-core marks the commands it mounts
213
+ (`origin: "cli-core"` in `commands --json`), the lint fails a word rule's baseline entry on the CLI's own command and
214
+ an override on cli-core's; with `--allow-stale` it only warns. A permanent exception also goes in `lint/overrides.json`, with `rule`, `target`, `reason`, `owner`
213
215
  and `review_after`. More than 10
214
- overrides fail the run, and so does one past its date. The rules themselves are on the
215
- [Commands page](commands.md).
216
+ overrides fail the run. An override warns from 14 days before its `review_after`, and fails the run once it is more
217
+ than 14 days past it, so a date shared by several CLIs gives two weeks to land the fix. A rule of `low` severity
218
+ (`command-help-too-long`, `command-example-count`) is advice: its violations and stale baseline entries are printed
219
+ as warnings and fail nothing. The rules themselves are on the [Commands page](commands.md).
216
220
  - **Exceptions:** zoom runs `lint:commands` in full validation only. cli-core runs its own command lint test in
217
221
  `ci:quick`. cli-base, cli-testing, cli-docs and community have no command tree.
218
222
  - **Applies to:** the CLIs. **Since:** cli-base 0.41.0. **Rulings:** none.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-base",
3
- "version": "0.97.0",
3
+ "version": "0.99.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",