@wirecat/cli-base 0.122.0 → 0.124.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 +28 -0
- package/dist/codegen/index.d.ts +1 -1
- package/dist/codegen/index.js +1 -1
- package/dist/codegen/manifest.d.ts +2 -0
- package/dist/codegen/manifest.js +1 -0
- package/dist/codegen/model.d.ts +2 -0
- package/dist/codegen/names.d.ts +5 -0
- package/dist/codegen/names.js +7 -0
- package/dist/codegen/pipeline.d.ts +7 -0
- package/dist/codegen/pipeline.js +47 -2
- package/dist/codegen/skill.d.ts +1 -1
- package/dist/codegen/skill.js +2 -1
- package/dist/codegen/wp-json.js +4 -0
- package/dist/dev/ready.js +4 -0
- package/dist/standards/audit.js +2 -0
- package/dist/standards/flags-content.d.ts +3 -0
- package/dist/standards/flags-content.js +17 -0
- package/dist/standards/vocabulary.js +5 -0
- package/docs/standards/README.md +1 -1
- package/docs/standards/ci.md +1 -0
- package/docs/standards/commands.md +32 -1
- package/docs/standards/kit-surface.md +5 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,34 @@ 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.124.0 — 19.11.2026
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`cli-dev ready` knows the content category.** A CLI whose `docs/dev/DESIGN.md` names `content` (or `new`'s label,
|
|
16
|
+
"blog or site content (posts, pages, tags)") is asked for cli-core's `contentSourceContract`, `contentSyncContract`
|
|
17
|
+
and `contentWriteContract`. Before, its contracts row said the category was unknown.
|
|
18
|
+
- **wordpress-cli joins the `shared-roots` parity group**, and its monthly run holds 03:17 UTC in WC-CI-9's table.
|
|
19
|
+
|
|
20
|
+
## 0.123.0 — 19.11.2026
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **The generator puts operations in subgroups of `api`: `names.groups`.** With `"tags"` each operation gets its first
|
|
25
|
+
tag as its `group` in the manifest (a Postman folder is one), with `"first-word"` the first word of its command, for
|
|
26
|
+
a spec whose tags name no resource. `names.groupNames` renames a group or keeps it flat. cli-core then mounts
|
|
27
|
+
`contacts-list` in the group `contacts` as `api contacts list`, with the key `api.contacts.list`. Generation stops
|
|
28
|
+
on a group named `list`, `show` or `help`, a group named like a command, or two operations on one path. Without
|
|
29
|
+
`names.groups` the manifest is as before. `apiCommandPath` gives an operation's words after `api`. WordPress
|
|
30
|
+
routes get their resource as a tag (`posts`), so a wp-json CLI can group too. The rule is
|
|
31
|
+
[WC-CMD-33](docs/standards/commands.md#wc-cmd-33--group-a-generated-api-by-resource-api-group-command).
|
|
32
|
+
|
|
33
|
+
- **The words of a content CLI (posts on a site or blog).** `posts` and `channels` are resources, `stats` is a view
|
|
34
|
+
as well as the root command (`posts stats <post>`), and `--slug <slug>`, `--tags <ids>` and `--replace-body` have
|
|
35
|
+
their roles. cli-core's content commands use them, and reuse the words the vocabulary had: `--text-file`,
|
|
36
|
+
`--description`, `--at-time`, `--allow-delete`, `tags` and `users`. Before this, `cli-dev lint` refused a CLI made
|
|
37
|
+
from cli-core's content commands.
|
|
38
|
+
|
|
11
39
|
## 0.122.0 — 19.11.2026
|
|
12
40
|
|
|
13
41
|
### Added
|
package/dist/codegen/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { requestSchema } from "./json-schema.js";
|
|
|
16
16
|
export { type CoverageOptions, coverageGenerator, definitionsGenerator, examplesGenerator, type ManifestOperation, manifestGenerator, } from "./manifest.js";
|
|
17
17
|
export { type MergedSource, type MergeOptions, type MergeReport, mergeOpenApi, type SpecSource } from "./merge.js";
|
|
18
18
|
export type { ApiBody, ApiModel, ApiOperation, ApiParameter, ApiSchema, ApiServer, Binding, CodeGenerator, Confidence, Discriminator, Effect, GeneratedArtifact, GraphqlBinding, HttpBinding, HttpMethod, OAuthFlow, OperationPermission, Override, PageParameter, Pagination, RpcBinding, SchemaNode, SecurityRequirement, SecurityScheme, SourceInfo, SourceReference, } from "./model.js";
|
|
19
|
-
export { bindingLabel, identifier, kebab } from "./names.js";
|
|
19
|
+
export { apiCommandPath, bindingLabel, identifier, kebab } from "./names.js";
|
|
20
20
|
export { adaptOpenApi, OpenApiError } from "./openapi.js";
|
|
21
21
|
export { detectPagination } from "./pagination.js";
|
|
22
22
|
export { type PatchedSpec, type PatchSpecOptions, patchSpec, type SpecPatch } from "./patch.js";
|
package/dist/codegen/index.js
CHANGED
|
@@ -15,7 +15,7 @@ export { graphqlFake, selectionProblems, } from "./graphql-fake.js";
|
|
|
15
15
|
export { requestSchema } from "./json-schema.js";
|
|
16
16
|
export { coverageGenerator, definitionsGenerator, examplesGenerator, manifestGenerator, } from "./manifest.js";
|
|
17
17
|
export { mergeOpenApi } from "./merge.js";
|
|
18
|
-
export { bindingLabel, identifier, kebab } from "./names.js";
|
|
18
|
+
export { apiCommandPath, bindingLabel, identifier, kebab } from "./names.js";
|
|
19
19
|
export { adaptOpenApi, OpenApiError } from "./openapi.js";
|
|
20
20
|
export { detectPagination } from "./pagination.js";
|
|
21
21
|
export { patchSpec } from "./patch.js";
|
|
@@ -3,6 +3,8 @@ import type { Binding, CodeGenerator, Confidence, Effect, OperationPermission, P
|
|
|
3
3
|
export interface ManifestOperation {
|
|
4
4
|
id: string;
|
|
5
5
|
command: string;
|
|
6
|
+
/** Mounted as `api <group> <command>`, the command without its `<group>-` prefix; none is `api <command>`. */
|
|
7
|
+
group?: string;
|
|
6
8
|
binding: Binding;
|
|
7
9
|
effect: Effect;
|
|
8
10
|
summary?: string;
|
package/dist/codegen/manifest.js
CHANGED
|
@@ -5,6 +5,7 @@ const withoutUndefined = (value) => Object.fromEntries(Object.entries(value).fil
|
|
|
5
5
|
const toManifest = (operation, tree) => withoutUndefined({
|
|
6
6
|
id: operation.id,
|
|
7
7
|
command: operation.command ?? kebab(operation.id),
|
|
8
|
+
group: operation.group,
|
|
8
9
|
binding: operation.binding,
|
|
9
10
|
effect: operation.effect,
|
|
10
11
|
summary: operation.summary,
|
package/dist/codegen/model.d.ts
CHANGED
|
@@ -131,6 +131,8 @@ export interface ApiOperation {
|
|
|
131
131
|
id: string;
|
|
132
132
|
/** Set by `generate`'s `names`; otherwise the command is the kebab-case id. */
|
|
133
133
|
command?: string;
|
|
134
|
+
/** The subgroup of `api` it sits in, set by `generate`'s `names.groups`; none keeps it directly under `api`. */
|
|
135
|
+
group?: string;
|
|
134
136
|
binding: Binding;
|
|
135
137
|
summary?: string;
|
|
136
138
|
description?: string;
|
package/dist/codegen/names.d.ts
CHANGED
|
@@ -2,5 +2,10 @@ import type { Binding } from "./model.js";
|
|
|
2
2
|
export declare const identifier: (id: string) => string;
|
|
3
3
|
/** `getMyInfo` → `get-my-info`. */
|
|
4
4
|
export declare const kebab: (id: string) => string;
|
|
5
|
+
/** The words after `api`: `contacts-list` in the group `contacts` is `contacts list`; `move-page` in `pages` keeps its name. */
|
|
6
|
+
export declare const apiCommandPath: (operation: {
|
|
7
|
+
command: string;
|
|
8
|
+
group?: string;
|
|
9
|
+
}) => string[];
|
|
5
10
|
/** How a reader names the call: `GET /pages/{id}`, `sendMessage`, `query issues`. */
|
|
6
11
|
export declare const bindingLabel: (binding: Binding) => string;
|
package/dist/codegen/names.js
CHANGED
|
@@ -43,6 +43,13 @@ export const kebab = (id) => id
|
|
|
43
43
|
.replace(/[^A-Za-z0-9]+/g, "-")
|
|
44
44
|
.replace(/^-|-$/g, "")
|
|
45
45
|
.toLowerCase();
|
|
46
|
+
/** The words after `api`: `contacts-list` in the group `contacts` is `contacts list`; `move-page` in `pages` keeps its name. */
|
|
47
|
+
export const apiCommandPath = (operation) => {
|
|
48
|
+
const { command, group } = operation;
|
|
49
|
+
if (!group)
|
|
50
|
+
return [command];
|
|
51
|
+
return [group, command.startsWith(`${group}-`) ? command.slice(group.length + 1) : command];
|
|
52
|
+
};
|
|
46
53
|
/** How a reader names the call: `GET /pages/{id}`, `sendMessage`, `query issues`. */
|
|
47
54
|
export const bindingLabel = (binding) => binding.kind === "http"
|
|
48
55
|
? `${binding.method} ${binding.path}`
|
|
@@ -14,6 +14,13 @@ export interface CommandNames {
|
|
|
14
14
|
fromPath?: boolean;
|
|
15
15
|
/** A path segment → its word in a command; `""` leaves it out: `{ "0-3": "deals", crm: "", objects: "" }`. */
|
|
16
16
|
segments?: Readonly<Record<string, string>>;
|
|
17
|
+
/**
|
|
18
|
+
* Puts the operations in subgroups of `api`: by their first tag (a Postman folder is one), or by the first word of
|
|
19
|
+
* their command where the tags do not name resources (HubSpot's `Basic` and `Batch`). Left out, `api` stays flat.
|
|
20
|
+
*/
|
|
21
|
+
groups?: "tags" | "first-word";
|
|
22
|
+
/** A tag or a first word → its group, kebab case; `""` keeps those operations flat: `{ "Activity records": "activities" }`. */
|
|
23
|
+
groupNames?: Readonly<Record<string, string>>;
|
|
17
24
|
}
|
|
18
25
|
export declare const applyNames: (model: ApiModel, names: CommandNames) => ApiModel;
|
|
19
26
|
/** Each read's pagination, detected unless an override set it, or said with `null` that the read does not page. */
|
package/dist/codegen/pipeline.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, extname, join, posix } from "node:path";
|
|
3
|
-
import { bindingLabel, identifier, kebab } from "./names.js";
|
|
3
|
+
import { apiCommandPath, bindingLabel, identifier, kebab } from "./names.js";
|
|
4
4
|
import { answerPaths, detectPagination, requestParameters } from "./pagination.js";
|
|
5
5
|
import { signInRequirements } from "./sign-in.js";
|
|
6
6
|
export class CodegenError extends Error {
|
|
@@ -79,7 +79,52 @@ export const applyNames = (model, names) => {
|
|
|
79
79
|
});
|
|
80
80
|
if (problems.length > 0)
|
|
81
81
|
throw new CodegenError(problems);
|
|
82
|
-
return { ...model, operations };
|
|
82
|
+
return { ...model, operations: names.groups ? applyGroups(operations, names) : operations };
|
|
83
|
+
};
|
|
84
|
+
// `api list` and `api show` are the group's own commands.
|
|
85
|
+
const RESERVED_GROUPS = new Set(["list", "show", "help"]);
|
|
86
|
+
const applyGroups = (operations, names) => {
|
|
87
|
+
const commandOf = (operation) => operation.command ?? kebab(operation.id);
|
|
88
|
+
const sourceOf = (operation) => names.groups === "tags" ? operation.tags[0] : commandOf(operation).split("-")[0];
|
|
89
|
+
const problems = [];
|
|
90
|
+
const sources = new Set(operations.map(sourceOf));
|
|
91
|
+
for (const source of Object.keys(names.groupNames ?? {}))
|
|
92
|
+
if (!sources.has(source))
|
|
93
|
+
problems.push(`names: group "${source}" is no ${names.groups === "tags" ? "tag" : "word"}`);
|
|
94
|
+
const grouped = operations.map((operation) => {
|
|
95
|
+
const source = sourceOf(operation);
|
|
96
|
+
if (source === undefined)
|
|
97
|
+
return { operation };
|
|
98
|
+
const named = names.groupNames && Object.hasOwn(names.groupNames, source) ? names.groupNames[source] : kebab(source);
|
|
99
|
+
return { operation, group: named || undefined };
|
|
100
|
+
});
|
|
101
|
+
const sizes = new Map();
|
|
102
|
+
for (const { group } of grouped)
|
|
103
|
+
if (group)
|
|
104
|
+
sizes.set(group, (sizes.get(group) ?? 0) + 1);
|
|
105
|
+
// A group of one only makes its operation's path longer.
|
|
106
|
+
const result = grouped.map(({ operation, group }) => group && (sizes.get(group) ?? 0) > 1 ? { ...operation, group } : operation);
|
|
107
|
+
const commands = new Set(result.map(commandOf));
|
|
108
|
+
const paths = new Map();
|
|
109
|
+
for (const operation of result) {
|
|
110
|
+
const path = apiCommandPath({ command: commandOf(operation), group: operation.group }).join(" ");
|
|
111
|
+
const other = paths.get(path);
|
|
112
|
+
if (other !== undefined)
|
|
113
|
+
problems.push(`names: "${other}" and "${commandOf(operation)}" are both api ${path}`);
|
|
114
|
+
paths.set(path, commandOf(operation));
|
|
115
|
+
}
|
|
116
|
+
for (const group of new Set(result.flatMap(({ group }) => (group ? [group] : [])))) {
|
|
117
|
+
if (!COMMAND.test(group))
|
|
118
|
+
problems.push(`names: group "${group}" is not kebab case; rename it in groupNames`);
|
|
119
|
+
if (RESERVED_GROUPS.has(group))
|
|
120
|
+
problems.push(`names: group "${group}" is api's own command; rename it in groupNames`);
|
|
121
|
+
// The old flat key `api.<command>` stays an alias of the moved command, so it must never name a whole group.
|
|
122
|
+
if (commands.has(group))
|
|
123
|
+
problems.push(`names: group "${group}" is also the command "${group}"; rename one in groupNames or commands`);
|
|
124
|
+
}
|
|
125
|
+
if (problems.length > 0)
|
|
126
|
+
throw new CodegenError(problems);
|
|
127
|
+
return result;
|
|
83
128
|
};
|
|
84
129
|
/** Each read's pagination, detected unless an override set it, or said with `null` that the read does not page. */
|
|
85
130
|
export const applyPagination = (model, overrides, detect) => {
|
package/dist/codegen/skill.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The API part of a CLI's agent skill: `references/api.md`, a short index, and `references/api/api-<group>.md`, one
|
|
3
|
-
* file per
|
|
3
|
+
* file per group of the operations (their `group`, else their first tag), so an agent loads only the group it needs (`<cli> skill show api-<group>`). Each command,
|
|
4
4
|
* its usage, arguments and flags come from the built program's command tree, as `--help` prints them; the manifest
|
|
5
5
|
* adds only what the API says: the HTTP call, the effect, sign-in scopes, permission keys and paging.
|
|
6
6
|
*/
|
package/dist/codegen/skill.js
CHANGED
|
@@ -102,7 +102,8 @@ export const apiSkillFiles = (options) => {
|
|
|
102
102
|
problems.push(`${command.path.join(" ")} names operation ${command.api_operation}, not in the manifest`);
|
|
103
103
|
const groups = new Map();
|
|
104
104
|
for (const operation of options.operations) {
|
|
105
|
-
|
|
105
|
+
// The skill's files follow the command groups where the manifest has them, so `api-contacts.md` holds `api contacts`.
|
|
106
|
+
const tag = operation.group ?? operation.tags[0] ?? "untagged";
|
|
106
107
|
const name = kebab(tag);
|
|
107
108
|
const group = groups.get(name);
|
|
108
109
|
if (!name)
|
package/dist/codegen/wp-json.js
CHANGED
|
@@ -190,6 +190,8 @@ export const wpJsonToOpenApi = (index, options) => {
|
|
|
190
190
|
continue;
|
|
191
191
|
}
|
|
192
192
|
const item = {};
|
|
193
|
+
// The resource after the namespace, `posts` in `/wp/v2/posts/(?P<id>…)`, so `names.groups` can group by it.
|
|
194
|
+
const resource = route.slice(namespace.length + 2).split("/")[0] ?? "";
|
|
193
195
|
const endpoints = Array.isArray(raw.endpoints) ? raw.endpoints.filter(object) : [];
|
|
194
196
|
try {
|
|
195
197
|
for (const endpoint of endpoints) {
|
|
@@ -214,6 +216,8 @@ export const wpJsonToOpenApi = (index, options) => {
|
|
|
214
216
|
}));
|
|
215
217
|
const rest = Object.entries(args).filter(([name]) => patterns[name] === undefined);
|
|
216
218
|
const operation = { parameters: pathParameters };
|
|
219
|
+
if (/^[A-Za-z][\w-]*$/.test(resource))
|
|
220
|
+
operation.tags = [resource];
|
|
217
221
|
if (method === write) {
|
|
218
222
|
if (rest.length > 0)
|
|
219
223
|
operation.requestBody = {
|
package/dist/dev/ready.js
CHANGED
|
@@ -31,6 +31,10 @@ const CATEGORY_CONTRACTS = [
|
|
|
31
31
|
],
|
|
32
32
|
},
|
|
33
33
|
{ names: ["tracker", "issue tracker (issues, projects, teams)"], contracts: ["trackerSourceContract"] },
|
|
34
|
+
{
|
|
35
|
+
names: ["content", "blog or site content (posts, pages, tags)"],
|
|
36
|
+
contracts: ["contentSourceContract", "contentSyncContract", "contentWriteContract"],
|
|
37
|
+
},
|
|
34
38
|
{ names: ["messenger", "notes"], contracts: [] },
|
|
35
39
|
];
|
|
36
40
|
const DESIGN = "docs/dev/DESIGN.md";
|
package/dist/standards/audit.js
CHANGED
|
@@ -159,6 +159,7 @@ export const PARITY_GROUPS = defineParityGroups([
|
|
|
159
159
|
// bitrix24-cli's search is cli-core's CRM `search all`, and beeline-cli's and asterisk-cli's meetings take call
|
|
160
160
|
// recordings, not zoom-cli's: they are compared on the root commands every CLI shares, the way gcal and mail are.
|
|
161
161
|
// amo-cli, hubspot-cli and attio-cli share them too, and their CRM commands are compared with b24 in `crm` below.
|
|
162
|
+
// wordpress-cli shares only these roots: it is the first content CLI, so its posts commands have no group yet.
|
|
162
163
|
// notion-cli joins here until its documents commands ship; then it moves next to drive. ydisk joins here too: in "all"
|
|
163
164
|
// its search and notes differ from the messengers' and memo's as drive's do, and a documents group of drive, notion
|
|
164
165
|
// and ydisk differs in 39 paths (session, folders browse, summaries; measured on the published CLIs 2026-11-17).
|
|
@@ -179,6 +180,7 @@ export const PARITY_GROUPS = defineParityGroups([
|
|
|
179
180
|
"hubspot",
|
|
180
181
|
"attio",
|
|
181
182
|
"ydisk",
|
|
183
|
+
"wordpress",
|
|
182
184
|
],
|
|
183
185
|
covers: ["commands", "doctor", "skill", "mcp", "upgrade"],
|
|
184
186
|
differences: [...MEMO_HAS_NO_PROFILES, ...MEMO_MCP_SUMMARIES, MEMO_DOCTOR_DEEP],
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Posts and pages on a site or blog the owner publishes. */
|
|
2
|
+
export const CONTENT_FLAGS = [
|
|
3
|
+
{ name: "--slug", value: "<slug>", role: "value", type: "string", meaning: "the last part of its web address" },
|
|
4
|
+
{
|
|
5
|
+
name: "--tags",
|
|
6
|
+
value: "<ids>",
|
|
7
|
+
role: "value",
|
|
8
|
+
type: "list",
|
|
9
|
+
meaning: "its tags and categories, by comma-separated ids; replaces the ones it has",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "--replace-body",
|
|
13
|
+
role: "mode",
|
|
14
|
+
type: "switch",
|
|
15
|
+
meaning: "write the new text over a body the tool cannot fully read back, losing what it could not show",
|
|
16
|
+
},
|
|
17
|
+
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { ACCOUNT_FLAGS } from "./flags-account.js";
|
|
3
3
|
import { CALENDAR_FLAGS } from "./flags-calendar.js";
|
|
4
|
+
import { CONTENT_FLAGS } from "./flags-content.js";
|
|
4
5
|
import { CRM_FLAGS } from "./flags-crm.js";
|
|
5
6
|
import { HOW_FLAGS } from "./flags-how.js";
|
|
6
7
|
import { KNOWLEDGE_FLAGS } from "./flags-knowledge.js";
|
|
@@ -243,6 +244,8 @@ const collections = [
|
|
|
243
244
|
["messages", "posts in a messenger chat, or emails"],
|
|
244
245
|
["drafts", "e-mails saved in a mailbox's Drafts folder, written and not sent"],
|
|
245
246
|
["polls", "polls in a chat"],
|
|
247
|
+
["posts", "posts and pages on a site or blog the owner publishes"],
|
|
248
|
+
["channels", "the sites and social accounts the owner publishes posts on"],
|
|
246
249
|
["reactions", "reactions to a message"],
|
|
247
250
|
["recipients", "who a message goes to"],
|
|
248
251
|
["replies", "the automatic replies of a profile"],
|
|
@@ -372,6 +375,7 @@ const singulars = [
|
|
|
372
375
|
];
|
|
373
376
|
const views = [
|
|
374
377
|
["tree", "the parent and child hierarchy of stored sources"],
|
|
378
|
+
["stats", "a thing's own numbers, such as a post's views, as read at each sync"],
|
|
375
379
|
["logs", "the log of a running process"],
|
|
376
380
|
["events", "what happened in a thing over time"],
|
|
377
381
|
["scheduled", "what is scheduled to happen"],
|
|
@@ -446,5 +450,6 @@ export const VOCABULARY = defineVocabulary({
|
|
|
446
450
|
...KNOWLEDGE_FLAGS,
|
|
447
451
|
...CRM_FLAGS,
|
|
448
452
|
...SCHEDULE_FLAGS,
|
|
453
|
+
...CONTENT_FLAGS,
|
|
449
454
|
],
|
|
450
455
|
});
|
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` | 33 | Paths, vocabulary, flags, arguments, effects, lifetime, query, help, external references, joining `wcat`, settings in the config file, refs, network hosts, the generated `api` group |
|
|
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 |
|
package/docs/standards/ci.md
CHANGED
|
@@ -189,6 +189,7 @@ its prompt in cli-template says so from cli-template 0.8.0. A CLI on an older te
|
|
|
189
189
|
| 03:09 | beeline-cli |
|
|
190
190
|
| 03:11 | hubspot-cli |
|
|
191
191
|
| 03:13 | zoom-cli |
|
|
192
|
+
| 03:17 | wordpress-cli |
|
|
192
193
|
| 03:20 | cli-docs |
|
|
193
194
|
|
|
194
195
|
- **Exceptions:** cli-core also builds and probes its native packages in their own workflows, after the window:
|
|
@@ -106,7 +106,10 @@ per profile, and only `defaults` is filled.
|
|
|
106
106
|
- **Enforced by:** review only.
|
|
107
107
|
- **Example:** the release notes give the old and the new path under "Changed — may break callers". Help, completion,
|
|
108
108
|
generated pages, the skill, MCP names and permission keys move in the same change.
|
|
109
|
-
- **Exceptions:**
|
|
109
|
+
- **Exceptions:** the old flat permission key of a generated `api` command that moved into a subgroup stays an alias
|
|
110
|
+
that only tightens
|
|
111
|
+
([WC-CMD-33](#wc-cmd-33--group-a-generated-api-by-resource-api-group-command)); the old command path still stops
|
|
112
|
+
working.
|
|
110
113
|
- **Applies to:** all CLIs. **Since:** cli-base 0.41.0. **Rulings:** NEED-417.
|
|
111
114
|
|
|
112
115
|
### WC-CMD-9 · Answer the naming questions in the pull request before you build a new command
|
|
@@ -495,6 +498,34 @@ the machine and checks every redirect.
|
|
|
495
498
|
inside a sentence left out of `undeclared-host`, since the release after 0.98.0.
|
|
496
499
|
**Rulings:** none.
|
|
497
500
|
|
|
501
|
+
## The generated `api` group
|
|
502
|
+
|
|
503
|
+
### WC-CMD-33 · Group a generated `api` by resource: `api <group> <command>`
|
|
504
|
+
|
|
505
|
+
A CLI whose `api` group cli-core builds from a generated manifest (`serviceApiCommand`, `generatedApiCommand`) sets
|
|
506
|
+
`names.groups` in `generate`: `"tags"` puts each operation under its first tag (a Postman folder is one), and
|
|
507
|
+
`"first-word"` under the first word of its command, for a spec whose tags name no resource (HubSpot's `Basic` and
|
|
508
|
+
`Batch`). `names.groupNames` renames a group, or keeps a tag's operations flat with `""`. The command drops the
|
|
509
|
+
repeated group word: `contacts-list` in `contacts` is `api contacts list`. An operation without a tag, and a group of
|
|
510
|
+
one operation, stay directly under `api`.
|
|
511
|
+
|
|
512
|
+
- **Why:** a flat list of a hundred operations is hard to read in help and hard for an agent to search; a group per
|
|
513
|
+
resource is how the service's own reference is laid out, and one permission key can then cover a resource.
|
|
514
|
+
- **Enforced by:** `src/codegen/groups.test.ts` · `cli-core: src/cli/service-api-groups.test.ts`. The generator
|
|
515
|
+
refuses a group that would shadow the group's own commands, a group named like a command, and two operations on one
|
|
516
|
+
path.
|
|
517
|
+
- **Example:** `api.contacts: deny` stops every `api contacts` command; `api.contacts.delete` is the delete's own key.
|
|
518
|
+
A profile that still names the old flat key `api.contacts-list` keeps that hold: cli-core checks it beside
|
|
519
|
+
`api.contacts.list` on every call, from the command line and over MCP, and warns to rename it. Its `deny`, `ask` or
|
|
520
|
+
`readonly` (on a write) applies; its `allow` lifts nothing. The old path `api contacts-list` is gone
|
|
521
|
+
([WC-CMD-8](#wc-cmd-8--keep-no-aliases-a-renamed-path-stops-working-in-the-release-that-renames-it)): the release
|
|
522
|
+
that groups a CLI's `api` lists the move under "Changed — may break callers" and raises the minor version.
|
|
523
|
+
`api show` takes the new path, the old name or the operation id; `api list` prints the path and the group.
|
|
524
|
+
- **Exceptions:** a manifest generated without `names.groups` stays flat. gcal and drive keep their own
|
|
525
|
+
`api.<service>.<resource>.<method>` keys, and the messenger CLIs' `bot api` stays flat, until each is moved.
|
|
526
|
+
- **Applies to:** every CLI with a generated `api` group, from its next regeneration. **Since:** the release after
|
|
527
|
+
cli-base 0.120.0, with the cli-core release that mounts groups. **Rulings:** NEED-2754.
|
|
528
|
+
|
|
498
529
|
## Sources
|
|
499
530
|
|
|
500
531
|
These documents explain the rules on this page in more detail. Where one of them disagrees with this page, this page
|
|
@@ -35,8 +35,9 @@ loads `@wirecat/cli-base/testing/setup`, and `.vale.ini` reads the styles in `co
|
|
|
35
35
|
## The API generator
|
|
36
36
|
|
|
37
37
|
`@wirecat/cli-base/codegen` turns a service's API description into committed files: types, Valibot schemas, an
|
|
38
|
-
operation manifest and a coverage page. cli-core's `generatedApiCommand` builds the `api
|
|
39
|
-
|
|
38
|
+
operation manifest and a coverage page. cli-core's `generatedApiCommand` builds the `api` group from the manifest: `api <group> <command>` once
|
|
39
|
+
`names.groups` puts the operations in groups
|
|
40
|
+
([WC-CMD-33](commands.md#wc-cmd-33--group-a-generated-api-by-resource-api-group-command)), `api <command>` without. The [reference](../REFERENCE.md) has the API; this section says what goes in, what a CLI can correct, and
|
|
40
41
|
what it cannot do yet.
|
|
41
42
|
|
|
42
43
|
### Inputs
|
|
@@ -170,7 +171,7 @@ source whose subtypes the definitions cannot tell apart.
|
|
|
170
171
|
`apiSkillFiles({ cli, folder, files, service, skill, operations, commands, banner })` writes the API part of the
|
|
171
172
|
CLI's skill, in the shape of [openapi-to-skills](https://github.com/neutree-ai/openapi-to-skills): `references/api.md`,
|
|
172
173
|
a short index of the groups with their effects, and `references/api/api-<group>.md`, one file per group. An
|
|
173
|
-
operation's group is its first tag; one without
|
|
174
|
+
operation's group is its `group` (WC-CMD-33), else its first tag; one without either is in `api-untagged.md`. A tag with no Latin letter or digit
|
|
174
175
|
cannot name a file and stops the generation. An agent reads
|
|
175
176
|
the index, then only the group it needs, with `<cli> skill show api-<group>`. The `skill` command already ships and
|
|
176
177
|
shows every file beside `SKILL.md`; nothing else is needed.
|
|
@@ -206,7 +207,7 @@ the coverage page after a spec sync.
|
|
|
206
207
|
|
|
207
208
|
- **cli-core checks the permission keys; the CLI still shows them.** From cli-core 0.684.0, `serviceApiCommand`
|
|
208
209
|
reads each operation's `permissions`, `servers` and `securitySchemes`: it sends the call to the operation's server
|
|
209
|
-
with the sign-in its scheme names, and checks `api.<
|
|
210
|
+
with the sign-in its scheme names, and checks the command's own key (`api.<group>.<command>`, its path) and each manifest key that applies to the call
|
|
210
211
|
(`files.delete` when `permanently` is true) before it sends. That guard runs whatever the CLI declares. `--dry-run`
|
|
211
212
|
and permission discovery show those keys only when the CLI merges `serviceApiPermissions(...)` into its own
|
|
212
213
|
`commandPermissions`, field by field (`extra`, `alsoChecks`, `defaults`), as ydisk's `src/config.ts` does:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.124.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",
|