@wirecat/cli-base 0.85.1 → 0.87.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 +40 -0
- package/dist/dev/conformance.d.ts +5 -0
- package/dist/dev/conformance.js +15 -1
- package/dist/dev/network.js +30 -8
- package/dist/dev/wcat-lint.d.ts +5 -0
- package/dist/dev/wcat-lint.js +1 -1
- package/dist/http/fetch.js +29 -5
- package/dist/standards/flags-crm.js +7 -0
- package/dist/standards/flags-what.js +7 -0
- package/dist/standards/vocabulary.js +2 -0
- package/docs/standards/README.md +1 -1
- package/docs/standards/accounts.md +55 -7
- package/docs/standards/commands.md +10 -3
- package/docs/standards/new-cli.md +7 -4
- package/docs/standards/releases.md +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,46 @@ 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.87.0 — 08.11.2026
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`cli-dev release-pr` fails a CLI's first release when it installs no `wcat-<name>` command.** A pull request that
|
|
16
|
+
raises `package.json`'s version from `0.0.0`, the version `cli-template new` writes, needs a `"bin"` key starting
|
|
17
|
+
with `wcat-`; the short name may stay beside it. A CLI that added `wcat-<name>` only in a later release left
|
|
18
|
+
`wcat <name>` unable to find it until then. An override in `lint/overrides.json` does not excuse it: it still covers
|
|
19
|
+
only the `wcat-bin-name` warning about a short name. A CLI already published is not affected.
|
|
20
|
+
|
|
21
|
+
## 0.86.0 — 08.11.2026
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **The vocabulary has the noun `groups` and the option `--position`.** `groups` is memo's account groups
|
|
26
|
+
(`memo groups list|add|remove|move`, WC-ACCT-13); `--position <title>` is a person's job title on a relationship,
|
|
27
|
+
stored as `position` and never the role. memo can drop the lint baseline entries it kept for them.
|
|
28
|
+
- **The vocabulary has the resource `roles` and the option `--label`.** `roles` is the parts a person plays in a
|
|
29
|
+
relationship (`memo relationships roles list|add|remove`); `--label <label>` is a human-readable label for an id,
|
|
30
|
+
such as a custom relationship role's name. memo can drop its `unknown-resource` and `option-role` baseline entries
|
|
31
|
+
for them.
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **`hostFetch` lets go of a finished request's memory at once.** Its timeout used `AbortSignal.timeout`, whose timer,
|
|
36
|
+
and everything the request's async context held, stayed alive until the deadline (30 s by default) after the answer
|
|
37
|
+
was read. tg-cli's Bot API tests, routed through it, peaked at 3.0 to 3.4 GB instead of 0.8 to 1.1 GB, which is
|
|
38
|
+
how they once ran out of heap on macOS. The timer is now cleared when the request fails or its body has been read
|
|
39
|
+
to the end. The timeout still bounds the whole exchange, body included. The response it hands back is a copy with
|
|
40
|
+
the same status, headers, `url` and `redirected`.
|
|
41
|
+
- **`raw-network` no longer reports code that reaches no host.** It reported the word "fetch (" in a doc comment, a
|
|
42
|
+
`node:net` import of `isIP` alone and a `node:http` import of `createServer` alone (a loopback sign-in server).
|
|
43
|
+
cli-core had all three. Comment lines are skipped now, as `undeclared-host` already skipped them, and a named import
|
|
44
|
+
of only `createServer`, `STATUS_CODES` or `METHODS` (`http`, `https`) or `isIP`, `isIPv4` or `isIPv6` (`net`)
|
|
45
|
+
passes. An import that also names `request` or `createConnection` is still reported. It also read `this.#fetch(`, a
|
|
46
|
+
call of a class's own fetch, as the global one (tg-cli's Bot API transport). A CLI that baselined such a finding
|
|
47
|
+
removes the entry, which `cli-dev lint` now reports as stale.
|
|
48
|
+
- **`undeclared-host` no longer reports a name with no dot**, such as `host` in `http://host:port`, a placeholder in
|
|
49
|
+
tg-cli's proxy help, or `localhost`. Neither is an internet host a manifest could list.
|
|
50
|
+
|
|
11
51
|
## 0.85.1 — 08.11.2026
|
|
12
52
|
|
|
13
53
|
### Fixed
|
|
@@ -12,6 +12,11 @@ export declare const LIVE_FILE = "docs/dev/live-checks.txt";
|
|
|
12
12
|
export declare const conformanceSection: (body: string) => string | undefined;
|
|
13
13
|
/** A pull request that changes the version is a release pull request, and carries what was checked before it. */
|
|
14
14
|
export declare const releasePrProblems: (body: string, baseVersion: string, version: string) => string[];
|
|
15
|
+
/** `new` writes 0.0.0, so a pull request raising it is the first release; no override in lint/ reaches this check. */
|
|
16
|
+
export declare const firstReleaseProblems: (baseVersion: string, pkg: {
|
|
17
|
+
name?: unknown;
|
|
18
|
+
bin?: unknown;
|
|
19
|
+
}) => string[];
|
|
15
20
|
export interface LiveRecord {
|
|
16
21
|
version: string;
|
|
17
22
|
commit: string;
|
package/dist/dev/conformance.js
CHANGED
|
@@ -5,7 +5,9 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
import { packageVersion } from "../release/index.js";
|
|
7
7
|
import { defineParityGroups, PARITY_GROUPS } from "../standards/audit.js";
|
|
8
|
+
import { PROGRAM_PREFIX } from "../wcat/names.js";
|
|
8
9
|
import { processShell } from "./land.js";
|
|
10
|
+
import { binNames } from "./wcat-lint.js";
|
|
9
11
|
/** The paths whose change since a live check means the release was not the code that was checked. */
|
|
10
12
|
export const LIVE_PATHS = ["src", "package.json", "pnpm-lock.yaml"];
|
|
11
13
|
export const LIVE_FILE = "docs/dev/live-checks.txt";
|
|
@@ -31,6 +33,13 @@ export const releasePrProblems = (body, baseVersion, version) => {
|
|
|
31
33
|
return [`the "## Conformance" section of this ${version} release pull request is empty`];
|
|
32
34
|
return [];
|
|
33
35
|
};
|
|
36
|
+
/** `new` writes 0.0.0, so a pull request raising it is the first release; no override in lint/ reaches this check. */
|
|
37
|
+
export const firstReleaseProblems = (baseVersion, pkg) => baseVersion === "0.0.0" && !binNames(pkg).some((command) => command.startsWith(PROGRAM_PREFIX))
|
|
38
|
+
? [
|
|
39
|
+
`the first release installs no ${PROGRAM_PREFIX}<name> command: add "${PROGRAM_PREFIX}<name>" to package.json ` +
|
|
40
|
+
'"bin", beside the short name if it keeps one, and call wcatStart first in the bin (WC-CMD-29)',
|
|
41
|
+
]
|
|
42
|
+
: [];
|
|
34
43
|
/** A squash merge drops the checked commit from main, so a record names the checked files, not only the commit. */
|
|
35
44
|
export const liveTree = (shell) => {
|
|
36
45
|
const listing = shell.run("git", ["ls-tree", "HEAD", "--", ...LIVE_PATHS]);
|
|
@@ -125,7 +134,12 @@ const releasePr = (args, io, shell) => {
|
|
|
125
134
|
return 2;
|
|
126
135
|
}
|
|
127
136
|
const baseVersion = String(JSON.parse(base.out).version);
|
|
128
|
-
const
|
|
137
|
+
const version = packageVersion(io.cwd);
|
|
138
|
+
const pkg = JSON.parse(readFileSync(join(io.cwd, "package.json"), "utf8"));
|
|
139
|
+
const problems = [
|
|
140
|
+
...releasePrProblems(readFileSync(resolve(io.cwd, values.body), "utf8"), baseVersion, version),
|
|
141
|
+
...(baseVersion === version ? [] : firstReleaseProblems(baseVersion, pkg)),
|
|
142
|
+
];
|
|
129
143
|
for (const problem of problems)
|
|
130
144
|
io.err(problem);
|
|
131
145
|
if (problems.length === 0)
|
package/dist/dev/network.js
CHANGED
|
@@ -29,17 +29,39 @@ export const readSources = (cwd, dir = "src") => {
|
|
|
29
29
|
});
|
|
30
30
|
return walk(root).sort((a, b) => (a.path < b.path ? -1 : 1));
|
|
31
31
|
};
|
|
32
|
-
const
|
|
32
|
+
const COMMENT_LINE = /^\s*(?:\/\/|\/\*|\*)/;
|
|
33
|
+
const MODULE_REF = /\b(?:import\s+(type\s+)?(?:([\w$*{}\s,]+?)\s+from\s*)?|export\s+(type\s+)?[\w$*{}\s,]*?\s*from\s*|import\s*\(\s*|require\s*\(\s*)["']([^"']+)["']/g;
|
|
34
|
+
// A server only listens and `isIP` only parses: neither reaches a host, so hostFetch has nothing to replace.
|
|
35
|
+
const OPENS_NOTHING = {
|
|
36
|
+
http: new Set(["createServer", "STATUS_CODES", "METHODS"]),
|
|
37
|
+
https: new Set(["createServer"]),
|
|
38
|
+
net: new Set(["isIP", "isIPv4", "isIPv6"]),
|
|
39
|
+
};
|
|
40
|
+
const opensNothing = (module, clause) => {
|
|
41
|
+
const allowed = OPENS_NOTHING[module.replace(/^node:/, "")];
|
|
42
|
+
const named = clause?.trim().match(/^\{([^}]*)\}$/)?.[1];
|
|
43
|
+
if (!allowed || named === undefined)
|
|
44
|
+
return false;
|
|
45
|
+
return named
|
|
46
|
+
.split(",")
|
|
47
|
+
.map((binding) => binding.trim())
|
|
48
|
+
.filter((binding) => binding !== "" && !binding.startsWith("type "))
|
|
49
|
+
.every((binding) => allowed.has(binding.split(/\s+as\s+/)[0]));
|
|
50
|
+
};
|
|
33
51
|
// A file that binds its own `fetch` (an injected FetchLike, `const fetch = hostFetch(…)`) calls that one.
|
|
34
52
|
const BINDS_FETCH = /\b(?:const|let|var|function)\s+fetch\b|[{,(]\s*fetch\s*[,}):=]/;
|
|
35
|
-
const GLOBAL_FETCH_CALL = /(?<![\w
|
|
53
|
+
const GLOBAL_FETCH_CALL = /(?<![\w$.#])fetch\s*\(/;
|
|
36
54
|
const GLOBAL_FETCH = /(?<!\btypeof\s+)\b(?:globalThis|window|self)\s*\.\s*fetch\b/;
|
|
37
55
|
export const rawNetwork = ({ sources }) => sources.flatMap(({ path, text }) => {
|
|
38
|
-
const
|
|
39
|
-
.
|
|
40
|
-
.
|
|
56
|
+
const code = text
|
|
57
|
+
.split("\n")
|
|
58
|
+
.filter((line) => !COMMENT_LINE.test(line))
|
|
59
|
+
.join("\n");
|
|
60
|
+
const modules = [...code.matchAll(MODULE_REF)]
|
|
61
|
+
.filter(([, type, clause, exportType, module]) => !type && !exportType && module && NETWORK_MODULES.test(module) && !opensNothing(module, clause))
|
|
62
|
+
.map(([, , , , module]) => module);
|
|
41
63
|
const fetches = [
|
|
42
|
-
...(GLOBAL_FETCH.test(
|
|
64
|
+
...(GLOBAL_FETCH.test(code) || (GLOBAL_FETCH_CALL.test(code) && !BINDS_FETCH.test(code)) ? ["fetch"] : []),
|
|
43
65
|
];
|
|
44
66
|
return [...new Set([...modules, ...fetches])].map((what) => ({
|
|
45
67
|
target: `${path} ${what}`,
|
|
@@ -49,7 +71,6 @@ export const rawNetwork = ({ sources }) => sources.flatMap(({ path, text }) => {
|
|
|
49
71
|
}));
|
|
50
72
|
});
|
|
51
73
|
const URL_HOST = /\bhttps?:\/\/([a-z0-9.-]+)/gi;
|
|
52
|
-
const COMMENT_LINE = /^\s*(?:\/\/|\/\*|\*)/;
|
|
53
74
|
/** Names, not addresses: placeholders and schema or namespace identifiers nobody fetches. */
|
|
54
75
|
const NOT_CONTACTED = /(?:^|\.)(?:example(?:\.com|\.org|\.net)?|test|invalid)$|^(?:json-schema\.org|www\.w3\.org)$/;
|
|
55
76
|
/** One finding per host, so a host named in many files takes one override. */
|
|
@@ -62,7 +83,8 @@ export const undeclaredHosts = ({ sources, hosts, docsHost, }) => {
|
|
|
62
83
|
if (!COMMENT_LINE.test(line))
|
|
63
84
|
for (const [, found] of line.matchAll(URL_HOST)) {
|
|
64
85
|
const host = found.toLowerCase().replace(/\.$/, "");
|
|
65
|
-
|
|
86
|
+
// A name with no dot (`socks5://host:port`) is a placeholder or this machine, not an internet host.
|
|
87
|
+
if (!host.includes(".") || host === docsHost || NOT_CONTACTED.test(host) || hostCovered(host, hosts))
|
|
66
88
|
continue;
|
|
67
89
|
const seen = files.get(host) ?? [];
|
|
68
90
|
if (!seen.includes(path))
|
package/dist/dev/wcat-lint.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export interface WcatWarning {
|
|
|
5
5
|
target: string;
|
|
6
6
|
message: string;
|
|
7
7
|
}
|
|
8
|
+
/** The commands a `package.json` installs: its `"bin"` keys, or the package's own name for a `"bin"` string. */
|
|
9
|
+
export declare const binNames: (pkg: {
|
|
10
|
+
name?: unknown;
|
|
11
|
+
bin?: unknown;
|
|
12
|
+
}) => string[];
|
|
8
13
|
/** Each command is `wcat-<name>`, and a package outside `@wirecat/` takes no reserved name. */
|
|
9
14
|
export declare const binNameWarnings: (pkg: {
|
|
10
15
|
name?: unknown;
|
package/dist/dev/wcat-lint.js
CHANGED
|
@@ -8,7 +8,7 @@ import { DESCRIBE_FLAG, PROGRAM_PREFIX, RESERVED_NAMES, TOOL_NAME } from "../wca
|
|
|
8
8
|
export const WCAT_RULES = ["wcat-bin-name", "wcat-describe"];
|
|
9
9
|
const WIRECAT_SCOPE = "@wirecat/";
|
|
10
10
|
/** The commands a `package.json` installs: its `"bin"` keys, or the package's own name for a `"bin"` string. */
|
|
11
|
-
const binNames = (pkg) => {
|
|
11
|
+
export const binNames = (pkg) => {
|
|
12
12
|
if (typeof pkg.bin === "string")
|
|
13
13
|
return typeof pkg.name === "string" ? [pkg.name.replace(/^@[^/]+\//, "")] : [];
|
|
14
14
|
return typeof pkg.bin === "object" && pkg.bin !== null ? Object.keys(pkg.bin) : [];
|
package/dist/http/fetch.js
CHANGED
|
@@ -4,6 +4,29 @@ export const HOST_FETCH_TIMEOUT_MS = 30_000;
|
|
|
4
4
|
const REDIRECTS = 5;
|
|
5
5
|
const REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
|
|
6
6
|
const CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
|
|
7
|
+
const NO_BODY = new Set([204, 205, 304]);
|
|
8
|
+
// Not AbortSignal.timeout: its timer, and the async context it holds, lives to the deadline after the exchange ended.
|
|
9
|
+
// tg-cli's Bot API tests peaked at 3 GB with it and 0.8 GB with this timer, cleared once the body is read.
|
|
10
|
+
const deadline = (ms) => {
|
|
11
|
+
const controller = new AbortController();
|
|
12
|
+
const timer = setTimeout(() => controller.abort(new DOMException(`no answer within ${ms} ms`, "TimeoutError")), ms);
|
|
13
|
+
timer.unref?.();
|
|
14
|
+
return { signal: controller.signal, clear: () => clearTimeout(timer) };
|
|
15
|
+
};
|
|
16
|
+
/** The response with its body read through a stream that clears the timer at its end. */
|
|
17
|
+
const released = (response, clear) => {
|
|
18
|
+
if (!response.body || NO_BODY.has(response.status) || response.status < 200 || response.status > 599) {
|
|
19
|
+
clear();
|
|
20
|
+
return response;
|
|
21
|
+
}
|
|
22
|
+
const { status, statusText, headers, url, redirected } = response;
|
|
23
|
+
const wrapped = new Response(response.body.pipeThrough(new TransformStream({ flush: clear })), {
|
|
24
|
+
status,
|
|
25
|
+
statusText,
|
|
26
|
+
headers,
|
|
27
|
+
});
|
|
28
|
+
return Object.defineProperties(wrapped, { url: { value: url }, redirected: { value: redirected } });
|
|
29
|
+
};
|
|
7
30
|
const undeclared = (url) => new CliError("configuration_error", `${url.hostname} is not a host this CLI declares: add "${url.hostname}" to \`hosts\` in its WCAT identity and run cli-dev manifest`, { reason: "network.host-undeclared", sent: false });
|
|
8
31
|
const checked = (url, hosts) => {
|
|
9
32
|
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
@@ -24,8 +47,8 @@ export const hostFetch = (options) => {
|
|
|
24
47
|
const request = input instanceof Request ? input : undefined;
|
|
25
48
|
let url = checked(new URL(request?.url ?? String(input)), hosts);
|
|
26
49
|
const caller = init.signal ?? request?.signal;
|
|
27
|
-
const timeout =
|
|
28
|
-
const signal = caller ? AbortSignal.any([caller, timeout]) : timeout;
|
|
50
|
+
const timeout = deadline(timeoutMs);
|
|
51
|
+
const signal = caller ? AbortSignal.any([caller, timeout.signal]) : timeout.signal;
|
|
29
52
|
const follow = (init.redirect ?? request?.redirect ?? "follow") === "follow";
|
|
30
53
|
let method = (init.method ?? request?.method ?? "GET").toUpperCase();
|
|
31
54
|
let body = init.body ?? request?.body ?? undefined;
|
|
@@ -35,7 +58,7 @@ export const hostFetch = (options) => {
|
|
|
35
58
|
for (let hop = 0; follow && REDIRECT_STATUSES.has(response.status); hop += 1) {
|
|
36
59
|
const location = response.headers.get("location");
|
|
37
60
|
if (!location)
|
|
38
|
-
return response;
|
|
61
|
+
return released(response, timeout.clear);
|
|
39
62
|
if (hop >= redirects)
|
|
40
63
|
throw new CliError("invalid_response", `more than ${redirects} redirects from ${url.hostname}`);
|
|
41
64
|
void response.body?.cancel().catch(() => { });
|
|
@@ -54,14 +77,15 @@ export const hostFetch = (options) => {
|
|
|
54
77
|
url = next;
|
|
55
78
|
response = await send(url, { ...init, method, headers, body, signal, redirect: "manual" });
|
|
56
79
|
}
|
|
57
|
-
return response;
|
|
80
|
+
return released(response, timeout.clear);
|
|
58
81
|
}
|
|
59
82
|
catch (error) {
|
|
83
|
+
timeout.clear();
|
|
60
84
|
if (isCliError(error))
|
|
61
85
|
throw error;
|
|
62
86
|
if (caller?.aborted)
|
|
63
87
|
throw isCliError(caller.reason) ? caller.reason : new CliError("cancelled", "request cancelled");
|
|
64
|
-
if (timeout.aborted)
|
|
88
|
+
if (timeout.signal.aborted)
|
|
65
89
|
throw new CliError("timeout", `${url.hostname} did not answer within ${timeoutMs} ms`, { retryable: true });
|
|
66
90
|
throw new CliError("network_error", `${url.hostname} could not be reached`, { retryable: true });
|
|
67
91
|
}
|
|
@@ -28,6 +28,13 @@ export const CRM_FLAGS = [
|
|
|
28
28
|
type: "time",
|
|
29
29
|
meaning: "the day a deal or lead is expected to close, YYYY-MM-DD",
|
|
30
30
|
},
|
|
31
|
+
{
|
|
32
|
+
name: "--position",
|
|
33
|
+
value: "<title>",
|
|
34
|
+
role: "value",
|
|
35
|
+
type: "string",
|
|
36
|
+
meaning: "a person's job title on a relationship, stored as position; never the role",
|
|
37
|
+
},
|
|
31
38
|
{
|
|
32
39
|
name: "--owner",
|
|
33
40
|
value: "<user>",
|
|
@@ -844,6 +844,13 @@ export const WHAT_FLAGS = [
|
|
|
844
844
|
},
|
|
845
845
|
{ name: "--remind-time", value: "<time>", role: "value", type: "time", meaning: "when to look at it again" },
|
|
846
846
|
{ name: "--role", value: "<role>", role: "value", type: "string", meaning: "the part it plays, in a word or two" },
|
|
847
|
+
{
|
|
848
|
+
name: "--label",
|
|
849
|
+
value: "<label>",
|
|
850
|
+
role: "value",
|
|
851
|
+
type: "string",
|
|
852
|
+
meaning: "a human-readable label for an id, such as the name shown for a custom relationship role",
|
|
853
|
+
},
|
|
847
854
|
{
|
|
848
855
|
name: "--scope",
|
|
849
856
|
value: "<scope>",
|
|
@@ -244,6 +244,7 @@ const collections = [
|
|
|
244
244
|
["topics", "forum topics in a group"],
|
|
245
245
|
["models", "local or remote models"],
|
|
246
246
|
["tags", "labels the owner puts on things"],
|
|
247
|
+
["groups", "account groups: the accounts a run in a group reads, such as work and personal (WC-ACCT-13)"],
|
|
247
248
|
["searches", "the owner's saved searches"],
|
|
248
249
|
["copies", "tables kept aside by a repair"],
|
|
249
250
|
["tables", "the tables of the local store, with their kind, row count and size"],
|
|
@@ -289,6 +290,7 @@ const collections = [
|
|
|
289
290
|
["facts", "what happened, with evidence"],
|
|
290
291
|
["memories", "what an agent concluded, with evidence and scope"],
|
|
291
292
|
["relationships", "confirmed or suggested links between people, organizations and projects"],
|
|
293
|
+
["roles", "the parts a person plays in a relationship, built in or the owner's own"],
|
|
292
294
|
["sheets", "remote spreadsheets and their cell ranges, read or changed through a provider"],
|
|
293
295
|
["files", "files in the source, such as Google Drive, read and changed there"],
|
|
294
296
|
["comments", "comments people left on a thing in the source: a channel post or a file"],
|
package/docs/standards/README.md
CHANGED
|
@@ -32,7 +32,7 @@ the four steps that need a person. A new CLI is ready for its first release when
|
|
|
32
32
|
| [Commands](commands.md) | `CMD` | 32 | Paths, vocabulary, flags, arguments, effects, lifetime, query, help, external references, joining `wcat`, settings in the config file, refs, network hosts |
|
|
33
33
|
| [Output](output.md) | `OUT` | 24 | Data on stdout only, envelopes, errors, exit codes, partial answers, projection |
|
|
34
34
|
| [MCP](mcp.md) | `MCP` | 13 | The MCP tools, how they come from commands, what each permission shows |
|
|
35
|
-
| [Accounts](accounts.md) | `ACCT` |
|
|
35
|
+
| [Accounts](accounts.md) | `ACCT` | 13 | The explicit profile, reads across accounts, scope flags, linked identities, sign-in commands, memo's account groups |
|
|
36
36
|
| [Permissions](permissions.md) | `PERM` | 23 | Levels, keys, defaults, hard limits, the write guard and its journal, handing the keys to cli-core |
|
|
37
37
|
| [Architecture](architecture.md) | `ARCH` | 19 | Layers, dependency direction, vendor types, what goes in which package, the command tree built once |
|
|
38
38
|
| [Lifecycle](lifecycle.md) | `LIFE` | 16 | Opening late, who closes, deadlines, long-running commands, the `serve` relay, resumable syncs and their request budget, the run log, provider requests inside the run |
|
|
@@ -16,10 +16,14 @@ Rule ids on this page are `WC-ACCT-<n>`. How to read a rule, how ids work and wh
|
|
|
16
16
|
cli-core resolves the profile for tg, max and wa. WC-ACCT-1 needs cli-core 0.319.0 or newer. memo has no messenger profile: its shared commands run without one, and they pick accounts with `--provider`
|
|
17
17
|
and `--account` (WC-ACCT-7). memo never creates profiles of its own: it reads the stores of other CLIs and selects
|
|
18
18
|
their accounts with `--source email:<name>` or `--account telegram:1`, so it has no `--profiles` either
|
|
19
|
-
([cli-base#390](https://github.com/WireCatLabs/cli-base/issues/390), owner decision 2026-10-31).
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
cli-
|
|
19
|
+
([cli-base#390](https://github.com/WireCatLabs/cli-base/issues/390), owner decision 2026-10-31). memo's first
|
|
20
|
+
word is an account group instead (WC-ACCT-13), read with cli-core's groups
|
|
21
|
+
([cli-core#2632](https://github.com/WireCatLabs/cli-core/pull/2632)) and memo's group word
|
|
22
|
+
([cli-memo#698](https://github.com/WireCatLabs/cli-memo/pull/698)). zoom resolves its own profile word by the same
|
|
23
|
+
rules (`zm <profile> …`, `ZM_PROFILE`, `ZM_PROFILE_LOCK`) from zoom-cli 0.35.0, with cli-core's `liftProfile` and
|
|
24
|
+
`usableProfileName`. drive still has its own profile code: it registers its own profiles. That is a known gap, not
|
|
25
|
+
an exception. gcal resolves the profile through cli-core's `run()`, like tg, max and wa. Which CLIs lack a sign-in
|
|
26
|
+
command of WC-ACCT-12 is listed in that rule.
|
|
23
27
|
|
|
24
28
|
## Rules
|
|
25
29
|
|
|
@@ -50,9 +54,11 @@ profile.
|
|
|
50
54
|
- **Example:** `max work bot messages send …` uses the same first word as `max work chats list`. `tg --json chats list`
|
|
51
55
|
still works, because `--json` is an option.
|
|
52
56
|
- **Exceptions:** `mcp serve --profiles <names|all>` names the profiles one server serves ([WC-MCP-9](mcp.md#wc-mcp-9--a-server-serves-the-profiles-it-is-told-with-one-connection-for-each)). It is used in
|
|
53
|
-
place of the first word, never with it. memo has no profiles of its own, so it has
|
|
54
|
-
|
|
55
|
-
-
|
|
57
|
+
place of the first word, never with it. memo has no profiles of its own, so it has no `--profiles`, and its first
|
|
58
|
+
word is an account group, not a profile: `memo work search all invoice`
|
|
59
|
+
([WC-ACCT-13](#wc-acct-13--memos-first-word-is-an-account-group-and-the-default-group-all-holds-every-account)).
|
|
60
|
+
It selects the accounts of other CLIs with `--source` and `--account`.
|
|
61
|
+
- **Applies to:** all CLIs. **Since:** cli-base 0.41.0. **Rulings:** NEED-84, NEED-294, NEED-1881, NEED-2378.
|
|
56
62
|
|
|
57
63
|
### WC-ACCT-3 · A missing profile is an error that lists the choices
|
|
58
64
|
|
|
@@ -190,6 +196,48 @@ Every CLI that signs in has four commands under `session`:
|
|
|
190
196
|
([WC-CMD-8](commands.md#wc-cmd-8--keep-no-aliases-a-renamed-path-stops-working-in-the-release-that-renames-it)).
|
|
191
197
|
- **Applies to:** every CLI that signs in. **Since:** cli-base 0.65.0. **Rulings:** NEED-1884.
|
|
192
198
|
|
|
199
|
+
### WC-ACCT-13 · memo's first word is an account group, and the default group `all` holds every account
|
|
200
|
+
|
|
201
|
+
A group is a list of accounts that the owner saves, store-wide, as `account_groups.<name>`; every reader takes it as
|
|
202
|
+
`--source group:<name>`. The default reads everything; groups and the lock are opt-in narrowing for agents.
|
|
203
|
+
|
|
204
|
+
- `all` is the default group. It always holds every account and is never saved or edited. No group word means `all`,
|
|
205
|
+
as before, and `memo all …`, `MEMO_GROUP=all` and `MEMO_GROUP_LOCK=all` restrict nothing.
|
|
206
|
+
- Any other group holds exactly the accounts it lists, `personal` like any other, and a group never saved does not
|
|
207
|
+
exist. A member is saved as `provider:account`, so renaming a profile changes nothing.
|
|
208
|
+
- One account may be in several groups. This is allowed and shown, not refused: a groups list gives each member its
|
|
209
|
+
profile names in every CLI and `also_in` (its other groups), and the answer has a `duplicates` summary.
|
|
210
|
+
- A profile named like a group never puts its account in the group. A groups list only suggests it
|
|
211
|
+
(`suggested`, "profile named work"), and only when another CLI's profile or a saved group uses the same name.
|
|
212
|
+
- A group name is letters, digits, `-` and `_`, and starts with a letter or a digit. It is not `all`, not `bots` and
|
|
213
|
+
not a memo command word.
|
|
214
|
+
|
|
215
|
+
`memo <group> …` reads only that group: a read without `--source` reads `group:<group>`, an explicit `--source`
|
|
216
|
+
narrows inside it, and an account outside it is `validation_error`, as is a write's `--account` outside it.
|
|
217
|
+
`MEMO_GROUP=<group>` does the same as the first word. `MEMO_GROUP_LOCK=<group>` pins the process as WC-ACCT-5 pins a
|
|
218
|
+
profile: another group, `all`, or an account outside the group is `permission_error`. Under the lock every source
|
|
219
|
+
list holds only the group's accounts, so a read that names no group stays inside it. The lock fails closed: a command
|
|
220
|
+
runs only when it is marked as keeping to a group (`groupAware`), and a reference in its arguments or options to
|
|
221
|
+
account data outside the group is refused: a message, a chat, mail, a calendar event, a CRM row, or a person seen only
|
|
222
|
+
by outside accounts. What the owner made, with no account (memo's notes, projects, tasks, invoices, memories,
|
|
223
|
+
facts), is visible in every group. Without the lock, a group is a convenience and not a boundary.
|
|
224
|
+
|
|
225
|
+
- **Why:** an agent can be held to the owner's work accounts across every CLI, without naming each account, while the
|
|
226
|
+
owner's own default still reads everything.
|
|
227
|
+
- **Enforced by:** `cli-core: src/search/groups.test.ts` · `cli-core: src/cli/group-lock.test.ts` ·
|
|
228
|
+
`cli-core: src/crm/sync.test.ts`.
|
|
229
|
+
- **Example:** with `account_groups.work` set to `telegram:102,bitrix24:acme.bitrix24.ru`, `memo work search all
|
|
230
|
+
invoice` reads those two accounts, and `memo search all invoice` reads every account. `memo work search all x
|
|
231
|
+
--source telegram:101` is refused because `telegram:101` is not in `work`. With nothing saved, `memo work …` is
|
|
232
|
+
refused with the groups listed (`all`), and the profiles named `work` are suggested. The first CRM sync of an
|
|
233
|
+
account no saved group lists answers `group_hint`, ``add it to a work group: `memo groups add work
|
|
234
|
+
<provider>:<account>` ``. Only the CRM sync answer carries it.
|
|
235
|
+
- **Exceptions:** the bare word `personal` in a `--source` list still means the messenger accounts that are not bots;
|
|
236
|
+
only `group:personal` is a saved group of that name. Besides memo's `groups` commands, tg and max save a group
|
|
237
|
+
(`config set account_groups.<name>`); they refuse `all` and `bots` but not a memo command word.
|
|
238
|
+
- **Applies to:** memo, and cli-core's source lists in every CLI. **Since:** cli-base 0.86.0. **Rulings:** NEED-2378,
|
|
239
|
+
NEED-2389.
|
|
240
|
+
|
|
193
241
|
## Sources
|
|
194
242
|
|
|
195
243
|
These documents explain the rules on this page in more detail. Where one of them disagrees with this page, this page
|
|
@@ -385,11 +385,14 @@ commands, their `summary`, `effects` and `entity`, the fields of each entity a q
|
|
|
385
385
|
file shipped, `--wcat-describe` answers format 2: the format-1 keys with `"wcat_describe": 2`, the file's `desktop`
|
|
386
386
|
and `manifest_sha256` of its bytes. Without it the answer stays format 1.
|
|
387
387
|
|
|
388
|
+
A new CLI joins from its first release: that release installs `wcat-<name>` (a `"bin"` key) and its bin calls
|
|
389
|
+
`wcatStart` first, so it answers `--wcat-describe`. The short name may stay beside it.
|
|
390
|
+
|
|
388
391
|
- **Why:** `wcat <name>` runs any `wcat-<name>` program on PATH, and `wcat --help` lists each one with what it says
|
|
389
392
|
about itself. A name WireCat reserves would be taken over by WireCat's own tool or by a `wcat` command. WireCat
|
|
390
393
|
Desktop adds a tool it has not checked from the manifest alone, read out of the npm tarball without running the
|
|
391
394
|
package, so a manifest typed by hand or left stale shows the owner words the CLI does not have.
|
|
392
|
-
- **Enforced by:** `src/dev/wcat-lint.ts` · `src/wcat/manifest.ts`.
|
|
395
|
+
- **Enforced by:** `src/dev/wcat-lint.ts` · `src/wcat/manifest.ts` · `src/dev/conformance.ts`.
|
|
393
396
|
- **Example:** the bin's first call is `wcatStart({ command: "gcal", version, description, docs })` from
|
|
394
397
|
`@wirecat/cli-base/wcat/start`. `wcat-gcal --wcat-describe` then prints
|
|
395
398
|
`{"wcat_describe":1,"name":"gcal","version":"1.2.0","description":"…","docs_url":"…"}`. `cli-dev lint` warns when a
|
|
@@ -397,13 +400,17 @@ and `manifest_sha256` of its bytes. Without it the answer stays format 1.
|
|
|
397
400
|
`@wirecat/cli-base/wcat` (`tg`, `max`, `wa`, `zm`, `drive`, `memo`, `mail`, `email`, `wcat` and the built-in commands
|
|
398
401
|
`help`, `version`, `shortcuts`, `doctor`, `update`, `upgrade`, `app`), and, with `--cli`, when the built CLI does not
|
|
399
402
|
answer `--wcat-describe`. `cli-dev manifest --program dist/program.js --identity dist/wcat.js --check` fails when
|
|
400
|
-
`contracts/wirecat.json` is stale.
|
|
403
|
+
`contracts/wirecat.json` is stale. `cli-dev release-pr` fails the pull request that raises the version from `0.0.0`,
|
|
404
|
+
the version `new` writes, when `package.json` has no `wcat-` `"bin"` key.
|
|
401
405
|
- **Exceptions:** a CLI keeps its short `"bin"` name beside `wcat-<name>` until callers have moved to the new name; the
|
|
402
406
|
warning stays until then. A CLI that keeps the short name for good says why in `lint/overrides.json` (`"rule":
|
|
403
407
|
"wcat-bin-name"`, the target as the warning prints it), which silences the warning and counts against the budget.
|
|
408
|
+
An override covers the short name only, never a CLI with no `wcat-<name>`: `cli-dev release-pr` does not read
|
|
409
|
+
`lint/overrides.json`.
|
|
404
410
|
A WireCat CLI listed in Desktop's own catalog needs no manifest until Desktop reads one for it.
|
|
405
411
|
- **Applies to:** all CLIs, and third-party CLIs that join `wcat`. **Since:** cli-base 0.66.0; the manifest since the
|
|
406
|
-
release after 0.80.9. **Rulings:** NEED-149,
|
|
412
|
+
release after 0.80.9; `wcat-<name>` from the first release since cli-base 0.87.0. **Rulings:** NEED-149,
|
|
413
|
+
NEED-153, NEED-154, NEED-2431.
|
|
407
414
|
|
|
408
415
|
## Settings
|
|
409
416
|
|
|
@@ -80,8 +80,10 @@ installing that command; nothing else is registered anywhere.
|
|
|
80
80
|
`wcat`'s built-in commands: `RESERVED_NAMES` in `@wirecat/cli-base/wcat` holds the list, and
|
|
81
81
|
[WC-CMD-29](commands.md#wc-cmd-29--answer---wcat-describe-and-take-no-name-wirecat-reserves) asks a CLI outside
|
|
82
82
|
WireCat not to take one.
|
|
83
|
-
- **The command.** `"bin": { "wcat-<name>": "dist/bin/<name>.js" }
|
|
84
|
-
|
|
83
|
+
- **The command, from the first release.** `"bin": { "wcat-<name>": "dist/bin/<name>.js" }`, in the first version
|
|
84
|
+
published, not added later. The short name may stay beside it. The template writes both `<name>` and
|
|
85
|
+
`wcat-<name>`. `cli-dev lint` warns about a `"bin"` key without the `wcat-` prefix, and `cli-dev release-pr` fails
|
|
86
|
+
the pull request that raises the version from `0.0.0` when no key has it.
|
|
85
87
|
- **The description `wcat --help` shows.** The bin calls `wcatStart` first, before the program loads; the template's
|
|
86
88
|
bin does:
|
|
87
89
|
|
|
@@ -127,8 +129,8 @@ installing that command; nothing else is registered anywhere.
|
|
|
127
129
|
is `<scope>-<name>` of the package or starts with `<scope>-<name>-`, with `.` and `_` read as `-`: `@acme/crm-cli`
|
|
128
130
|
keeps its data in `acme-crm-cli`. Only the scope's owner publishes under it, so the folder Desktop may delete is
|
|
129
131
|
theirs. `new` names it so for a package outside `@wirecat`.
|
|
130
|
-
- **The short name.**
|
|
131
|
-
|
|
132
|
+
- **The short name.** A CLI may install it beside `wcat-<name>`, as the template does. Without it,
|
|
133
|
+
`wcat shortcuts add <name>` makes `<name>` a shortcut to `wcat-<name>`, only when no program on PATH has that name.
|
|
132
134
|
|
|
133
135
|
## Four steps that need a person
|
|
134
136
|
|
|
@@ -184,6 +186,7 @@ All of these pass on `main`, before the first release:
|
|
|
184
186
|
- `pnpm docs:check`, with `--pages`, and the CLI's `generate:check`
|
|
185
187
|
- the changelog guard on a pull request
|
|
186
188
|
- `pnpm release:check`
|
|
189
|
+
- `wcat-<name> --wcat-describe` answers, from the built bin
|
|
187
190
|
- a live check of the real service before each release
|
|
188
191
|
([WC-TEST-18](testing.md#wc-test-18--check-the-real-service-by-hand-never-in-the-test-suite)), recorded in the
|
|
189
192
|
repository: the version, the date, the script and pass or fail. The owner runs it, or says yes to an agent's run.
|
|
@@ -214,7 +214,9 @@ exception is `contracts/wirecat.json`, the manifest WireCat Desktop reads before
|
|
|
214
214
|
|
|
215
215
|
A pull request that changes `package.json`'s version has a `## Conformance` section that is not empty: the
|
|
216
216
|
`release:check` result, the live check's record line, the fresh audit's report or a link to it, and the slice
|
|
217
|
-
reviews ([New CLI](new-cli.md#done-when)). `cli-dev release-pr --base <commit> --body <file>` fails without one
|
|
217
|
+
reviews ([New CLI](new-cli.md#done-when)). `cli-dev release-pr --base <commit> --body <file>` fails without one,
|
|
218
|
+
and fails a first release (the base version is `0.0.0`) whose `package.json` installs no `wcat-<name>` command
|
|
219
|
+
([WC-CMD-29](commands.md#wc-cmd-29--answer---wcat-describe-and-take-no-name-wirecat-reserves)).
|
|
218
220
|
After the live check of the real service passes
|
|
219
221
|
([WC-TEST-18](testing.md#wc-test-18--check-the-real-service-by-hand-never-in-the-test-suite)),
|
|
220
222
|
`cli-dev live record --script <its script>` appends `<version> <commit> <date> <script> <tree>` to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.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",
|