@wirecat/cli-base 0.90.0 → 0.91.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 +20 -0
- package/dist/dev/audit.js +10 -4
- package/dist/dev/lint.d.ts +2 -0
- package/dist/dev/lint.js +6 -4
- package/dist/standards/flags-crm.js +7 -0
- package/dist/standards/flags-what.js +1 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,26 @@ 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.91.0 — 08.11.2026
|
|
12
|
+
|
|
13
|
+
### Changed — may break callers
|
|
14
|
+
|
|
15
|
+
- **A charge's repeat is `--period <count-unit>`, and `--every` takes only `<duration>` again.** Flag
|
|
16
|
+
`--period` (`value`, a count and a calendar unit such as `1-month`) is how often a charge repeats. `--every` lost
|
|
17
|
+
its second value kind `<count-unit>`: one flag with two kinds of value is what `cli-dev audit`'s `same-flag-meaning`
|
|
18
|
+
exists to catch, and memo's `subscriptions --every` failed it beside drive, gcal, mail, max and tg. A CLI that gives
|
|
19
|
+
`--every` a `<count-unit>` now fails `flag-two-meanings` in `cli-dev lint`: rename it to `--period`. memo is the only
|
|
20
|
+
one.
|
|
21
|
+
|
|
22
|
+
## 0.90.1 — 08.11.2026
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **`cli-dev audit` takes every kind of value the vocabulary gives a flag as the same meaning.** `same-flag-meaning`
|
|
27
|
+
reported `--every` once memo took both `<count-unit>` and `<duration>` while the other CLIs took `<duration>`, though
|
|
28
|
+
the vocabulary allows both; every CLI in memo's parity group then failed its audit. A kind the vocabulary does not
|
|
29
|
+
list for that flag is still reported.
|
|
30
|
+
|
|
11
31
|
## 0.90.0 — 08.11.2026
|
|
12
32
|
|
|
13
33
|
### Changed — may break callers
|
package/dist/dev/audit.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AUDIT_RULES } from "../standards/audit.js";
|
|
|
2
2
|
import { BASE_REASONS } from "../standards/errors.js";
|
|
3
3
|
import { LINT_RULES, OVERRIDE_BUDGET } from "../standards/lint.js";
|
|
4
4
|
import { capabilityDifference } from "./capabilities.js";
|
|
5
|
-
import { judge, kindOf, lintCommands, longName, summaryOf, walk } from "./lint.js";
|
|
5
|
+
import { judge, kindOf, lintCommands, longName, registeredKinds, summaryOf, walk } from "./lint.js";
|
|
6
6
|
import { sharedContractProblems } from "./shared-contracts.js";
|
|
7
7
|
const STRICT_CONTRACT_RULES = new Set([
|
|
8
8
|
"shared-command-contract",
|
|
@@ -98,7 +98,8 @@ const samePathContract = (inputs, groups) => {
|
|
|
98
98
|
}
|
|
99
99
|
return found;
|
|
100
100
|
};
|
|
101
|
-
const sameFlagMeaning = (inputs) => {
|
|
101
|
+
const sameFlagMeaning = (inputs, vocabulary) => {
|
|
102
|
+
const registered = registeredKinds(vocabulary);
|
|
102
103
|
const uses = new Map();
|
|
103
104
|
for (const { document } of inputs) {
|
|
104
105
|
const options = [
|
|
@@ -120,7 +121,12 @@ const sameFlagMeaning = (inputs) => {
|
|
|
120
121
|
.sort(([a], [b]) => byText(a, b))
|
|
121
122
|
.flatMap(([flag, byCli]) => {
|
|
122
123
|
const signatures = new Map([...byCli].map(([cli, kinds]) => [cli, [...kinds].sort(byText).join(" | ")]));
|
|
123
|
-
|
|
124
|
+
const allowed = new Set((registered.get(flag) ?? []).map(shownKind));
|
|
125
|
+
const off = new Set([...byCli.values()].map((kinds) => [...kinds]
|
|
126
|
+
.filter((kind) => !allowed.has(kind))
|
|
127
|
+
.sort(byText)
|
|
128
|
+
.join(" | ")));
|
|
129
|
+
if (byCli.size < 2 || off.size < 2)
|
|
124
130
|
return [];
|
|
125
131
|
const clis = [...byCli.keys()].sort(byText);
|
|
126
132
|
return [{ rule: "same-flag-meaning", clis, target: `${named(clis)} ${flag}`, message: describe(signatures) }];
|
|
@@ -195,7 +201,7 @@ const CROSS = {
|
|
|
195
201
|
: []),
|
|
196
202
|
"required-root": (inputs, options) => requiredRoots(inputs, options.roots),
|
|
197
203
|
"same-path-contract": (inputs, options) => samePathContract(inputs, options.groups),
|
|
198
|
-
"same-flag-meaning": (inputs) => sameFlagMeaning(inputs),
|
|
204
|
+
"same-flag-meaning": (inputs, options) => sameFlagMeaning(inputs, options.vocabulary),
|
|
199
205
|
"same-entity-schema": (inputs) => sameEntitySchema(inputs),
|
|
200
206
|
"same-error-reason": (inputs) => sameErrorReason(inputs),
|
|
201
207
|
};
|
package/dist/dev/lint.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare const longName: (flags: string) => string;
|
|
|
15
15
|
/** A flag's kind of value: its value name, or `switch`. Two kinds under one name are two meanings. */
|
|
16
16
|
export declare const kindOf: (option: OptionInfo) => string;
|
|
17
17
|
export { summaryOf };
|
|
18
|
+
/** The kinds of value the vocabulary lets each flag take: its own value, or `switch`, then its `otherValues`. */
|
|
19
|
+
export declare const registeredKinds: (vocabulary: Vocabulary) => Map<string, string[]>;
|
|
18
20
|
export interface LintContext {
|
|
19
21
|
/** The commands document as the CLI printed it; parsing drops keys it does not know, so casing is checked here. */
|
|
20
22
|
raw?: unknown;
|
package/dist/dev/lint.js
CHANGED
|
@@ -26,6 +26,11 @@ export const kindOf = (option) => {
|
|
|
26
26
|
return option.flags.match(/[<[]([^>\]]+)[>\]]/)?.[1]?.toLowerCase() ?? "value";
|
|
27
27
|
};
|
|
28
28
|
export { summaryOf };
|
|
29
|
+
/** The kinds of value the vocabulary lets each flag take: its own value, or `switch`, then its `otherValues`. */
|
|
30
|
+
export const registeredKinds = (vocabulary) => new Map(vocabulary.flags.map((flag) => [
|
|
31
|
+
flag.name,
|
|
32
|
+
[flag.value?.slice(1, -1).toLowerCase() ?? "switch", ...(flag.otherValues ?? [])],
|
|
33
|
+
]));
|
|
29
34
|
const label = (command) => command.path.join(" ");
|
|
30
35
|
/** The run log's reader and its switches; what `runsCommand` and cli-core's shared program add. */
|
|
31
36
|
export const RUN_LOG_COMMANDS = ["runs list", "runs show"];
|
|
@@ -231,10 +236,7 @@ const CHECKS = {
|
|
|
231
236
|
}));
|
|
232
237
|
},
|
|
233
238
|
"flag-two-meanings": (document, vocabulary) => {
|
|
234
|
-
const registered =
|
|
235
|
-
flag.name,
|
|
236
|
-
[flag.value?.slice(1, -1).toLowerCase() ?? "switch", ...(flag.otherValues ?? [])],
|
|
237
|
-
]));
|
|
239
|
+
const registered = registeredKinds(vocabulary);
|
|
238
240
|
const uses = new Map();
|
|
239
241
|
const note = (option, where) => {
|
|
240
242
|
const name = longName(option.flags);
|
|
@@ -102,6 +102,13 @@ export const CRM_FLAGS = [
|
|
|
102
102
|
type: "choice",
|
|
103
103
|
meaning: "it renews by itself at its end, or it does not",
|
|
104
104
|
},
|
|
105
|
+
{
|
|
106
|
+
name: "--period",
|
|
107
|
+
value: "<count-unit>",
|
|
108
|
+
role: "value",
|
|
109
|
+
type: "duration",
|
|
110
|
+
meaning: "how often a charge repeats: a count and a calendar unit, such as 1-month",
|
|
111
|
+
},
|
|
105
112
|
{
|
|
106
113
|
name: "--opening-balance",
|
|
107
114
|
value: "<decimal>",
|
|
@@ -736,14 +736,7 @@ export const WHAT_FLAGS = [
|
|
|
736
736
|
type: "id",
|
|
737
737
|
meaning: "the stored calendar event it is linked to, or none to unlink",
|
|
738
738
|
},
|
|
739
|
-
{
|
|
740
|
-
name: "--every",
|
|
741
|
-
value: "<duration>",
|
|
742
|
-
role: "value",
|
|
743
|
-
type: "duration",
|
|
744
|
-
otherValues: ["count-unit"],
|
|
745
|
-
meaning: "repeat this often: a length of time for a timer (<duration>), a count and a calendar unit for a charge, such as 1-month (<count-unit>)",
|
|
746
|
-
},
|
|
739
|
+
{ name: "--every", value: "<duration>", role: "value", type: "duration", meaning: "repeat this often" },
|
|
747
740
|
{
|
|
748
741
|
name: "--evidence",
|
|
749
742
|
value: "<ref...>",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.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",
|