@wirecat/cli-base 1.0.0 → 1.1.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 +48 -0
- package/dist/codegen/graphql.js +37 -1
- package/dist/dev/audit.js +6 -3
- package/dist/dev/lint.d.ts +16 -0
- package/dist/dev/lint.js +48 -5
- package/dist/dev/main.js +2 -2
- package/dist/standards/audit.js +9 -6
- package/dist/standards/lint.js +6 -0
- package/docs/standards/README.md +1 -1
- package/docs/standards/accounts.md +9 -11
- package/docs/standards/architecture.md +2 -1
- package/docs/standards/ci.md +11 -5
- package/docs/standards/commands.md +31 -0
- package/docs/standards/kit-surface.md +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,54 @@ 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
|
+
## 1.1.0 — 27.11.2026
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`node-ci.yml` has a `secrets` input**: false skips its gitleaks scan of the whole history, for a repository whose
|
|
16
|
+
pull request security checks already scan it. It is on by default. Drop `validation / ci / secrets` from the
|
|
17
|
+
ruleset before turning it off, or the required check never reports. WC-CI-3 now lets such a repository keep lint,
|
|
18
|
+
types and secrets in one place ([CI standards](docs/standards/ci.md#wc-ci-3--run-the-fast-standards-job-on-every-pull-request-and-every-push-to-main)).
|
|
19
|
+
- **`cli-dev lint` reports a command at a path cli-core reserves when the CLI built it itself.** The paths are
|
|
20
|
+
`session start`, `session status`, `session end`, `session list`, `doctor`, `mcp`, `account remove`, `mirrors` and
|
|
21
|
+
`complete`. The new rule `reserved-shared-command` reads `commands --json` and names each such path that has no
|
|
22
|
+
`origin: "cli-core"`, with the cli-core helper to mount instead. Audits found own sessions, an own `mirrors`, an own
|
|
23
|
+
`doctor` and an own MCP server in several CLIs, and no check saw them, because `assertSharedContracts` looks only at
|
|
24
|
+
commands cli-core marked. For now it is a warning in `cli-dev lint` and in the family audit, so no CI run fails on
|
|
25
|
+
it. It becomes an error in a later release, planned for 2027-01-15, once cli-core marks `tokenSessionCommand`,
|
|
26
|
+
`oauthSessionCommand`, `fileMirrorsCommand` and `accountRemoveCommand`. Until then a CLI that mounts one of those is
|
|
27
|
+
reported too. A deliberate difference goes in `lint/overrides.json` with its reason, owner and `review_after`. An
|
|
28
|
+
entry for this rule in `lint/baseline/` fails the lint, because it has no reason or date. The rule is
|
|
29
|
+
[WC-CMD-34](docs/standards/commands.md#wc-cmd-34--mount-cli-cores-shared-command-at-a-reserved-path-never-one-of-your-own).
|
|
30
|
+
|
|
31
|
+
### Changed — experimental
|
|
32
|
+
|
|
33
|
+
- **A GraphQL CLI's agent skill has one API page per entity, not one for queries and one for mutations.**
|
|
34
|
+
`adaptGraphql` now gives each operation two tags. The first is the entity its field name acts on
|
|
35
|
+
(`issueLabelCreate` → `issue-label`, `searchIssues` → `issue`), or `query` / `mutation` for a name with no entity in
|
|
36
|
+
it. The second is `query` or `mutation`, as before. `apiSkillFiles` files a page per first tag, so an agent that
|
|
37
|
+
wants to archive an issue reads `<cli> skill show api-issue` instead of Linear's 4,335-line `api-mutation` page.
|
|
38
|
+
Regenerating rewrites `references/api/`, and `api show` prints both tags. Commands, their names and permission keys
|
|
39
|
+
stay the same. `api list tag:mutation` still works, and `tag:issue` now works too. A CLI that groups its `api`
|
|
40
|
+
commands by tag (`names.groups: "tags"`) would mount them by entity; no GraphQL CLI does today.
|
|
41
|
+
- **drive is compared with the other CLIs on the shared roots only, as ydisk is.** It left the `all`, `mail-shared`
|
|
42
|
+
and `gcal-shared` parity groups. Its `notes` and `search` are cli-core's documents commands: a note about one
|
|
43
|
+
imported document is not memo's note of your own, and a search over imported documents is not the messengers'
|
|
44
|
+
archive search. In `all` they differed from memo's and the messengers' in 21 paths, more than the group's budget
|
|
45
|
+
of 10 differences. `commands`, `doctor`, `skill`, `mcp` and `upgrade` are still compared in `shared-roots`.
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **A release makes its GitHub release again.** The release workflow pushed only the tag, so GitHub's releases page
|
|
50
|
+
stopped at the last release made by hand. The `tag` job now creates the release from the version's changelog
|
|
51
|
+
section, as the CLIs' release workflows do. 1.x was backfilled by hand.
|
|
52
|
+
- **WC-ACCT-12 has no exceptions.** memo was listed as one, but it signs in to no account: it reads the stores of the
|
|
53
|
+
other CLIs, and `memo models keys` keeps a model provider's key. The rule covers only CLIs that sign in, so memo was
|
|
54
|
+
never under it.
|
|
55
|
+
- **WC-ACCT-12 has no known gaps left but memo.** drive has `session status` since 0.76.0. tg, max and wa have
|
|
56
|
+
`session status` and `session list`, and `account list` is removed from them with no alias.
|
|
57
|
+
WC-ACCT-1 no longer says that tg, max and wa name their profile list `account list`.
|
|
58
|
+
|
|
11
59
|
## 1.0.0 — 25.11.2026
|
|
12
60
|
|
|
13
61
|
### Fixed
|
package/dist/codegen/graphql.js
CHANGED
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
* One field of `Query` or `Mutation` is one operation. Its arguments are the request body (the variables), each also a
|
|
7
7
|
* flag; its answer is `data.<field>`, typed by the field's type. A query reads; a mutation writes, and one whose name
|
|
8
8
|
* ends in `Delete` or `Archive` deletes. A Relay connection pages as a `cursor`: `after`, `pageInfo.endCursor`.
|
|
9
|
+
* Its first tag is the entity its name acts on (`issueLabelCreate` → `issue-label`), its second `query` or `mutation`:
|
|
10
|
+
* the agent skill files one page per first tag, and an agent looking for an issue's writes reads only the issue page.
|
|
9
11
|
* SDL is not read: that needs graphql-js, and codegen adds no runtime dependency.
|
|
10
12
|
*/
|
|
11
13
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
12
14
|
import { join } from "node:path";
|
|
15
|
+
import { kebab } from "./names.js";
|
|
13
16
|
import { CodegenError } from "./pipeline.js";
|
|
14
17
|
import { sha256, sortKeys } from "./snapshot.js";
|
|
15
18
|
const object = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
@@ -161,6 +164,39 @@ export const adaptGraphql = (introspection, options) => {
|
|
|
161
164
|
const node = connectionOf(name);
|
|
162
165
|
return node ? `nodes { ${oneLevel(node)} } pageInfo { hasNextPage endCursor }` : oneLevel(name);
|
|
163
166
|
};
|
|
167
|
+
const entities = new Map([...types.values()]
|
|
168
|
+
.filter((type) => fieldsOf(type.name)?.some((one) => one.name === "id"))
|
|
169
|
+
.map((type) => [type.name.toLowerCase(), type.name]));
|
|
170
|
+
const singulars = (word) => [
|
|
171
|
+
word,
|
|
172
|
+
...(word.endsWith("ies") ? [`${word.slice(0, -3)}y`] : []),
|
|
173
|
+
...(word.endsWith("es") ? [word.slice(0, -2)] : []),
|
|
174
|
+
...(word.endsWith("s") ? [word.slice(0, -1)] : []),
|
|
175
|
+
];
|
|
176
|
+
/**
|
|
177
|
+
* The earliest, then longest, run of the name's words that names an object with an id, its last word read singular
|
|
178
|
+
* too: `issueLabels` → `issue-label`, `searchIssues` → `issue`. A mutation's whole name is never its entity, as
|
|
179
|
+
* `projectUpdate` changes a project while the type `ProjectUpdate` is a status post. None: its kind, one page for
|
|
180
|
+
* the few leftovers rather than a page per verb.
|
|
181
|
+
*/
|
|
182
|
+
const entityOf = (name, operation) => {
|
|
183
|
+
const words = name
|
|
184
|
+
.split(/_+|(?=[A-Z])/)
|
|
185
|
+
.filter(Boolean)
|
|
186
|
+
.map((word) => word.toLowerCase());
|
|
187
|
+
for (let start = 0; start < words.length; start++)
|
|
188
|
+
for (let end = words.length; end > start; end--) {
|
|
189
|
+
if (operation === "mutation" && start === 0 && end === words.length)
|
|
190
|
+
continue;
|
|
191
|
+
const head = words.slice(start, end - 1).join("");
|
|
192
|
+
const found = singulars(words[end - 1] ?? "")
|
|
193
|
+
.map((last) => entities.get(head + last))
|
|
194
|
+
.find(Boolean);
|
|
195
|
+
if (found)
|
|
196
|
+
return kebab(found);
|
|
197
|
+
}
|
|
198
|
+
return operation;
|
|
199
|
+
};
|
|
164
200
|
// An answer that is only a reference is named after its type, which would drop a nullable field's null: such an
|
|
165
201
|
// answer is wrapped, so it gets a name of its own that keeps it.
|
|
166
202
|
const answerOf = (node) => node.type === "ref" && node.nullable
|
|
@@ -222,7 +258,7 @@ export const adaptGraphql = (introspection, options) => {
|
|
|
222
258
|
binding,
|
|
223
259
|
...(summary ? { summary } : {}),
|
|
224
260
|
...described(field.description),
|
|
225
|
-
tags: [operation],
|
|
261
|
+
tags: [entityOf(field.name, operation), operation],
|
|
226
262
|
parameters: field.args.map((one) => ({
|
|
227
263
|
name: one.name,
|
|
228
264
|
in: "body",
|
package/dist/dev/audit.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AUDIT_RULES, SHARED_DIFFERENCES, } from "../standards/audit.js";
|
|
|
2
2
|
import { BASE_REASONS } from "../standards/errors.js";
|
|
3
3
|
import { LINT_RULES, OVERRIDE_BUDGET, overdue, overridesDueSoon } from "../standards/lint.js";
|
|
4
4
|
import { capabilityDifference } from "./capabilities.js";
|
|
5
|
-
import { judge, kindOf, lintCommands, longName, registeredKinds, summaryOf, walk } from "./lint.js";
|
|
5
|
+
import { judge, kindOf, lintCommands, longName, OVERRIDE_ONLY_RULES, registeredKinds, summaryOf, WARNING_RULES, walk, } from "./lint.js";
|
|
6
6
|
import { sharedContractProblems } from "./shared-contracts.js";
|
|
7
7
|
const UNLISTED_RULES = new Set(["same-entity-schema", "same-error-reason"]);
|
|
8
8
|
const STRICT_CONTRACT_RULES = new Set([
|
|
@@ -357,7 +357,8 @@ export const auditClis = (inputs, options, rules = AUDIT_RULES) => {
|
|
|
357
357
|
fixed: verdict.stale.filter((entry) => entry.in === "baseline").length,
|
|
358
358
|
new_targets: verdict.fresh.map((violation) => `${cli}: ${violation.target}`),
|
|
359
359
|
};
|
|
360
|
-
|
|
360
|
+
if (!WARNING_RULES.has(rule))
|
|
361
|
+
blocking.push(...mine.filter((finding) => row.new_targets.includes(finding.target)));
|
|
361
362
|
}
|
|
362
363
|
else {
|
|
363
364
|
const open = mine.filter((finding) => !declared.has(`${rule} ${finding.target}`) &&
|
|
@@ -378,7 +379,7 @@ export const auditClis = (inputs, options, rules = AUDIT_RULES) => {
|
|
|
378
379
|
(!here.has(target) || declared.has(`${rule} ${target}`))).length,
|
|
379
380
|
new_targets: fresh.map((finding) => finding.target),
|
|
380
381
|
};
|
|
381
|
-
const blocks = lintIds.includes(rule) || options.blocks === "new";
|
|
382
|
+
const blocks = !WARNING_RULES.has(rule) && (lintIds.includes(rule) || options.blocks === "new");
|
|
382
383
|
if (blocks)
|
|
383
384
|
blocking.push(...fresh);
|
|
384
385
|
}
|
|
@@ -395,6 +396,8 @@ export const auditClis = (inputs, options, rules = AUDIT_RULES) => {
|
|
|
395
396
|
!inheritedAccepted.has(`${rule} ${finding.target}`))
|
|
396
397
|
.filter((finding) => !(lintIds.includes(rule) && selfJudged.has(finding.clis[0] ?? "")))
|
|
397
398
|
.map((finding) => finding.target);
|
|
399
|
+
if (OVERRIDE_ONLY_RULES.has(rule))
|
|
400
|
+
return [rule, []];
|
|
398
401
|
return [rule, STRICT_CONTRACT_RULES.has(rule) ? kept : [...new Set([...kept, ...now])].sort(byText)];
|
|
399
402
|
}));
|
|
400
403
|
const unique = new Map(blocking.map((finding) => [`${finding.rule} ${finding.target}`, finding]));
|
package/dist/dev/lint.d.ts
CHANGED
|
@@ -18,6 +18,22 @@ export declare const kindOf: (option: OptionInfo) => string;
|
|
|
18
18
|
export { summaryOf };
|
|
19
19
|
/** The kinds of value the vocabulary lets each flag take: its own value, or `switch`, then its `otherValues`. */
|
|
20
20
|
export declare const registeredKinds: (vocabulary: Vocabulary) => Map<string, string[]>;
|
|
21
|
+
/**
|
|
22
|
+
* WC-CMD-34: root paths only cli-core's shared commands may hold. A group is judged by its own node, so a subcommand a
|
|
23
|
+
* CLI adds to a shared group stays allowed; `session` is judged by its four leaves, which a CLI may hold in its own group.
|
|
24
|
+
*/
|
|
25
|
+
export declare const RESERVED_COMMANDS: readonly {
|
|
26
|
+
path: string;
|
|
27
|
+
leaves?: readonly string[];
|
|
28
|
+
helpers: string;
|
|
29
|
+
}[];
|
|
30
|
+
/**
|
|
31
|
+
* Rules in their warning phase: `cli-dev lint` and the audit print them and never fail on them. The rule's page names
|
|
32
|
+
* the release that ends the phase.
|
|
33
|
+
*/
|
|
34
|
+
export declare const WARNING_RULES: ReadonlySet<string>;
|
|
35
|
+
/** Rules whose exception must carry a reason and a date: a baseline entry has neither, so it is refused. */
|
|
36
|
+
export declare const OVERRIDE_ONLY_RULES: ReadonlySet<string>;
|
|
21
37
|
export interface LintContext {
|
|
22
38
|
/** The commands document as the CLI printed it; parsing drops keys it does not know, so casing is checked here. */
|
|
23
39
|
raw?: unknown;
|
package/dist/dev/lint.js
CHANGED
|
@@ -33,6 +33,29 @@ export const registeredKinds = (vocabulary) => new Map(vocabulary.flags.map((fla
|
|
|
33
33
|
[flag.value?.slice(1, -1).toLowerCase() ?? "switch", ...(flag.otherValues ?? [])],
|
|
34
34
|
]));
|
|
35
35
|
const label = (command) => command.path.join(" ");
|
|
36
|
+
/**
|
|
37
|
+
* WC-CMD-34: root paths only cli-core's shared commands may hold. A group is judged by its own node, so a subcommand a
|
|
38
|
+
* CLI adds to a shared group stays allowed; `session` is judged by its four leaves, which a CLI may hold in its own group.
|
|
39
|
+
*/
|
|
40
|
+
export const RESERVED_COMMANDS = [
|
|
41
|
+
{
|
|
42
|
+
path: "session",
|
|
43
|
+
leaves: ["start", "status", "end", "list"],
|
|
44
|
+
helpers: "`tokenSessionCommand`, `oauthSessionCommand` or `messengerSessionCommands`",
|
|
45
|
+
},
|
|
46
|
+
{ path: "doctor", helpers: "`appDoctorCommand` or `doctorCommand`" },
|
|
47
|
+
{ path: "mcp", helpers: "`appMcpCommand` or `mcpCommand`" },
|
|
48
|
+
{ path: "account remove", helpers: "`accountRemoveCommand` (or the group from `accountCommand`)" },
|
|
49
|
+
{ path: "mirrors", helpers: "`fileMirrorsCommand` or `addDocumentMirrorCommands`" },
|
|
50
|
+
{ path: "complete", helpers: "`appCompleteCommand` or `completeCommand`" },
|
|
51
|
+
];
|
|
52
|
+
/**
|
|
53
|
+
* Rules in their warning phase: `cli-dev lint` and the audit print them and never fail on them. The rule's page names
|
|
54
|
+
* the release that ends the phase.
|
|
55
|
+
*/
|
|
56
|
+
export const WARNING_RULES = new Set(["reserved-shared-command"]);
|
|
57
|
+
/** Rules whose exception must carry a reason and a date: a baseline entry has neither, so it is refused. */
|
|
58
|
+
export const OVERRIDE_ONLY_RULES = new Set(["reserved-shared-command"]);
|
|
36
59
|
/** The run log's reader and its switches; what `runsCommand` and cli-core's shared program add. */
|
|
37
60
|
export const RUN_LOG_COMMANDS = ["runs list", "runs show"];
|
|
38
61
|
export const RUN_LOG_FLAGS = ["--record", "--no-record"];
|
|
@@ -429,6 +452,20 @@ const CHECKS = {
|
|
|
429
452
|
: []),
|
|
430
453
|
];
|
|
431
454
|
},
|
|
455
|
+
"reserved-shared-command": (document) => {
|
|
456
|
+
const at = new Map(walk(document.commands).map((command) => [label(command), command]));
|
|
457
|
+
return RESERVED_COMMANDS.flatMap(({ path, leaves, helpers }) => {
|
|
458
|
+
const own = (leaves ? leaves.map((leaf) => `${path} ${leaf}`) : [path]).filter((one) => at.has(one) && at.get(one)?.origin !== "cli-core");
|
|
459
|
+
return own.length === 0
|
|
460
|
+
? []
|
|
461
|
+
: [
|
|
462
|
+
{
|
|
463
|
+
target: path,
|
|
464
|
+
message: `${own.join(", ")} built by the CLI. Mount cli-core's ${helpers}, or add an override with the reason`,
|
|
465
|
+
},
|
|
466
|
+
];
|
|
467
|
+
});
|
|
468
|
+
},
|
|
432
469
|
"raw-network": (_document, _vocabulary, context) => (context.network ? rawNetwork(context.network) : []),
|
|
433
470
|
"undeclared-host": (_document, _vocabulary, context) => (context.network ? undeclaredHosts(context.network) : []),
|
|
434
471
|
"result-shape": (_document, _vocabulary, context) => (context.declarations ? resultShape(context.declarations) : []),
|
|
@@ -478,10 +515,12 @@ export const baselineOf = (violations, overrides, rules = LINT_RULES) => {
|
|
|
478
515
|
const overridden = new Set(overrides.map((entry) => `${entry.rule} ${entry.target}`));
|
|
479
516
|
return Object.fromEntries(rules.map((rule) => [
|
|
480
517
|
rule.id,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
518
|
+
OVERRIDE_ONLY_RULES.has(rule.id)
|
|
519
|
+
? []
|
|
520
|
+
: violations
|
|
521
|
+
.filter((violation) => violation.rule === rule.id && !overridden.has(`${violation.rule} ${violation.target}`))
|
|
522
|
+
.map((violation) => violation.target)
|
|
523
|
+
.sort(),
|
|
485
524
|
]));
|
|
486
525
|
};
|
|
487
526
|
/** The rules about words: which list an exception goes in depends on who owns the word (WC-TOOL-16). */
|
|
@@ -491,14 +530,18 @@ const WORD_RULES = new Set(["unknown-verb", "unknown-resource", "option-role", "
|
|
|
491
530
|
* mounts belongs in the baseline until cli-core or the vocabulary catches up. Silent until cli-core marks its commands.
|
|
492
531
|
*/
|
|
493
532
|
export const misfiled = (document, baseline, overrides) => {
|
|
533
|
+
const reasonless = [...OVERRIDE_ONLY_RULES]
|
|
534
|
+
.filter((rule) => (baseline[rule] ?? []).length > 0)
|
|
535
|
+
.map((rule) => `an exception to ${rule} is in the baseline: move it to the overrides, with its reason and date`);
|
|
494
536
|
const commands = walk(document.commands).sort((a, b) => b.path.length - a.path.length);
|
|
495
537
|
if (!commands.some((command) => command.origin === "cli-core"))
|
|
496
|
-
return
|
|
538
|
+
return reasonless;
|
|
497
539
|
const ownerOf = (target) => commands.find((command) => {
|
|
498
540
|
const path = label(command);
|
|
499
541
|
return target === path || target.startsWith(`${path} `) || target.startsWith(`${path}:`);
|
|
500
542
|
})?.origin;
|
|
501
543
|
return [
|
|
544
|
+
...reasonless,
|
|
502
545
|
...Object.entries(baseline)
|
|
503
546
|
.filter(([rule]) => WORD_RULES.has(rule))
|
|
504
547
|
.flatMap(([rule, targets]) => targets
|
package/dist/dev/main.js
CHANGED
|
@@ -27,7 +27,7 @@ import { readCapabilities } from "./capabilities.js";
|
|
|
27
27
|
import { CONFORMANCE_USAGE, conformanceCommand } from "./conformance.js";
|
|
28
28
|
import { familyPackages, installFamily } from "./family.js";
|
|
29
29
|
import { changelogChange, landChange, landFold, newestTag, processShell, restoreChange } from "./land.js";
|
|
30
|
-
import { baselineOf, judge, lintCommands, misfiled, RUN_LOG_COMMANDS, walk } from "./lint.js";
|
|
30
|
+
import { baselineOf, judge, lintCommands, misfiled, RUN_LOG_COMMANDS, WARNING_RULES, walk, } from "./lint.js";
|
|
31
31
|
import { readSources } from "./network.js";
|
|
32
32
|
import { levelCommand, nextVersion } from "./next-version.js";
|
|
33
33
|
import { READY_USAGE, ready } from "./ready.js";
|
|
@@ -539,7 +539,7 @@ const lintRun = (args, io) => {
|
|
|
539
539
|
}
|
|
540
540
|
const verdict = judge(violations, baseline, ruleOverrides, budget);
|
|
541
541
|
// A low rule is advice: it is printed and never fails, so polishing help text never holds a merge.
|
|
542
|
-
const advice = (rule) => severity.get(rule) === "low";
|
|
542
|
+
const advice = (rule) => severity.get(rule) === "low" || WARNING_RULES.has(rule);
|
|
543
543
|
const advised = [];
|
|
544
544
|
for (const id of verdict.unknownRules)
|
|
545
545
|
problems.push(`no lint rule "${id}" (named in ${values.baseline} or ${values.overrides})`);
|
package/dist/standards/audit.js
CHANGED
|
@@ -168,7 +168,7 @@ export const PARITY_GROUPS = defineParityGroups([
|
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
name: "all",
|
|
171
|
-
members: ["tg", "max", "memo", "
|
|
171
|
+
members: ["tg", "max", "memo", "zm", "wa"],
|
|
172
172
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade", "search", "notes", "meetings"],
|
|
173
173
|
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP],
|
|
174
174
|
},
|
|
@@ -177,7 +177,7 @@ export const PARITY_GROUPS = defineParityGroups([
|
|
|
177
177
|
// and moves back into "all" once its search is aligned with the messengers' or renamed.
|
|
178
178
|
{
|
|
179
179
|
name: "mail-shared",
|
|
180
|
-
members: ["tg", "max", "memo", "
|
|
180
|
+
members: ["tg", "max", "memo", "zm", "wa", "mail"],
|
|
181
181
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade", "notes", "meetings"],
|
|
182
182
|
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP],
|
|
183
183
|
},
|
|
@@ -185,7 +185,7 @@ export const PARITY_GROUPS = defineParityGroups([
|
|
|
185
185
|
// CLIs agree there (https://github.com/WireCatLabs/cli-base/issues/390), then gcal moves back into "all".
|
|
186
186
|
{
|
|
187
187
|
name: "gcal-shared",
|
|
188
|
-
members: ["tg", "max", "memo", "
|
|
188
|
+
members: ["tg", "max", "memo", "zm", "wa", "gcal"],
|
|
189
189
|
covers: ["commands", "upgrade", "notes", "meetings"],
|
|
190
190
|
differences: FAMILY_SINCE_0_98,
|
|
191
191
|
},
|
|
@@ -194,9 +194,12 @@ export const PARITY_GROUPS = defineParityGroups([
|
|
|
194
194
|
// amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
|
|
195
195
|
// wordpress-cli shares only these roots: it is the first content CLI, so its posts commands have no group yet.
|
|
196
196
|
// linear-cli shares only these roots too: it is the first tracker CLI, so its issues commands have no group yet.
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
197
|
+
// drive and ydisk are compared here only, not in "all", "mail-shared" or "gcal-shared": their notes and search are
|
|
198
|
+
// cli-core's documents commands. A note about one imported document is not memo's note of your own, and a search over
|
|
199
|
+
// imported documents is not the messengers' archive search, so the two differ on purpose (21 paths for drive against
|
|
200
|
+
// memo and the messengers, measured on the published CLIs 2026-11-26; one difference each would be over the budget of 10).
|
|
201
|
+
// notion-cli joins here until its documents commands ship. A documents group of drive, notion and ydisk differs in
|
|
202
|
+
// 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
|
|
200
203
|
{
|
|
201
204
|
name: "shared-roots",
|
|
202
205
|
members: [
|
package/dist/standards/lint.js
CHANGED
|
@@ -140,6 +140,12 @@ export const LINT_RULES = defineLintRules([
|
|
|
140
140
|
scope: "type",
|
|
141
141
|
summary: "a list or search in the published TypeScript API returns `{ items, hasMore, nextOffset?, total? }`: no bare array, no `hits` or `has_more`",
|
|
142
142
|
},
|
|
143
|
+
{
|
|
144
|
+
id: "reserved-shared-command",
|
|
145
|
+
severity: "high",
|
|
146
|
+
scope: "command",
|
|
147
|
+
summary: "`session start|status|end|list`, `doctor`, `mcp`, `account remove`, `mirrors` and `complete` are cli-core's shared commands, never built by the CLI",
|
|
148
|
+
},
|
|
143
149
|
]);
|
|
144
150
|
/**
|
|
145
151
|
* `lint/baseline/<rule-id>.json`: today's violations of one rule, by target. It may only shrink.
|
package/docs/standards/README.md
CHANGED
|
@@ -29,7 +29,7 @@ the four steps that need a person. A new CLI is ready for its first release when
|
|
|
29
29
|
|---|---|---:|---|
|
|
30
30
|
| [Toolchain](toolchain.md) | `TOOL` | 20 | TypeScript, Biome, grit plugins, size caps, import cycles, spelling, Markdown, Go |
|
|
31
31
|
| [Layout](layout.md) | `LAY` | 10 | Repository layout, entry points, exports, file size, one job per file, splitting a unit, the bundled bin |
|
|
32
|
-
| [Commands](commands.md) | `CMD` |
|
|
32
|
+
| [Commands](commands.md) | `CMD` | 34 | Paths, vocabulary, flags, arguments, effects, lifetime, query, help, external references, joining `wcat`, settings in the config file, refs, network hosts, the generated `api` group, the paths cli-core reserves |
|
|
33
33
|
| [Output](output.md) | `OUT` | 25 | Data on stdout only, envelopes, errors, exit codes, partial answers, projection, list results in a TypeScript API |
|
|
34
34
|
| [MCP](mcp.md) | `MCP` | 13 | The MCP tools, how they come from commands, what each permission shows |
|
|
35
35
|
| [Accounts](accounts.md) | `ACCT` | 13 | The explicit profile, reads across accounts, scope flags, linked identities, sign-in commands, memo's account groups |
|
|
@@ -40,7 +40,7 @@ on the computer.
|
|
|
40
40
|
is refused.
|
|
41
41
|
- **Exceptions:** a command that touches no account runs without a profile, for example `session list`
|
|
42
42
|
([WC-ACCT-12](#wc-acct-12--sign-in-is-session-start-status-and-end-and-session-list-names-the-profiles)),
|
|
43
|
-
`config show` and `commands
|
|
43
|
+
`config show` and `commands`. `mcp serve` may name its profiles with `--profiles <names|all>` instead
|
|
44
44
|
([WC-MCP-9](mcp.md#wc-mcp-9--a-server-serves-the-profiles-it-is-told-with-one-connection-for-each)); `all` is the owner's explicit choice, never a fallback.
|
|
45
45
|
- **Applies to:** all CLIs. **Since:** cli-base 0.41.0. **Rulings:** NEED-84, NEED-1881.
|
|
46
46
|
|
|
@@ -185,17 +185,15 @@ 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:**
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
A CLI that adds a missing command adds it under `session`; a renamed path keeps no alias
|
|
188
|
+
- **Exceptions:** none. memo signs in to no account, so the rule does not apply to it: it reads the stores of the
|
|
189
|
+
other CLIs, and `memo models keys` keeps a model provider's key, not a sign-in. Every CLI that signs in has all
|
|
190
|
+
four, tg, max and wa included: cli-core's shared `session`
|
|
191
|
+
contract requires `status` and `list` (`messengerSessionCommands`), and its messenger `account` group has no `list`.
|
|
192
|
+
`account list` is removed from tg, max and wa with no alias.
|
|
193
|
+
|
|
194
|
+
A CLI that adds a missing command adds it under `session`. A renamed path keeps no alias
|
|
197
195
|
([WC-CMD-8](commands.md#wc-cmd-8--keep-no-aliases-a-renamed-path-stops-working-in-the-release-that-renames-it)).
|
|
198
|
-
- **Applies to:** every CLI that signs in. **Since:** cli-base 0.65.0. **Rulings:** NEED-1884.
|
|
196
|
+
- **Applies to:** every CLI that signs in. **Since:** cli-base 0.65.0. **Rulings:** NEED-1884, NEED-2915, NEED-2936.
|
|
199
197
|
|
|
200
198
|
### WC-ACCT-13 · memo's first word is an account group, and the default group `all` holds every account
|
|
201
199
|
|
|
@@ -113,7 +113,8 @@ cli-core's entities, and the adapter behind cli-core's ports. CRM is the first d
|
|
|
113
113
|
### WC-ARCH-6 · Replace a use case, not a command
|
|
114
114
|
|
|
115
115
|
- **Why:** when a CLI replaces the service method, its command and its MCP tool both get the change.
|
|
116
|
-
- **Enforced by:** review only.
|
|
116
|
+
- **Enforced by:** review only. For the paths cli-core reserves, `reserved-shared-command`
|
|
117
|
+
([WC-CMD-34](commands.md#wc-cmd-34--mount-cli-cores-shared-command-at-a-reserved-path-never-one-of-your-own)).
|
|
117
118
|
- **Example:** `Messenger.services` receives the shared services and returns only the ones it changes:
|
|
118
119
|
`services: (base) => ({ messages: { ...base.messages, list: maxList } })`. To add a subcommand, a CLI calls
|
|
119
120
|
`addCommand` on the command a factory returns. A calendar CLI changes what the shared calendar commands do through
|
package/docs/standards/ci.md
CHANGED
|
@@ -45,8 +45,13 @@ plus community itself. cli-template follows every rule here as a CLI does
|
|
|
45
45
|
`pnpm lint`, `pnpm docs:lint`, `pnpm run --if-present ci:quick` and a gitleaks scan of the new commits only. A new
|
|
46
46
|
commit cancels the run it replaces. The job times out after five minutes, a ceiling for a stalled setup, not an
|
|
47
47
|
expected time.
|
|
48
|
-
- **Exceptions:**
|
|
49
|
-
|
|
48
|
+
- **Exceptions:** a repository whose pull request validation runs `node-ci.yml` on every pull request and merge
|
|
49
|
+
(its `check` job lints and checks types) may leave `pnpm lint` and `ci:quick` out of this job, and one whose pull
|
|
50
|
+
request security checks scan the whole history for secrets may leave out the gitleaks scan. Each check then runs
|
|
51
|
+
in one place. cli-core does both (2026-11-26): its `standards` keeps the changelog rule, `standards:check` and
|
|
52
|
+
`docs:lint`. Runner queues and cold downloads are outside the budget.
|
|
53
|
+
- **Applies to:** the WireCat repositories. **Since:** cli-base 0.41.0. **Rulings:** NEED-2 on cli-core#3386
|
|
54
|
+
(2026-11-26).
|
|
50
55
|
|
|
51
56
|
### WC-CI-4 · Keep `ci:quick` to early bug checks that finish within two minutes
|
|
52
57
|
|
|
@@ -56,7 +61,7 @@ plus community itself. cli-template follows every rule here as a CLI does
|
|
|
56
61
|
- tg, max, memo, wa, b24 and cli-template: `pnpm typecheck && pnpm build && pnpm lint:commands`;
|
|
57
62
|
- drive: `pnpm typecheck && pnpm lint:commands`, which builds first;
|
|
58
63
|
- zoom, cli-base and cli-testing: `pnpm typecheck`;
|
|
59
|
-
- cli-core: `
|
|
64
|
+
- cli-core: none since 2026-11-26, its `ci / check` types every pull request (WC-CI-3 exception);
|
|
60
65
|
- cli-docs: its unit tests, without the one that needs generated pages;
|
|
61
66
|
- community: its script tests.
|
|
62
67
|
- **Exceptions:** never put live-account suites, agent suites or platform jobs here. Full tests and coverage run in
|
|
@@ -125,8 +130,9 @@ plus community itself. cli-template follows every rule here as a CLI does
|
|
|
125
130
|
gitleaks scan of the whole history. The shared workflow owns the CLI steps: the repository's `ci.yml` names a step
|
|
126
131
|
it cannot run yet in `skip`, with the reason beside it, and puts only its extra checks in `checks` (tg and max:
|
|
127
132
|
`pnpm check:agent-docs`).
|
|
128
|
-
- **Exceptions:**
|
|
129
|
-
request
|
|
133
|
+
- **Exceptions:** the whole-history secret scan is off (node-ci's `secrets` input) in a repository whose pull
|
|
134
|
+
request security checks run it, as in cli-core. Platform suites (Windows, macOS, install checks) are skipped here
|
|
135
|
+
and run at release, monthly or on request. Nothing in this run publishes or tags. cli-docs runs its full validation before each deployment and monthly
|
|
130
136
|
instead; community has no build to validate.
|
|
131
137
|
- **Applies to:** the CLIs, cli-base, cli-core and cli-testing. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
132
138
|
|
|
@@ -527,6 +527,37 @@ one operation, stay directly under `api`.
|
|
|
527
527
|
- **Applies to:** every CLI with a generated `api` group, from its next regeneration. **Since:** the release after
|
|
528
528
|
cli-base 0.120.0, with the cli-core release that mounts groups. **Rulings:** NEED-2754, NEED-2759.
|
|
529
529
|
|
|
530
|
+
### WC-CMD-34 · Mount cli-core's shared command at a reserved path, never one of your own
|
|
531
|
+
|
|
532
|
+
These root paths belong to cli-core: `session start`, `session status`, `session end`, `session list`, `doctor`,
|
|
533
|
+
`mcp`, `account remove`, `mirrors` and `complete`. A CLI that has one of them mounts it from cli-core. It changes the
|
|
534
|
+
command only through `overrideSharedContract` or `customizeSharedCommand`, which keep cli-core's mark on it. It may add
|
|
535
|
+
a subcommand of its own to a shared group. A CLI does not need every path.
|
|
536
|
+
|
|
537
|
+
- **Why:** a hand-built `session` or `doctor` looks the same in help, but it misses every later fix in cli-core. The
|
|
538
|
+
audits of 25.11.2026 found an own `session` in zoom, drive, gcal, ydisk, notion and the CRM CLIs, an own `mirrors`
|
|
539
|
+
in ydisk, an own `doctor` in memo and an own MCP server in memo. `assertSharedContracts` checks only the commands
|
|
540
|
+
cli-core marked, so none of these failed a check.
|
|
541
|
+
- **Enforced by:** `reserved-shared-command`.
|
|
542
|
+
- **How it is checked:** the lint and the family audit read the CLI's command tree as JSON, where cli-core marks
|
|
543
|
+
each shared command with the origin `cli-core`. The rule reports each reserved path whose command has no such mark,
|
|
544
|
+
once per path (`session` once for its four leaves). For now it is a warning: the lint and the audit print it and
|
|
545
|
+
pass. It becomes an error in the cli-base release after cli-core marks the helpers in the known gap below, planned
|
|
546
|
+
for 2027-01-15.
|
|
547
|
+
- **Example:** `tokenSessionCommand({ app, service, resolveSettings, verify })` for a sign-in with one token,
|
|
548
|
+
`oauthSessionCommand` for a browser sign-in, `messengerSessionCommands` in tg, max and wa. `appDoctorCommand`,
|
|
549
|
+
`appMcpCommand`, `appCompleteCommand`, `accountRemoveCommand` and `fileMirrorsCommand` for the other paths. max
|
|
550
|
+
replaces `doctor` and `session` through `customizeSharedCommand`, so they keep the mark and need no exception.
|
|
551
|
+
- **Exceptions:** an entry in the CLI's `lint/overrides.json`, such as
|
|
552
|
+
`{ "rule": "reserved-shared-command", "target": "session", "reason": "…", "owner": "@…", "review_after": "2027-03-01" }`.
|
|
553
|
+
An entry without a reason or a date does not apply, and an entry more than 14 days past its date fails. An entry
|
|
554
|
+
in `lint/baseline/` is refused, because it has neither. The first expected one is mail's `session`: one profile
|
|
555
|
+
signs in by app password or by Google or Microsoft OAuth, and no shared session command covers that.
|
|
556
|
+
Known gap, as of 2026-11-25: cli-core 1.0.0 does not mark `tokenSessionCommand`, `oauthSessionCommand`,
|
|
557
|
+
`fileMirrorsCommand` and the standalone `accountRemoveCommand`. A CLI that mounts one of them is still reported,
|
|
558
|
+
so the rule stays a warning until cli-core marks them.
|
|
559
|
+
- **Applies to:** all CLIs. **Since:** cli-base 1.1.0, as a warning. **Rulings:** none.
|
|
560
|
+
|
|
530
561
|
## Sources
|
|
531
562
|
|
|
532
563
|
These documents explain the rules on this page in more detail. Where one of them disagrees with this page, this page
|
|
@@ -178,9 +178,9 @@ source whose subtypes the definitions cannot tell apart.
|
|
|
178
178
|
`apiSkillFiles({ cli, folder, files, service, skill, operations, commands, banner })` writes the API part of the
|
|
179
179
|
CLI's skill, in the shape of [openapi-to-skills](https://github.com/neutree-ai/openapi-to-skills): `references/api.md`,
|
|
180
180
|
a short index of the groups with their effects, and `references/api/api-<group>.md`, one file per group. An
|
|
181
|
-
operation's group is its `group` (WC-CMD-33), else its first tag
|
|
182
|
-
cannot name a file and stops the
|
|
183
|
-
the index, then only the group it needs, with `<cli> skill show api-<group>`. The `skill` command already ships and
|
|
181
|
+
operation's group is its `group` (WC-CMD-33), else its first tag (for GraphQL, the entity its field acts on); one
|
|
182
|
+
without either is in `api-untagged.md`. A tag with no Latin letter or digit cannot name a file and stops the
|
|
183
|
+
generation. An agent reads the index, then only the group it needs, with `<cli> skill show api-<group>`. The `skill` command already ships and
|
|
184
184
|
shows every file beside `SKILL.md`; nothing else is needed.
|
|
185
185
|
|
|
186
186
|
- `commands` is `describeProgram(createProgram())` from the built program, made with the CLI's own copy of cli-base.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.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",
|