@wirecat/cli-base 1.1.0 → 1.2.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 +44 -0
- package/dist/dev/adopt.d.ts +2 -1
- package/dist/dev/adopt.js +7 -1
- package/dist/dev/bundle.d.ts +22 -0
- package/dist/dev/bundle.js +20 -5
- package/dist/dev/core-override.d.ts +15 -0
- package/dist/dev/core-override.js +70 -0
- package/dist/dev/index.d.ts +2 -0
- package/dist/dev/index.js +2 -0
- package/dist/dev/main.js +14 -16
- package/dist/dev/version-command.d.ts +8 -0
- package/dist/dev/version-command.js +29 -0
- package/dist/wcat/manifest.d.ts +120 -2
- package/dist/wcat/manifest.js +84 -7
- package/docs/standards/README.md +1 -1
- package/docs/standards/commands.md +4 -2
- package/docs/standards/new-cli.md +3 -2
- package/docs/standards/toolchain.md +25 -1
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,50 @@ 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.2.0 — 28.11.2026
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`@wirecat/cli-base/dev` exports the parts of `cli-dev bundle` that another package's own build reuses.**
|
|
16
|
+
`commonJsNames`, `ownPlaces` (now taking one options object, which works with no anchored packages),
|
|
17
|
+
`DEFAULT_EXTERNAL`, `DEFAULT_HARMLESS` and `bundle`. cli-core's pre-bundle script imports them instead of
|
|
18
|
+
copying them. The entry is not in `wirecat.stable`: it may change in a minor release.
|
|
19
|
+
- **`cli-dev version` checks a CLI's override of `@wirecat/cli-core` (WC-TOOL-21).** cli-core's `X.Y.Z` now ships no
|
|
20
|
+
type files, and its `X.Y.Z-dev` is the same code with them. A CLI pins `X.Y.Z` in `package.json` and overrides it to
|
|
21
|
+
`X.Y.Z-dev` under `overrides:` in `pnpm-workspace.yaml`, which its users never read. `cli-dev version` fails when the
|
|
22
|
+
override names another version, or is missing while the installed cli-core has no types, and prints the line to
|
|
23
|
+
write. It only notes a missing override while the CLI pins a cli-core released before the `-dev` releases.
|
|
24
|
+
`node-ci.yml` runs the same check (`cli-dev version --cli-core-only`) right after install, so the message comes before
|
|
25
|
+
typecheck's TS7016. `cli-dev adopt` now moves the override with the pin
|
|
26
|
+
([Toolchain](docs/standards/toolchain.md#wc-tool-21--pin-cli-core-xyz-and-override-it-to-xyz-dev-at-the-root)).
|
|
27
|
+
- **A CLI can name its fixed MCP port in its manifest.** `ManifestIdentity.mcpPort` writes `desktop.mcpServer.port` in
|
|
28
|
+
`contracts/wirecat.json`, so WireCat Desktop reads the port of a WireCat tool's MCP server from the tool itself
|
|
29
|
+
instead of its own catalog. Without `mcpPort` the key is absent and the manifest of every other CLI stays the same,
|
|
30
|
+
byte for byte. A CLI that sets `mcpPort` without `mcp server start`, `stop`, `status` and `mcp revoke` is refused.
|
|
31
|
+
Only WireCat's own tools set it, each with a port no other tool has
|
|
32
|
+
([reference](docs/REFERENCE.md)).
|
|
33
|
+
- **A CLI can name the sync Desktop runs when it has several `<noun> sync` commands.** `ManifestIdentity.syncCommand`
|
|
34
|
+
takes the command and its flags, `["messages", "sync", "--all"]`, and the manifest's `desktop.sync` then runs it and
|
|
35
|
+
finds its last run. Before, such a CLI stated no sync, so Desktop kept its own words for the messengers. Words that
|
|
36
|
+
name no command are refused ([reference](docs/REFERENCE.md)).
|
|
37
|
+
- **A CLI can name Desktop's timer for its sync.** `ManifestIdentity.syncSchedule` writes `desktop.sync.schedule`
|
|
38
|
+
with the interval a new timer starts with, the intervals Desktop offers and the command it runs. It needs cli-core's
|
|
39
|
+
`schedule command`, `list`, `remove` and `run`. Without it the key is absent and the manifest stays the same, byte
|
|
40
|
+
for byte.
|
|
41
|
+
- **A WireCat tool's sign-in methods can say where Desktop passes what the person typed.** `signIn.methods` takes
|
|
42
|
+
`address`, `clientFile`, `portal` and `appId` (flags the command must take), `password` (the variable the CLI reads),
|
|
43
|
+
`clientId` (the setting that names the person's own OAuth app) and `oauth` (the words for a browser sign-in), as
|
|
44
|
+
Desktop's own catalog has them. Only `@wirecat` packages may set them, since Desktop refuses them from any other
|
|
45
|
+
tool.
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **`cli-dev bundle` drops the `.d.ts` and `.map` files tsc wrote to `dist/`, in a CLI with no `exports`.** Nothing
|
|
50
|
+
imports such a CLI, and no map is read for the bundle a user runs: esbuild writes no maps, and the tsc maps point at
|
|
51
|
+
`src/`, which a CLI does not publish. tg-cli's package loses 204 files and 2.0 MB unpacked, an estimated 20 MB
|
|
52
|
+
across the CLIs. A package with `exports`, such as drive-cli and zoom-cli, keeps them for whoever imports it. Run
|
|
53
|
+
`pnpm typecheck` before `pnpm build`, as CI does: its `--emitDeclarationOnly` writes the `.d.ts` files again.
|
|
54
|
+
|
|
11
55
|
## 1.1.0 — 27.11.2026
|
|
12
56
|
|
|
13
57
|
### Added
|
package/dist/dev/adopt.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type Run = (command: string, args: readonly string[]) => number;
|
|
2
2
|
/**
|
|
3
|
-
* Moves the CLI onto `version` of a shared package the same way every time: the pin in package.json
|
|
3
|
+
* Moves the CLI onto `version` of a shared package the same way every time: the pin in package.json (and for cli-core
|
|
4
|
+
* the -dev override beside it, WC-TOOL-21), the lockfile,
|
|
4
5
|
* the generated files and the quick checks. What the checks then report (pins, baselines) is the adoption's work.
|
|
5
6
|
*/
|
|
6
7
|
export declare const adopt: (cwd: string, name: string, version: string, run: Run, log: (line: string) => void) => number;
|
package/dist/dev/adopt.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { CORE, DEV_SUFFIX, needsCoreOverride, writeCoreOverride } from "./core-override.js";
|
|
3
4
|
const SECTIONS = ["dependencies", "devDependencies", "optionalDependencies"];
|
|
4
5
|
/**
|
|
5
|
-
* Moves the CLI onto `version` of a shared package the same way every time: the pin in package.json
|
|
6
|
+
* Moves the CLI onto `version` of a shared package the same way every time: the pin in package.json (and for cli-core
|
|
7
|
+
* the -dev override beside it, WC-TOOL-21), the lockfile,
|
|
6
8
|
* the generated files and the quick checks. What the checks then report (pins, baselines) is the adoption's work.
|
|
7
9
|
*/
|
|
8
10
|
export const adopt = (cwd, name, version, run, log) => {
|
|
@@ -24,6 +26,10 @@ export const adopt = (cwd, name, version, run, log) => {
|
|
|
24
26
|
}
|
|
25
27
|
writeFileSync(path, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
26
28
|
log(`${name} ${version} in package.json`);
|
|
29
|
+
if (name === CORE && needsCoreOverride(cwd)) {
|
|
30
|
+
writeCoreOverride(cwd, version);
|
|
31
|
+
log(`${name} ${version}${DEV_SUFFIX} in pnpm-workspace.yaml`);
|
|
32
|
+
}
|
|
27
33
|
const steps = [
|
|
28
34
|
["pnpm", ["install"]],
|
|
29
35
|
...["generate", "ci:quick"]
|
package/dist/dev/bundle.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
1
2
|
export interface BundleOptions {
|
|
2
3
|
/** The CLI's root: `dist/` and `package.json` are under it. */
|
|
3
4
|
root: string;
|
|
@@ -20,6 +21,27 @@ export declare const DEFAULT_EXTERNAL: string[];
|
|
|
20
21
|
export declare const DEFAULT_ANCHORED: string[];
|
|
21
22
|
export declare const DEFAULT_HARMLESS: string[];
|
|
22
23
|
export declare const LOADER_MARK = "// cli-dev bundle loader\n";
|
|
24
|
+
export interface OwnPlacesOptions {
|
|
25
|
+
/** The modules under it keep their place: `import.meta.url` becomes their file before bundling. */
|
|
26
|
+
dist: string;
|
|
27
|
+
/** Where the bundle is written: the places are relative to it. */
|
|
28
|
+
out: string;
|
|
29
|
+
/** Packages whose modules keep their installed place too. */
|
|
30
|
+
anchored?: readonly string[];
|
|
31
|
+
/** Third-party files that may look themselves up (a path suffix each); `DEFAULT_HARMLESS` when not given. */
|
|
32
|
+
harmless?: readonly string[];
|
|
33
|
+
/** What stays outside the bundle; a run-time import of it resolves from the module's own place. */
|
|
34
|
+
isExternal?: (specifier: string) => boolean;
|
|
35
|
+
/** Collects each module that would look for a file or package in the wrong place. */
|
|
36
|
+
problems: string[];
|
|
37
|
+
}
|
|
38
|
+
/** The esbuild plugin that keeps each module's place (the header says why). */
|
|
39
|
+
export declare const ownPlaces: ({ dist, out, anchored, harmless, isExternal, problems, }: OwnPlacesOptions) => Plugin;
|
|
40
|
+
/**
|
|
41
|
+
* `await import("yaml")` gets CommonJS's named exports from Node, but only `default` from a bundled chunk. A dynamic
|
|
42
|
+
* import of CommonJS goes through a module that exports the names Node itself finds in it.
|
|
43
|
+
*/
|
|
44
|
+
export declare const commonJsNames: Plugin;
|
|
23
45
|
/**
|
|
24
46
|
* Whether the loader runs a server: `serve`, `watch` or `mcp serve`, or `mcp` alone as before cli-core 0.463. Flags
|
|
25
47
|
* are skipped, so `<cli> personal --read-only mcp serve` counts; four words leave room for one flag's value. It is
|
package/dist/dev/bundle.js
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* anchored packages (cli-core, cli-base), `import.meta.url` becomes the module's own place, and a package they load
|
|
10
10
|
* at run time is resolved from there too: pnpm installs cli-core's dependencies beside cli-core, not beside the CLI.
|
|
11
11
|
* - The build fails when a bundled module would still look in the wrong place.
|
|
12
|
+
* - A CLI with no `exports` drops tsc's `.d.ts` and `.map` files from `dist/`: nothing imports it, and no map is read
|
|
13
|
+
* for the bundle a user runs. A package with `exports` keeps them for whoever imports it.
|
|
12
14
|
*/
|
|
13
|
-
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { existsSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
14
16
|
import { isBuiltin } from "node:module";
|
|
15
17
|
import { basename, dirname, join, relative, sep } from "node:path";
|
|
16
18
|
import { pathToFileURL } from "node:url";
|
|
@@ -71,7 +73,8 @@ export const importFrom = async (parent, specifier) => import(resolveFrom(parent
|
|
|
71
73
|
`;
|
|
72
74
|
const BY_NAME = /(?<![\w$.])import\(\s*(?!["'`.])/g;
|
|
73
75
|
const LITERAL = /(?<![\w$.])import\(\s*(["'])([^"'.][^"']*)\1\s*\)/g;
|
|
74
|
-
|
|
76
|
+
/** The esbuild plugin that keeps each module's place (the header says why). */
|
|
77
|
+
export const ownPlaces = ({ dist, out, anchored = [], harmless = DEFAULT_HARMLESS, isExternal = () => false, problems, }) => {
|
|
75
78
|
const placeOf = (file) => {
|
|
76
79
|
if (file.startsWith(dist + sep))
|
|
77
80
|
return `new URL(${JSON.stringify(posix(relative(out, file)))}, import.meta.url).href`;
|
|
@@ -138,7 +141,7 @@ const isCommonJs = (file) => {
|
|
|
138
141
|
* `await import("yaml")` gets CommonJS's named exports from Node, but only `default` from a bundled chunk. A dynamic
|
|
139
142
|
* import of CommonJS goes through a module that exports the names Node itself finds in it.
|
|
140
143
|
*/
|
|
141
|
-
const commonJsNames = {
|
|
144
|
+
export const commonJsNames = {
|
|
142
145
|
name: "common-js-names",
|
|
143
146
|
setup(context) {
|
|
144
147
|
context.onResolve({ filter: /.*/ }, async (args) => {
|
|
@@ -232,7 +235,7 @@ export const bundle = async (options) => {
|
|
|
232
235
|
return { problems: [`${options.bin} is not under dist/`], chunks: [] };
|
|
233
236
|
if (readFileSync(bin, "utf8").includes(LOADER_MARK))
|
|
234
237
|
return { problems: [`${options.bin} is already the loader — compile it again (tsc) first`], chunks: [] };
|
|
235
|
-
const { version } = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
238
|
+
const { version, exports } = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
236
239
|
rmSync(out, { recursive: true, force: true });
|
|
237
240
|
const { metafile } = await build({
|
|
238
241
|
absWorkingDir: root,
|
|
@@ -253,7 +256,14 @@ export const bundle = async (options) => {
|
|
|
253
256
|
},
|
|
254
257
|
plugins: [
|
|
255
258
|
commonJsNames,
|
|
256
|
-
ownPlaces(
|
|
259
|
+
ownPlaces({
|
|
260
|
+
dist,
|
|
261
|
+
out,
|
|
262
|
+
anchored: [...DEFAULT_ANCHORED, ...(options.anchored ?? [])],
|
|
263
|
+
harmless: [...DEFAULT_HARMLESS, ...(options.harmless ?? [])],
|
|
264
|
+
isExternal,
|
|
265
|
+
problems,
|
|
266
|
+
}),
|
|
257
267
|
],
|
|
258
268
|
metafile: true,
|
|
259
269
|
logLevel: "silent",
|
|
@@ -285,5 +295,10 @@ export const bundle = async (options) => {
|
|
|
285
295
|
if (missing.length > 0)
|
|
286
296
|
return { problems: missing.map((chunk) => `the loader names ${chunk}, not built`), chunks };
|
|
287
297
|
writeFileSync(bin, loaderSource(name, version, chunks));
|
|
298
|
+
if (exports === undefined) {
|
|
299
|
+
for (const file of readdirSync(dist, { recursive: true, encoding: "utf8" }))
|
|
300
|
+
if (/\.js\.map$|\.d\.ts(\.map)?$/.test(file))
|
|
301
|
+
rmSync(join(dist, file));
|
|
302
|
+
}
|
|
288
303
|
return { problems: [], chunks };
|
|
289
304
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const CORE = "@wirecat/cli-core";
|
|
2
|
+
export declare const DEV_SUFFIX = "-dev";
|
|
3
|
+
export interface OverrideCheck {
|
|
4
|
+
problems: string[];
|
|
5
|
+
notes: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Problems are a wrong override, or none while the installed cli-core is the user package (no `dist/index.d.ts`):
|
|
9
|
+
* that one is published only beside its -dev twin, so the override can be added. An older cli-core, released before
|
|
10
|
+
* the twins, still ships its types and has no -dev to point at; then the missing override is only a note.
|
|
11
|
+
*/
|
|
12
|
+
export declare const coreOverrideCheck: (root: string) => OverrideCheck;
|
|
13
|
+
/** Points the override at `version`-dev, as `adopt` does with the pin; keeps the file's other lines and comments. */
|
|
14
|
+
export declare const writeCoreOverride: (root: string, version: string) => void;
|
|
15
|
+
export declare const needsCoreOverride: (root: string) => boolean;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WC-TOOL-21: a CLI pins `@wirecat/cli-core` X.Y.Z in package.json, which is what its users install, and overrides it
|
|
3
|
+
* to X.Y.Z-dev in pnpm-workspace.yaml, which only the CLI's own checkout reads. X.Y.Z ships no type files; X.Y.Z-dev
|
|
4
|
+
* is the same JavaScript with the types, their maps and src/.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { parseDocument } from "yaml";
|
|
9
|
+
export const CORE = "@wirecat/cli-core";
|
|
10
|
+
export const DEV_SUFFIX = "-dev";
|
|
11
|
+
const WORKSPACE = "pnpm-workspace.yaml";
|
|
12
|
+
const EXACT = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;
|
|
13
|
+
const readManifest = (root) => JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
14
|
+
/** The CLI's pin when the rule applies to it: cli-core itself, and a package with no `bin`, are not CLIs. */
|
|
15
|
+
const pinOf = (pkg) => pkg.name === CORE || pkg.bin === undefined ? undefined : pkg.dependencies?.[CORE];
|
|
16
|
+
const overrideOf = (root) => {
|
|
17
|
+
const path = join(root, WORKSPACE);
|
|
18
|
+
if (!existsSync(path))
|
|
19
|
+
return undefined;
|
|
20
|
+
const value = parseDocument(readFileSync(path, "utf8")).getIn(["overrides", CORE]);
|
|
21
|
+
return value === undefined || value === null ? undefined : String(value);
|
|
22
|
+
};
|
|
23
|
+
const line = (pin) => ` "${CORE}": ${pin}${DEV_SUFFIX}`;
|
|
24
|
+
/**
|
|
25
|
+
* Problems are a wrong override, or none while the installed cli-core is the user package (no `dist/index.d.ts`):
|
|
26
|
+
* that one is published only beside its -dev twin, so the override can be added. An older cli-core, released before
|
|
27
|
+
* the twins, still ships its types and has no -dev to point at; then the missing override is only a note.
|
|
28
|
+
*/
|
|
29
|
+
export const coreOverrideCheck = (root) => {
|
|
30
|
+
const pin = pinOf(readManifest(root));
|
|
31
|
+
if (pin === undefined)
|
|
32
|
+
return { problems: [], notes: [] };
|
|
33
|
+
if (!EXACT.test(pin))
|
|
34
|
+
return { problems: [`package.json gives ${CORE} as "${pin}": pin the exact version, such as 2.1.0`], notes: [] };
|
|
35
|
+
const override = overrideOf(root);
|
|
36
|
+
const wanted = `${pin}${DEV_SUFFIX}`;
|
|
37
|
+
if (override === wanted)
|
|
38
|
+
return { problems: [], notes: [] };
|
|
39
|
+
if (override !== undefined)
|
|
40
|
+
return {
|
|
41
|
+
problems: [
|
|
42
|
+
`${WORKSPACE} overrides ${CORE} to ${override}, but package.json pins ${pin}, so this repository builds and ` +
|
|
43
|
+
`tests against a cli-core its users never get. Change that line under "overrides:" to\n${line(pin)}\n` +
|
|
44
|
+
"and run `pnpm install` (WC-TOOL-21).",
|
|
45
|
+
],
|
|
46
|
+
notes: [],
|
|
47
|
+
};
|
|
48
|
+
const installed = join(root, "node_modules", CORE);
|
|
49
|
+
if (existsSync(join(installed, "package.json")) && !existsSync(join(installed, "dist/index.d.ts")))
|
|
50
|
+
return {
|
|
51
|
+
problems: [
|
|
52
|
+
`${WORKSPACE} does not override ${CORE}. ${pin} is the package users install and has no type files, so ` +
|
|
53
|
+
`\`pnpm typecheck\` fails with TS7016 ("Could not find a declaration file for module '${CORE}'"). ` +
|
|
54
|
+
`Add this line under "overrides:" in ${WORKSPACE}\n${line(pin)}\nand run \`pnpm install\` (WC-TOOL-21).`,
|
|
55
|
+
],
|
|
56
|
+
notes: [],
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
problems: [],
|
|
60
|
+
notes: [`${CORE} ${pin} predates the -dev releases; from the next cli-core, \`cli-dev adopt\` adds the override`],
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/** Points the override at `version`-dev, as `adopt` does with the pin; keeps the file's other lines and comments. */
|
|
64
|
+
export const writeCoreOverride = (root, version) => {
|
|
65
|
+
const path = join(root, WORKSPACE);
|
|
66
|
+
const doc = parseDocument(existsSync(path) ? readFileSync(path, "utf8") : "");
|
|
67
|
+
doc.setIn(["overrides", CORE], `${version}${DEV_SUFFIX}`);
|
|
68
|
+
writeFileSync(path, String(doc));
|
|
69
|
+
};
|
|
70
|
+
export const needsCoreOverride = (root) => pinOf(readManifest(root)) !== undefined;
|
package/dist/dev/main.js
CHANGED
|
@@ -13,7 +13,7 @@ import * as v from "valibot";
|
|
|
13
13
|
import { parseCommandsDocument } from "../commands/document.js";
|
|
14
14
|
import { describeProgram } from "../commands/registry.js";
|
|
15
15
|
import { taggedSection } from "../release/fold.js";
|
|
16
|
-
import { CHANGELOG_HEADINGS, changelogProblems, collectFragments, docsProblems, fragmentProblems, JOURNAL_IDS, markdownFiles, packageVersion, readFragments, structureProblems,
|
|
16
|
+
import { CHANGELOG_HEADINGS, changelogProblems, collectFragments, docsProblems, fragmentProblems, JOURNAL_IDS, markdownFiles, packageVersion, readFragments, structureProblems, } from "../release/index.js";
|
|
17
17
|
import { AUDIT_BLOCKS, defineParityGroups, PARITY_GROUPS, REQUIRED_ROOTS } from "../standards/audit.js";
|
|
18
18
|
import { defineReasons } from "../standards/errors.js";
|
|
19
19
|
import { baselineProblems, baselineSchema, LINT_RULES, OVERRIDE_BUDGET, OVERRIDE_RULE_REVIEW, overdue, overrideSchema, overridesDueSoon, overridesProblems, rulesForReview, } from "../standards/lint.js";
|
|
@@ -34,6 +34,7 @@ import { READY_USAGE, ready } from "./ready.js";
|
|
|
34
34
|
import { readDeclarations } from "./result-shape.js";
|
|
35
35
|
import { slowTests } from "./slow-tests.js";
|
|
36
36
|
import { matrixPage, matrixRows, parseArgvLog } from "./test-matrix.js";
|
|
37
|
+
import { versionCommand } from "./version-command.js";
|
|
37
38
|
import { binNameWarnings, describeWarnings, hostsWarnings, WCAT_RULES } from "./wcat-lint.js";
|
|
38
39
|
const USAGE = `usage: cli-dev <command> [options]
|
|
39
40
|
|
|
@@ -42,7 +43,11 @@ const USAGE = `usage: cli-dev <command> [options]
|
|
|
42
43
|
exits 1 when the report is missing
|
|
43
44
|
next-version <wanted> <latest> <versions-json>
|
|
44
45
|
the version bin/release publishes, given npm's answers
|
|
45
|
-
version [--sync] [--file <path>]
|
|
46
|
+
version [--sync] [--file <path>] [--cli-core-only]
|
|
47
|
+
package.json's version against src/version.ts, and a CLI's override of
|
|
48
|
+
@wirecat/cli-core in pnpm-workspace.yaml against its pin: the pinned
|
|
49
|
+
version plus -dev, the one with the type files (WC-TOOL-21);
|
|
50
|
+
--cli-core-only checks only the override
|
|
46
51
|
changelog fold [--version <x.y.z>] [--unreleased <title>] [--file <path>] [--land]
|
|
47
52
|
folds the unreleased section (Unreleased) into the dated
|
|
48
53
|
section below it when that is --version (package.json's), and
|
|
@@ -56,7 +61,8 @@ const USAGE = `usage: cli-dev <command> [options]
|
|
|
56
61
|
to the unreleased section. Prints a line when it changed the
|
|
57
62
|
file. --land lands it on main through a pull request
|
|
58
63
|
adopt <x.y.z> [--package <name>] moves the CLI onto that version of a shared package
|
|
59
|
-
(@wirecat/cli-core): the pin in package.json
|
|
64
|
+
(@wirecat/cli-core): the pin in package.json (for cli-core also
|
|
65
|
+
its x.y.z-dev override in pnpm-workspace.yaml), pnpm install,
|
|
60
66
|
then pnpm generate and ci:quick when the CLI has them
|
|
61
67
|
changelog fragments [--collect <x.y.z>] [--ids <A,B>] [--file <path>]
|
|
62
68
|
checks the changes/<branch>.md fragments (### headings of the
|
|
@@ -108,7 +114,9 @@ const USAGE = `usage: cli-dev <command> [options]
|
|
|
108
114
|
whose modules keep their installed place, as cli-core's do;
|
|
109
115
|
--harmless names a third-party file whose import.meta or
|
|
110
116
|
__dirname was read and found harmless. Fails when a bundled
|
|
111
|
-
module would look for a file or package in the wrong place
|
|
117
|
+
module would look for a file or package in the wrong place.
|
|
118
|
+
A CLI with no exports in package.json loses the .d.ts and .map
|
|
119
|
+
files tsc wrote to dist/, which nothing reads
|
|
112
120
|
${CONFORMANCE_USAGE}
|
|
113
121
|
${READY_USAGE}
|
|
114
122
|
${API_REPORT_USAGE}`;
|
|
@@ -931,18 +939,8 @@ export const main = async (argv, io) => {
|
|
|
931
939
|
io.out(found.version);
|
|
932
940
|
return 0;
|
|
933
941
|
}
|
|
934
|
-
case "version":
|
|
935
|
-
|
|
936
|
-
args,
|
|
937
|
-
options: { sync: { type: "boolean", default: false }, file: { type: "string", default: "src/version.ts" } },
|
|
938
|
-
});
|
|
939
|
-
const { code, message } = versionScript(io.cwd, values.sync ? ["--sync"] : [], values.file);
|
|
940
|
-
if (code === 0)
|
|
941
|
-
io.out(message);
|
|
942
|
-
else
|
|
943
|
-
io.err(message);
|
|
944
|
-
return code;
|
|
945
|
-
}
|
|
942
|
+
case "version":
|
|
943
|
+
return versionCommand(args, io);
|
|
946
944
|
case "changelog":
|
|
947
945
|
return changelog(args, io);
|
|
948
946
|
case "api-report":
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Io {
|
|
2
|
+
cwd: string;
|
|
3
|
+
out: (text: string) => void;
|
|
4
|
+
err: (text: string) => void;
|
|
5
|
+
}
|
|
6
|
+
/** `cli-dev version`: the version in package.json against src/version.ts, then the cli-core override (WC-TOOL-21). */
|
|
7
|
+
export declare const versionCommand: (args: string[], io: Io) => number;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { parseArgs } from "node:util";
|
|
2
|
+
import { versionScript } from "../release/index.js";
|
|
3
|
+
import { coreOverrideCheck } from "./core-override.js";
|
|
4
|
+
/** `cli-dev version`: the version in package.json against src/version.ts, then the cli-core override (WC-TOOL-21). */
|
|
5
|
+
export const versionCommand = (args, io) => {
|
|
6
|
+
const { values } = parseArgs({
|
|
7
|
+
args,
|
|
8
|
+
options: {
|
|
9
|
+
sync: { type: "boolean", default: false },
|
|
10
|
+
file: { type: "string", default: "src/version.ts" },
|
|
11
|
+
"cli-core-only": { type: "boolean", default: false },
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
let code = 0;
|
|
15
|
+
if (!values["cli-core-only"]) {
|
|
16
|
+
const version = versionScript(io.cwd, values.sync ? ["--sync"] : [], values.file);
|
|
17
|
+
code = version.code;
|
|
18
|
+
if (code === 0)
|
|
19
|
+
io.out(version.message);
|
|
20
|
+
else
|
|
21
|
+
io.err(version.message);
|
|
22
|
+
}
|
|
23
|
+
const { problems, notes } = coreOverrideCheck(io.cwd);
|
|
24
|
+
for (const note of notes)
|
|
25
|
+
io.out(note);
|
|
26
|
+
for (const problem of problems)
|
|
27
|
+
io.err(problem);
|
|
28
|
+
return code !== 0 ? code : problems.length > 0 ? 1 : 0;
|
|
29
|
+
};
|
package/dist/wcat/manifest.d.ts
CHANGED
|
@@ -45,6 +45,19 @@ declare const signInSchema: v.StrictObjectSchema<{
|
|
|
45
45
|
readonly stdin: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
46
46
|
readonly site: v.OptionalSchema<v.LiteralSchema<"--site", undefined>, undefined>;
|
|
47
47
|
readonly login: v.OptionalSchema<v.LiteralSchema<"--login", undefined>, undefined>;
|
|
48
|
+
/** The flag that takes a new profile's mail address. */
|
|
49
|
+
readonly address: v.OptionalSchema<v.LiteralSchema<"--address", undefined>, undefined>;
|
|
50
|
+
/** The variable the CLI reads an app password or token from: a flag would show it in the process list. */
|
|
51
|
+
readonly password: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "an upper-case variable name">]>, undefined>;
|
|
52
|
+
/** The flag that takes the person's own OAuth client file, which Desktop writes to a private file for the run. */
|
|
53
|
+
readonly clientFile: v.OptionalSchema<v.LiteralSchema<"--client-file", undefined>, undefined>;
|
|
54
|
+
/** The setting that names the person's own OAuth app, saved before the run: `microsoft_client_id`. */
|
|
55
|
+
readonly clientId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a snake_case setting name">]>, undefined>;
|
|
56
|
+
/** The words that make a new profile sign in in the browser with the CLI's own app: `["--method", "oauth"]`. */
|
|
57
|
+
readonly oauth: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>, undefined>;
|
|
58
|
+
/** The flags for a local application: the portal it signs in to and its id. Its key goes on stdin. */
|
|
59
|
+
readonly portal: v.OptionalSchema<v.LiteralSchema<"--portal", undefined>, undefined>;
|
|
60
|
+
readonly appId: v.OptionalSchema<v.LiteralSchema<"--client-id", undefined>, undefined>;
|
|
48
61
|
}, undefined>, undefined>, v.MinLengthAction<{
|
|
49
62
|
id: string;
|
|
50
63
|
label: string;
|
|
@@ -52,9 +65,25 @@ declare const signInSchema: v.StrictObjectSchema<{
|
|
|
52
65
|
stdin?: boolean | undefined;
|
|
53
66
|
site?: "--site" | undefined;
|
|
54
67
|
login?: "--login" | undefined;
|
|
68
|
+
address?: "--address" | undefined;
|
|
69
|
+
password?: string | undefined;
|
|
70
|
+
clientFile?: "--client-file" | undefined;
|
|
71
|
+
clientId?: string | undefined;
|
|
72
|
+
oauth?: string[] | undefined;
|
|
73
|
+
portal?: "--portal" | undefined;
|
|
74
|
+
appId?: "--client-id" | undefined;
|
|
55
75
|
}[], 1, undefined>]>, undefined>;
|
|
56
76
|
}, undefined>;
|
|
57
77
|
export type SignIn = v.InferOutput<typeof signInSchema>;
|
|
78
|
+
declare const scheduleSchema: v.StrictObjectSchema<{
|
|
79
|
+
/** The interval a new timer starts with; one of `choices`. */
|
|
80
|
+
readonly every: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "minutes or hours: 15m, 1h">]>;
|
|
81
|
+
/** The intervals Desktop offers. */
|
|
82
|
+
readonly choices: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "minutes or hours: 15m, 1h">]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
83
|
+
/** The command the timer runs, without the profile: the schedule's environment names it. */
|
|
84
|
+
readonly args: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
85
|
+
}, undefined>;
|
|
86
|
+
export type SyncSchedule = v.InferOutput<typeof scheduleSchema>;
|
|
58
87
|
/** Exactly the keys of a Desktop catalog entry that the tool itself knows; `null` when unused. */
|
|
59
88
|
declare const desktopSchema: v.StrictObjectSchema<{
|
|
60
89
|
readonly tagline: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "one line of text">, v.MaxLengthAction<string, number, undefined>]>;
|
|
@@ -84,6 +113,19 @@ declare const desktopSchema: v.StrictObjectSchema<{
|
|
|
84
113
|
readonly stdin: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
85
114
|
readonly site: v.OptionalSchema<v.LiteralSchema<"--site", undefined>, undefined>;
|
|
86
115
|
readonly login: v.OptionalSchema<v.LiteralSchema<"--login", undefined>, undefined>;
|
|
116
|
+
/** The flag that takes a new profile's mail address. */
|
|
117
|
+
readonly address: v.OptionalSchema<v.LiteralSchema<"--address", undefined>, undefined>;
|
|
118
|
+
/** The variable the CLI reads an app password or token from: a flag would show it in the process list. */
|
|
119
|
+
readonly password: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "an upper-case variable name">]>, undefined>;
|
|
120
|
+
/** The flag that takes the person's own OAuth client file, which Desktop writes to a private file for the run. */
|
|
121
|
+
readonly clientFile: v.OptionalSchema<v.LiteralSchema<"--client-file", undefined>, undefined>;
|
|
122
|
+
/** The setting that names the person's own OAuth app, saved before the run: `microsoft_client_id`. */
|
|
123
|
+
readonly clientId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a snake_case setting name">]>, undefined>;
|
|
124
|
+
/** The words that make a new profile sign in in the browser with the CLI's own app: `["--method", "oauth"]`. */
|
|
125
|
+
readonly oauth: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>, undefined>;
|
|
126
|
+
/** The flags for a local application: the portal it signs in to and its id. Its key goes on stdin. */
|
|
127
|
+
readonly portal: v.OptionalSchema<v.LiteralSchema<"--portal", undefined>, undefined>;
|
|
128
|
+
readonly appId: v.OptionalSchema<v.LiteralSchema<"--client-id", undefined>, undefined>;
|
|
87
129
|
}, undefined>, undefined>, v.MinLengthAction<{
|
|
88
130
|
id: string;
|
|
89
131
|
label: string;
|
|
@@ -91,6 +133,13 @@ declare const desktopSchema: v.StrictObjectSchema<{
|
|
|
91
133
|
stdin?: boolean | undefined;
|
|
92
134
|
site?: "--site" | undefined;
|
|
93
135
|
login?: "--login" | undefined;
|
|
136
|
+
address?: "--address" | undefined;
|
|
137
|
+
password?: string | undefined;
|
|
138
|
+
clientFile?: "--client-file" | undefined;
|
|
139
|
+
clientId?: string | undefined;
|
|
140
|
+
oauth?: string[] | undefined;
|
|
141
|
+
portal?: "--portal" | undefined;
|
|
142
|
+
appId?: "--client-id" | undefined;
|
|
94
143
|
}[], 1, undefined>]>, undefined>;
|
|
95
144
|
/**
|
|
96
145
|
* Desktop asks `setup show` only from this version on. The manifest ships inside the version it describes, so that
|
|
@@ -103,8 +152,13 @@ declare const desktopSchema: v.StrictObjectSchema<{
|
|
|
103
152
|
readonly install: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
104
153
|
readonly show: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
105
154
|
}, undefined>, undefined>;
|
|
106
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* `port` is a WireCat tool's fixed port, from the identity's `mcpPort`. Desktop gives any other tool a free port of
|
|
157
|
+
* its own and fills `{port}`. Left out, not `null`, without `mcpPort`, so the manifest of every other CLI stays as it
|
|
158
|
+
* was.
|
|
159
|
+
*/
|
|
107
160
|
readonly mcpServer: v.NullableSchema<v.StrictObjectSchema<{
|
|
161
|
+
readonly port: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1024, undefined>, v.MaxValueAction<number, 65535, undefined>]>, undefined>;
|
|
108
162
|
readonly start: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
109
163
|
readonly stop: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
110
164
|
readonly status: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
@@ -118,6 +172,15 @@ declare const desktopSchema: v.StrictObjectSchema<{
|
|
|
118
172
|
readonly lastShape: v.LiteralSchema<"runs", undefined>;
|
|
119
173
|
readonly what: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "one line of text">, v.MaxLengthAction<string, number, undefined>]>;
|
|
120
174
|
readonly note: v.NullSchema<undefined>;
|
|
175
|
+
/** Left out, not `null`, without the identity's `syncSchedule`, so the manifest of every other CLI stays as it was. */
|
|
176
|
+
readonly schedule: v.OptionalSchema<v.StrictObjectSchema<{
|
|
177
|
+
/** The interval a new timer starts with; one of `choices`. */
|
|
178
|
+
readonly every: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "minutes or hours: 15m, 1h">]>;
|
|
179
|
+
/** The intervals Desktop offers. */
|
|
180
|
+
readonly choices: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "minutes or hours: 15m, 1h">]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
181
|
+
/** The command the timer runs, without the profile: the schedule's environment names it. */
|
|
182
|
+
readonly args: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
183
|
+
}, undefined>, undefined>;
|
|
121
184
|
}, undefined>, undefined>;
|
|
122
185
|
readonly storeInfo: v.NullSchema<undefined>;
|
|
123
186
|
readonly storeTables: v.NullSchema<undefined>;
|
|
@@ -219,6 +282,19 @@ export declare const manifestSchema: v.StrictObjectSchema<{
|
|
|
219
282
|
readonly stdin: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
220
283
|
readonly site: v.OptionalSchema<v.LiteralSchema<"--site", undefined>, undefined>;
|
|
221
284
|
readonly login: v.OptionalSchema<v.LiteralSchema<"--login", undefined>, undefined>;
|
|
285
|
+
/** The flag that takes a new profile's mail address. */
|
|
286
|
+
readonly address: v.OptionalSchema<v.LiteralSchema<"--address", undefined>, undefined>;
|
|
287
|
+
/** The variable the CLI reads an app password or token from: a flag would show it in the process list. */
|
|
288
|
+
readonly password: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "an upper-case variable name">]>, undefined>;
|
|
289
|
+
/** The flag that takes the person's own OAuth client file, which Desktop writes to a private file for the run. */
|
|
290
|
+
readonly clientFile: v.OptionalSchema<v.LiteralSchema<"--client-file", undefined>, undefined>;
|
|
291
|
+
/** The setting that names the person's own OAuth app, saved before the run: `microsoft_client_id`. */
|
|
292
|
+
readonly clientId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "a snake_case setting name">]>, undefined>;
|
|
293
|
+
/** The words that make a new profile sign in in the browser with the CLI's own app: `["--method", "oauth"]`. */
|
|
294
|
+
readonly oauth: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>, undefined>;
|
|
295
|
+
/** The flags for a local application: the portal it signs in to and its id. Its key goes on stdin. */
|
|
296
|
+
readonly portal: v.OptionalSchema<v.LiteralSchema<"--portal", undefined>, undefined>;
|
|
297
|
+
readonly appId: v.OptionalSchema<v.LiteralSchema<"--client-id", undefined>, undefined>;
|
|
222
298
|
}, undefined>, undefined>, v.MinLengthAction<{
|
|
223
299
|
id: string;
|
|
224
300
|
label: string;
|
|
@@ -226,6 +302,13 @@ export declare const manifestSchema: v.StrictObjectSchema<{
|
|
|
226
302
|
stdin?: boolean | undefined;
|
|
227
303
|
site?: "--site" | undefined;
|
|
228
304
|
login?: "--login" | undefined;
|
|
305
|
+
address?: "--address" | undefined;
|
|
306
|
+
password?: string | undefined;
|
|
307
|
+
clientFile?: "--client-file" | undefined;
|
|
308
|
+
clientId?: string | undefined;
|
|
309
|
+
oauth?: string[] | undefined;
|
|
310
|
+
portal?: "--portal" | undefined;
|
|
311
|
+
appId?: "--client-id" | undefined;
|
|
229
312
|
}[], 1, undefined>]>, undefined>;
|
|
230
313
|
/**
|
|
231
314
|
* Desktop asks `setup show` only from this version on. The manifest ships inside the version it describes, so that
|
|
@@ -238,8 +321,13 @@ export declare const manifestSchema: v.StrictObjectSchema<{
|
|
|
238
321
|
readonly install: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
239
322
|
readonly show: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
240
323
|
}, undefined>, undefined>;
|
|
241
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* `port` is a WireCat tool's fixed port, from the identity's `mcpPort`. Desktop gives any other tool a free port of
|
|
326
|
+
* its own and fills `{port}`. Left out, not `null`, without `mcpPort`, so the manifest of every other CLI stays as it
|
|
327
|
+
* was.
|
|
328
|
+
*/
|
|
242
329
|
readonly mcpServer: v.NullableSchema<v.StrictObjectSchema<{
|
|
330
|
+
readonly port: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1024, undefined>, v.MaxValueAction<number, 65535, undefined>]>, undefined>;
|
|
243
331
|
readonly start: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
244
332
|
readonly stop: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
245
333
|
readonly status: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
@@ -253,6 +341,15 @@ export declare const manifestSchema: v.StrictObjectSchema<{
|
|
|
253
341
|
readonly lastShape: v.LiteralSchema<"runs", undefined>;
|
|
254
342
|
readonly what: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "one line of text">, v.MaxLengthAction<string, number, undefined>]>;
|
|
255
343
|
readonly note: v.NullSchema<undefined>;
|
|
344
|
+
/** Left out, not `null`, without the identity's `syncSchedule`, so the manifest of every other CLI stays as it was. */
|
|
345
|
+
readonly schedule: v.OptionalSchema<v.StrictObjectSchema<{
|
|
346
|
+
/** The interval a new timer starts with; one of `choices`. */
|
|
347
|
+
readonly every: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "minutes or hours: 15m, 1h">]>;
|
|
348
|
+
/** The intervals Desktop offers. */
|
|
349
|
+
readonly choices: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "minutes or hours: 15m, 1h">]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
350
|
+
/** The command the timer runs, without the profile: the schedule's environment names it. */
|
|
351
|
+
readonly args: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100, "a command word is at most 100 characters">, v.RegexAction<string, (issue: v.RegexIssue<string>) => string>]>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
352
|
+
}, undefined>, undefined>;
|
|
256
353
|
}, undefined>, undefined>;
|
|
257
354
|
readonly storeInfo: v.NullSchema<undefined>;
|
|
258
355
|
readonly storeTables: v.NullSchema<undefined>;
|
|
@@ -316,6 +413,27 @@ export interface ManifestIdentity extends WcatTool {
|
|
|
316
413
|
* `meetings show` and `meetings transcript`; Desktop opens a client's call with them.
|
|
317
414
|
*/
|
|
318
415
|
meetingsProvider?: string;
|
|
416
|
+
/**
|
|
417
|
+
* The sync Desktop runs, when the CLI has no root `sync` and several `<noun> sync` commands: the command and its
|
|
418
|
+
* flags, without the profile: `["messages", "sync", "--all", "--timeout", "120m"]`. Without it such a CLI states no
|
|
419
|
+
* sync. Needs `syncs`.
|
|
420
|
+
*/
|
|
421
|
+
syncCommand?: readonly string[];
|
|
422
|
+
/**
|
|
423
|
+
* Desktop's timer for the sync, run through cli-core's `schedule command`: the interval a new timer starts with, the
|
|
424
|
+
* intervals it offers, and the command when it differs from the sync's own (`args`, without the profile).
|
|
425
|
+
*/
|
|
426
|
+
syncSchedule?: {
|
|
427
|
+
every: string;
|
|
428
|
+
choices: readonly string[];
|
|
429
|
+
args?: readonly string[];
|
|
430
|
+
};
|
|
431
|
+
/**
|
|
432
|
+
* The fixed port of the CLI's MCP server in WireCat Desktop: 8765. Only WireCat's own tools set it, each a port no
|
|
433
|
+
* other tool has; Desktop gives every other tool one of its own. Needs `mcp server start`, `stop`, `status` and
|
|
434
|
+
* `mcp revoke`.
|
|
435
|
+
*/
|
|
436
|
+
mcpPort?: number;
|
|
319
437
|
/**
|
|
320
438
|
* Every host the CLI contacts, as `hostFetch` checks them: `["api.acme.example", "*.cdn.acme.example"]`; `[]` for
|
|
321
439
|
* none. Written to the manifest as `network.hosts`.
|
package/dist/wcat/manifest.js
CHANGED
|
@@ -45,9 +45,10 @@ export const SYNC_QUERY = /^command:"[a-z0-9][a-z0-9-]*(?: [a-z0-9][a-z0-9-]*)+"
|
|
|
45
45
|
const lastWords = v.pipe(v.array(v.union([plainWord, v.pipe(v.string(), v.regex(SYNC_QUERY))])), v.minLength(1));
|
|
46
46
|
const line = (max) => v.pipe(v.string(), v.regex(/^\S(?:[^\n\r]*\S)?$/, "one line of text"), v.maxLength(max));
|
|
47
47
|
/**
|
|
48
|
-
* A sign-in Desktop runs in its own window
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* A sign-in Desktop runs in its own window: the words, whether the secret the person types is the command's whole
|
|
49
|
+
* stdin, and for cli-core's application password sign-in the flags that take the site and the user name Desktop asks
|
|
50
|
+
* for. The other flags and names say where Desktop passes what the person typed. Desktop takes them only from
|
|
51
|
+
* WireCat's own tools, so a tool it did not build keeps to the words, `stdin`, `site` and `login`.
|
|
51
52
|
*/
|
|
52
53
|
const signInMethodSchema = v.strictObject({
|
|
53
54
|
id: v.pipe(v.string(), v.regex(/^[a-z][a-z0-9-]{0,31}$/, "a lower-case method id")),
|
|
@@ -58,6 +59,19 @@ const signInMethodSchema = v.strictObject({
|
|
|
58
59
|
stdin: v.optional(v.boolean()),
|
|
59
60
|
site: v.optional(v.literal("--site")),
|
|
60
61
|
login: v.optional(v.literal("--login")),
|
|
62
|
+
/** The flag that takes a new profile's mail address. */
|
|
63
|
+
address: v.optional(v.literal("--address")),
|
|
64
|
+
/** The variable the CLI reads an app password or token from: a flag would show it in the process list. */
|
|
65
|
+
password: v.optional(v.pipe(v.string(), v.regex(/^[A-Z][A-Z0-9_]*$/, "an upper-case variable name"))),
|
|
66
|
+
/** The flag that takes the person's own OAuth client file, which Desktop writes to a private file for the run. */
|
|
67
|
+
clientFile: v.optional(v.literal("--client-file")),
|
|
68
|
+
/** The setting that names the person's own OAuth app, saved before the run: `microsoft_client_id`. */
|
|
69
|
+
clientId: v.optional(v.pipe(v.string(), v.regex(SNAKE_CASE, "a snake_case setting name"))),
|
|
70
|
+
/** The words that make a new profile sign in in the browser with the CLI's own app: `["--method", "oauth"]`. */
|
|
71
|
+
oauth: v.optional(words),
|
|
72
|
+
/** The flags for a local application: the portal it signs in to and its id. Its key goes on stdin. */
|
|
73
|
+
portal: v.optional(v.literal("--portal")),
|
|
74
|
+
appId: v.optional(v.literal("--client-id")),
|
|
61
75
|
});
|
|
62
76
|
const signInSchema = v.strictObject({
|
|
63
77
|
/** What signing in lets the agent do, in a sentence: "Lets your agent read your Acme contacts." */
|
|
@@ -67,6 +81,17 @@ const signInSchema = v.strictObject({
|
|
|
67
81
|
/** Left out when the CLI signs in only at a terminal, so the manifest of every other CLI stays as it was. */
|
|
68
82
|
methods: v.optional(v.pipe(v.array(signInMethodSchema), v.minLength(1))),
|
|
69
83
|
});
|
|
84
|
+
/** The method keys Desktop refuses from a tool it did not build (wirecat-desktop docs/dev/cli-registry.md, rule 4). */
|
|
85
|
+
const OURS_ONLY = ["address", "password", "clientFile", "clientId", "oauth", "portal", "appId"];
|
|
86
|
+
const duration = v.pipe(v.string(), v.regex(/^[1-9][0-9]*[mh]$/, "minutes or hours: 15m, 1h"));
|
|
87
|
+
const scheduleSchema = v.strictObject({
|
|
88
|
+
/** The interval a new timer starts with; one of `choices`. */
|
|
89
|
+
every: duration,
|
|
90
|
+
/** The intervals Desktop offers. */
|
|
91
|
+
choices: v.pipe(v.array(duration), v.minLength(1)),
|
|
92
|
+
/** The command the timer runs, without the profile: the schedule's environment names it. */
|
|
93
|
+
args: words,
|
|
94
|
+
});
|
|
70
95
|
const desktopSignInSchema = v.strictObject({
|
|
71
96
|
...signInSchema.entries,
|
|
72
97
|
/**
|
|
@@ -85,8 +110,13 @@ const desktopSchema = v.strictObject({
|
|
|
85
110
|
setup: v.nullable(words),
|
|
86
111
|
signIn: v.nullable(desktopSignInSchema),
|
|
87
112
|
skill: v.nullable(v.strictObject({ status: words, install: words, show: words })),
|
|
88
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* `port` is a WireCat tool's fixed port, from the identity's `mcpPort`. Desktop gives any other tool a free port of
|
|
115
|
+
* its own and fills `{port}`. Left out, not `null`, without `mcpPort`, so the manifest of every other CLI stays as it
|
|
116
|
+
* was.
|
|
117
|
+
*/
|
|
89
118
|
mcpServer: v.nullable(v.strictObject({
|
|
119
|
+
port: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1024), v.maxValue(65535))),
|
|
90
120
|
start: words,
|
|
91
121
|
stop: words,
|
|
92
122
|
status: words,
|
|
@@ -100,6 +130,8 @@ const desktopSchema = v.strictObject({
|
|
|
100
130
|
lastShape: v.literal("runs"),
|
|
101
131
|
what: line(40),
|
|
102
132
|
note: v.null(),
|
|
133
|
+
/** Left out, not `null`, without the identity's `syncSchedule`, so the manifest of every other CLI stays as it was. */
|
|
134
|
+
schedule: v.optional(scheduleSchema),
|
|
103
135
|
})),
|
|
104
136
|
storeInfo: v.null(),
|
|
105
137
|
storeTables: v.null(),
|
|
@@ -206,9 +238,37 @@ export const buildManifest = ({ identity, commands, pkg, skills }) => {
|
|
|
206
238
|
throw new ManifestError(["no doctor command: Desktop checks every tool with it"]);
|
|
207
239
|
if (!identity.tagline)
|
|
208
240
|
throw new ManifestError(["no tagline: add `tagline`, at most 55 characters, to the identity the manifest reads"]);
|
|
241
|
+
// Arguments may follow a command (`session start qr`), so the longest leading run of words that is one names it.
|
|
242
|
+
const commandAt = (words) => {
|
|
243
|
+
for (let end = words.length; end > 0; end -= 1) {
|
|
244
|
+
const command = at.get(words.slice(0, end).join(" "));
|
|
245
|
+
if (command !== undefined && (command.commands.length === 0 || command.runnable === true))
|
|
246
|
+
return command;
|
|
247
|
+
}
|
|
248
|
+
return undefined;
|
|
249
|
+
};
|
|
250
|
+
const scheduleOf = (schedule, run) => {
|
|
251
|
+
const lacks = ["schedule command", "schedule list", "schedule remove", "schedule run"].filter((path) => !at.has(path));
|
|
252
|
+
if (lacks.length > 0)
|
|
253
|
+
throw new ManifestError([
|
|
254
|
+
`syncSchedule needs ${lacks.map((path) => `\`${path}\``).join(", ")}: Desktop runs them`,
|
|
255
|
+
]);
|
|
256
|
+
if (!schedule.choices.includes(schedule.every))
|
|
257
|
+
throw new ManifestError([`syncSchedule: every ${schedule.every} is not one of its choices`]);
|
|
258
|
+
const args = [...(schedule.args ?? run)];
|
|
259
|
+
if (commandAt(args) === undefined)
|
|
260
|
+
throw new ManifestError([`syncSchedule: \`${args.join(" ")}\` names no command of this CLI`]);
|
|
261
|
+
return { every: schedule.every, choices: [...schedule.choices], args };
|
|
262
|
+
};
|
|
209
263
|
const setupPath = ["setup", "session start"].find((path) => at.has(path));
|
|
210
|
-
const
|
|
264
|
+
const serves = has("mcp server start", "mcp server stop", "mcp server status", "mcp revoke");
|
|
265
|
+
if (identity.mcpPort !== undefined && !serves)
|
|
266
|
+
throw new ManifestError([
|
|
267
|
+
"mcpPort needs `mcp server start`, `stop`, `status` and `mcp revoke`: Desktop runs the server with them",
|
|
268
|
+
]);
|
|
269
|
+
const mcpServer = serves
|
|
211
270
|
? {
|
|
271
|
+
...(identity.mcpPort !== undefined ? { port: identity.mcpPort } : {}),
|
|
212
272
|
start: [
|
|
213
273
|
"mcp",
|
|
214
274
|
"server",
|
|
@@ -226,7 +286,11 @@ export const buildManifest = ({ identity, commands, pkg, skills }) => {
|
|
|
226
286
|
}
|
|
227
287
|
: null;
|
|
228
288
|
const nounSyncs = all.filter((command) => command.path.length === 2 && command.path[1] === "sync");
|
|
229
|
-
const
|
|
289
|
+
const named = identity.syncCommand ? commandAt(identity.syncCommand) : undefined;
|
|
290
|
+
if (identity.syncCommand && named === undefined)
|
|
291
|
+
throw new ManifestError([`syncCommand: \`${identity.syncCommand.join(" ")}\` names no command of this CLI`]);
|
|
292
|
+
const syncPath = named?.path ?? at.get("sync")?.path ?? (nounSyncs.length === 1 ? nounSyncs[0]?.path : undefined);
|
|
293
|
+
const syncWords = identity.syncCommand ?? syncPath ?? [];
|
|
230
294
|
if (syncPath && !identity.syncs)
|
|
231
295
|
throw new ManifestError([
|
|
232
296
|
`no syncs: \`${syncPath.join(" ")}\` exists, so add \`syncs\`, what it copies in at most 40 characters`,
|
|
@@ -235,13 +299,16 @@ export const buildManifest = ({ identity, commands, pkg, skills }) => {
|
|
|
235
299
|
const last = syncPath && has("runs list") ? ["runs", "list", ...query, "--limit", "50", "--no-record", "--json"] : null;
|
|
236
300
|
const sync = syncPath
|
|
237
301
|
? {
|
|
238
|
-
run: [...profile, ...
|
|
302
|
+
run: [...profile, ...syncWords, "--record", "--json"],
|
|
239
303
|
last,
|
|
240
304
|
lastShape: "runs",
|
|
241
305
|
what: identity.syncs,
|
|
242
306
|
note: null,
|
|
307
|
+
...(identity.syncSchedule ? { schedule: scheduleOf(identity.syncSchedule, syncWords) } : {}),
|
|
243
308
|
}
|
|
244
309
|
: null;
|
|
310
|
+
if (identity.syncSchedule && !sync)
|
|
311
|
+
throw new ManifestError(["syncSchedule needs a sync command"]);
|
|
245
312
|
if (identity.meetingsProvider && !has("meetings show", "meetings transcript"))
|
|
246
313
|
throw new ManifestError([
|
|
247
314
|
"meetingsProvider needs `meetings show` and `meetings transcript`: Desktop opens a call with them",
|
|
@@ -300,6 +367,16 @@ export const buildManifest = ({ identity, commands, pkg, skills }) => {
|
|
|
300
367
|
if (lacks.length > 0)
|
|
301
368
|
throw new ManifestError([`signIn method ${method.id}: \`${path}\` takes no ${lacks.join(" or ")}`]);
|
|
302
369
|
}
|
|
370
|
+
const passed = OURS_ONLY.filter((key) => method[key] !== undefined);
|
|
371
|
+
if (passed.length > 0 && !(typeof pkg.name === "string" && pkg.name.startsWith("@wirecat/")))
|
|
372
|
+
throw new ManifestError([
|
|
373
|
+
`signIn method ${method.id}: Desktop takes ${passed.join(", ")} only from WireCat's own @wirecat packages`,
|
|
374
|
+
]);
|
|
375
|
+
const path = rest.slice(0, end + 1).join(" ");
|
|
376
|
+
const flags = [method.address, method.clientFile, method.portal, method.appId].filter((flag) => flag !== undefined);
|
|
377
|
+
const missing = flags.filter((flag) => !takes(path, flag));
|
|
378
|
+
if (missing.length > 0)
|
|
379
|
+
throw new ManifestError([`signIn method ${method.id}: \`${path}\` takes no ${missing.join(" or ")}`]);
|
|
303
380
|
if (rest.some((word) => word.includes("{")))
|
|
304
381
|
throw new ManifestError([`signIn method ${method.id}: {profile} is the only slot Desktop fills in a sign-in`]);
|
|
305
382
|
}
|
package/docs/standards/README.md
CHANGED
|
@@ -27,7 +27,7 @@ the four steps that need a person. A new CLI is ready for its first release when
|
|
|
27
27
|
|
|
28
28
|
| Page | Area id | Rules | What it covers |
|
|
29
29
|
|---|---|---:|---|
|
|
30
|
-
| [Toolchain](toolchain.md) | `TOOL` |
|
|
30
|
+
| [Toolchain](toolchain.md) | `TOOL` | 21 | TypeScript, Biome, grit plugins, size caps, import cycles, spelling, Markdown, Go, cli-core's `-dev` override |
|
|
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
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 |
|
|
@@ -384,10 +384,12 @@ The references, each for its own part:
|
|
|
384
384
|
|
|
385
385
|
A CLI ships `contracts/wirecat.json` (`wcat_manifest: 2`), written by `cli-dev manifest` from its command tree and
|
|
386
386
|
its identity, never by hand. The developer types only `tagline`, `signIn`, with a sync
|
|
387
|
-
command `syncs`, and for
|
|
387
|
+
command `syncs` (with several `<noun> sync` commands also `syncCommand`, and for a timer `syncSchedule`), and for
|
|
388
|
+
saved calls or meetings `meetingsProvider`; the
|
|
388
389
|
commands, their `summary`, `effects` and `entity`, the fields of each entity a query covers, and every command word in
|
|
389
390
|
`desktop` are derived, and every word passes Desktop's plain-word rule. The hosts it contacts are typed too
|
|
390
|
-
([WC-CMD-32](#wc-cmd-32--declare-every-host-the-cli-contacts-and-reach-them-only-through-hostfetch)). The file holds nothing that changes per release (no version)
|
|
391
|
+
([WC-CMD-32](#wc-cmd-32--declare-every-host-the-cli-contacts-and-reach-them-only-through-hostfetch)). The file holds nothing that changes per release (no version). It holds an MCP port only for a WireCat tool, from
|
|
392
|
+
`mcpPort`, one port per tool. Desktop assigns every other tool a port of its own. With the
|
|
391
393
|
file shipped, `--wcat-describe` answers format 2: the format-1 keys with `"wcat_describe": 2`, the file's `desktop`
|
|
392
394
|
and `manifest_sha256` of its bytes. Without it the answer stays format 1.
|
|
393
395
|
|
|
@@ -122,8 +122,9 @@ installing that command; nothing else is registered anywhere.
|
|
|
122
122
|
is stale. `wcatStart` reads the shipped file for `--wcat-describe`, so the bin needs only the format-1 fields and
|
|
123
123
|
keeps the program out of its first import. List `contracts/wirecat.json`, not all of `contracts`, in `files`
|
|
124
124
|
([WC-REL-16](releases.md#wc-rel-16--the-package-ships-only-the-files-it-names)). A CLI with a
|
|
125
|
-
`sync` command also sets `syncs`, what it copies in at most 40 characters. The file holds no version
|
|
126
|
-
`mcpServer`
|
|
125
|
+
`sync` command also sets `syncs`, what it copies in at most 40 characters. The file holds no version: Desktop reads it from npm.
|
|
126
|
+
`mcpServer` has a port only when the identity sets `mcpPort`, for a WireCat tool with a fixed port. Desktop gives
|
|
127
|
+
any other tool a free port. A command the manifest lists
|
|
127
128
|
without `effects` counts as a write; `permissionOf` adds each command's permission key. See
|
|
128
129
|
[WC-CMD-29](commands.md#wc-cmd-29--answer---wcat-describe-and-take-no-name-wirecat-reserves).
|
|
129
130
|
- **The hosts it talks to.** `hosts` lists every host the CLI contacts (`[]` for none), and `userHosts` says in words
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
How a repository is built and checked before review: the shared presets and `standards:check`, strict TypeScript,
|
|
8
8
|
the shared Biome preset and its grit plugins, the file size cap, import cycles, layer boundaries as lint, the command
|
|
9
|
-
lint, spelling, Markdown lint,
|
|
9
|
+
lint, spelling, Markdown lint, the checks for a Go part, and the root override that gives a CLI cli-core's types.
|
|
10
10
|
|
|
11
11
|
Rule ids on this page are `WC-TOOL-<n>`. How to read a rule, how ids work and which rule wins are in the
|
|
12
12
|
[index](README.md). What runs on which trigger is on the [CI page](ci.md).
|
|
@@ -267,6 +267,30 @@ no-unbounded-spread ([WC-TOOL-12](#wc-tool-12--do-not-spread-a-list-of-user-data
|
|
|
267
267
|
- **Exceptions:** none.
|
|
268
268
|
- **Applies to:** CLIs with a Go part (wa). **Since:** cli-base 0.44.0. **Rulings:** none.
|
|
269
269
|
|
|
270
|
+
### WC-TOOL-21 · Pin cli-core `X.Y.Z` and override it to `X.Y.Z-dev` at the root
|
|
271
|
+
|
|
272
|
+
- **Why:** the `X.Y.Z` of `@wirecat/cli-core` that users install has no type files, so they do not download 12.5 MB
|
|
273
|
+
that only a compiler reads. Every release also publishes `X.Y.Z-dev`: the same JavaScript with the `.d.ts` files,
|
|
274
|
+
their maps, the JavaScript maps and `src/`. pnpm reads `pnpm-workspace.yaml` only in the project it installs, and
|
|
275
|
+
npm and Bun never read it, so the CLI's checkout gets `-dev` and its users still get `X.Y.Z`.
|
|
276
|
+
- **Enforced by:** `node-ci.yml:check` (right after install, before typecheck) · `<app>: pnpm version:check` (cli-dev
|
|
277
|
+
version) · `src/dev/core-override.test.ts`.
|
|
278
|
+
- **Example:** `package.json` has `"@wirecat/cli-core": "2.1.0"` under `dependencies`, and `pnpm-workspace.yaml` has
|
|
279
|
+
|
|
280
|
+
```yaml
|
|
281
|
+
overrides:
|
|
282
|
+
"@wirecat/cli-core": 2.1.0-dev
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Without the override, `pnpm typecheck` fails with TS7016, "Could not find a declaration file for module
|
|
286
|
+
'@wirecat/cli-core'", and `cli-dev version` fails with the line to add. With an override to another version, every
|
|
287
|
+
check runs against a cli-core the users never get, and `cli-dev version` names the line to change. The fix is that
|
|
288
|
+
line, then `pnpm install`. `cli-dev adopt <x.y.z>` moves the pin and the override together.
|
|
289
|
+
- **Exceptions:** cli-core itself, and a repository with no `bin` or with cli-core only in `devDependencies`
|
|
290
|
+
(cli-docs). A cli-core released before the `-dev` releases has no `-dev` and still ships its types; while a CLI
|
|
291
|
+
pins one, `cli-dev version` only notes the missing override.
|
|
292
|
+
- **Applies to:** the CLIs and cli-template. **Since:** cli-base 1.2.0. **Rulings:** NEED-10.
|
|
293
|
+
|
|
270
294
|
## Sources
|
|
271
295
|
|
|
272
296
|
These documents explain the rules on this page in more detail. Where one of them disagrees with this page, this page
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.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",
|
|
@@ -103,6 +103,10 @@
|
|
|
103
103
|
"types": "./dist/wcat/manifest.d.ts",
|
|
104
104
|
"default": "./dist/wcat/manifest.js"
|
|
105
105
|
},
|
|
106
|
+
"./dev": {
|
|
107
|
+
"types": "./dist/dev/index.d.ts",
|
|
108
|
+
"default": "./dist/dev/index.js"
|
|
109
|
+
},
|
|
106
110
|
"./biome": "./config/biome.base.json",
|
|
107
111
|
"./tsconfig.base.json": "./config/tsconfig.base.json",
|
|
108
112
|
"./tsconfig.test.json": "./config/tsconfig.test.json",
|