@rrlab/cli 1.0.1-git-e008b4d.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.usage.kdl +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/plugin.d.mts +1 -1
- package/dist/run.mjs +18 -41
- package/dist/{types-6gZWuLJf.d.mts → types-snfbujDH.d.mts} +5 -7
- package/package.json +2 -2
- package/src/program/board.ts +7 -20
- package/src/program/commands/check.ts +13 -24
- package/src/program/composed-jsc.ts +5 -9
- package/src/types/tool.ts +5 -7
package/dist/cli.usage.kdl
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @generated by @usage-spec/commander from Commander.js metadata
|
|
2
2
|
name rr
|
|
3
3
|
bin rr
|
|
4
|
-
version "1.
|
|
4
|
+
version "1.1.0"
|
|
5
5
|
usage "<command...> [options...]"
|
|
6
6
|
flag --usage help="print KDL spec for this CLI (https://kdl.dev)"
|
|
7
7
|
cmd completion help="print shell completion script (usage)" {
|
package/dist/config.d.mts
CHANGED
package/dist/plugin.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as StaticChecker, D as ReleaseService, E as TypeChecker, O as ReleaseServiceOptions, S as RunReport, T as TypeCheckOptions, _ as Doctor, a as InstallFlags, b as LintOptions, c as PLUGIN_KINDS, d as PluginCapabilities, f as PluginContext, g as UninstallResult, h as UninstallFlags, i as InstallContext, l as Packer, m as UninstallContext, n as ClackPromptsSelectOption, o as InstallResult, p as PluginKind, r as FileOp, s as JsonEdit, t as ClackPrompts, u as Plugin, v as FormatOptions, w as StaticCheckerOptions, x as Linter, y as Formatter } from "./types-
|
|
1
|
+
import { C as StaticChecker, D as ReleaseService, E as TypeChecker, O as ReleaseServiceOptions, S as RunReport, T as TypeCheckOptions, _ as Doctor, a as InstallFlags, b as LintOptions, c as PLUGIN_KINDS, d as PluginCapabilities, f as PluginContext, g as UninstallResult, h as UninstallFlags, i as InstallContext, l as Packer, m as UninstallContext, n as ClackPromptsSelectOption, o as InstallResult, p as PluginKind, r as FileOp, s as JsonEdit, t as ClackPrompts, u as Plugin, v as FormatOptions, w as StaticCheckerOptions, x as Linter, y as Formatter } from "./types-snfbujDH.mjs";
|
|
2
2
|
import { ShellService } from "@vlandoss/clibuddy";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/decide-scaffold.d.ts
|
package/dist/run.mjs
CHANGED
|
@@ -164,29 +164,19 @@ function commandTool(command, provider) {
|
|
|
164
164
|
function pkgName(appPkg) {
|
|
165
165
|
return appPkg.packageJson.name ?? basename(appPkg.dirPath);
|
|
166
166
|
}
|
|
167
|
-
/**
|
|
168
|
-
* The one canonical row label for a single-target run: `<command> (<tool>) · <package>`.
|
|
169
|
-
* Every command/subcommand that acts on one target (lint, format, jsc, pack,
|
|
170
|
-
* single-app tsc, a `doctor` subcommand) builds its row through here so they
|
|
171
|
-
* all read identically.
|
|
172
|
-
*/
|
|
167
|
+
/** The canonical single-target row label, `<command> (<tool>) · <package>`, so every command reads alike. */
|
|
173
168
|
function targetLabel(command, provider, appPkg) {
|
|
174
169
|
return `${commandTool(command, provider)} ${palette.dim(`· ${pkgName(appPkg)}`)}`;
|
|
175
170
|
}
|
|
176
171
|
/**
|
|
177
|
-
* The
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* the per-unit name.
|
|
172
|
+
* The canonical fan-out section title, `<command> (<tool>) · <n> <unit>`. The
|
|
173
|
+
* tool is omitted when the fan-out spans several tools (`rr doctor` → `doctor ·
|
|
174
|
+
* 3 tools`), since the rows then carry the per-tool name.
|
|
181
175
|
*/
|
|
182
176
|
function fanoutTitle(command, provider, count, unit) {
|
|
183
177
|
return `${provider ? commandTool(command, provider) : command} · ${count} ${unit}`;
|
|
184
178
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Bridges a check-family verb (which returns a `RunReport`) to a board row.
|
|
187
|
-
* The row's spinner reflects the in-flight run; the captured `output` becomes
|
|
188
|
-
* the detail the board flushes grouped under the label.
|
|
189
|
-
*/
|
|
179
|
+
/** Bridges a check-family verb (returns a `RunReport`) to a board row, its `output` becoming the flushed detail. */
|
|
190
180
|
function reportTask(label, run) {
|
|
191
181
|
return {
|
|
192
182
|
label,
|
|
@@ -283,17 +273,11 @@ ${runRunColor(`
|
|
|
283
273
|
//#endregion
|
|
284
274
|
//#region src/program/commands/check.ts
|
|
285
275
|
/**
|
|
286
|
-
* `rr check`
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* applies its declared option defaults exactly as if the user had typed
|
|
292
|
-
* `rr jsc` directly.
|
|
293
|
-
*
|
|
294
|
-
* Commander binds the running command as `this` inside an action (see
|
|
295
|
-
* `command.js` — `fn.apply(this, actionArgs)`). `this.parent` gives us the
|
|
296
|
-
* parent program without any late-binding ceremony.
|
|
276
|
+
* `rr check` runs `jsc` then `tsc`. Rather than keep a parallel action
|
|
277
|
+
* registry, it reuses commander's command tree: it finds each sibling on
|
|
278
|
+
* `this.parent` and runs it via `parseAsync([])`, which applies the sibling's
|
|
279
|
+
* own option defaults. (`this` is the running command inside a non-arrow
|
|
280
|
+
* action — see cli/CLAUDE.md.)
|
|
297
281
|
*/
|
|
298
282
|
function createCheckCommand(ctx) {
|
|
299
283
|
return createCommand("check").summary(`run static checks${checkAnnotation(ctx)}`).description("Runs `rr jsc` then `rr tsc` in-process, each as its own section. Aggregates their exit codes — non-zero when either subcommand fails.").action(async function checkAction() {
|
|
@@ -336,12 +320,9 @@ function findCommand(program, name) {
|
|
|
336
320
|
return program.commands.find((c) => c.name() === name || c.aliases().includes(name));
|
|
337
321
|
}
|
|
338
322
|
/**
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
* neither sibling has a provider, falls back to the standard `(not
|
|
343
|
-
* configured)` annotation so the help reads consistently with other
|
|
344
|
-
* commands.
|
|
323
|
+
* Flattens the underlying tool labels of `jsc` + `tsc` for the help summary —
|
|
324
|
+
* e.g. `(biome, oxlint)`, deduped, not `(biome + biome, oxlint)`. Falls back to
|
|
325
|
+
* the standard `(not configured)` when neither sibling has a provider.
|
|
345
326
|
*/
|
|
346
327
|
function checkAnnotation(ctx) {
|
|
347
328
|
const directJsc = ctx.registry.get("jsc");
|
|
@@ -475,15 +456,11 @@ function createFormatCommand(ctx) {
|
|
|
475
456
|
//#endregion
|
|
476
457
|
//#region src/program/composed-jsc.ts
|
|
477
458
|
/**
|
|
478
|
-
* Synthesises
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
* The check runs lint then format sequentially — interleaved stdout from a
|
|
484
|
-
* parallel run is hard to read for the user — and merges their reports into one
|
|
485
|
-
* so the board renders the pair as a single row. `fixStaged` is dropped because
|
|
486
|
-
* the underlying tools don't have a uniform staged-aware mode.
|
|
459
|
+
* Synthesises the `jsc` capability (`StaticChecker & Doctor`) by composing a
|
|
460
|
+
* separately-registered linter and formatter — used when the plugin set
|
|
461
|
+
* provides `lint` and `format` independently (e.g. oxc) but no plugin claims
|
|
462
|
+
* `jsc`. Runs lint then format sequentially (parallel stdout interleaves badly)
|
|
463
|
+
* and merges their reports into one board row.
|
|
487
464
|
*/
|
|
488
465
|
function composedJscProvider(linter, formatter) {
|
|
489
466
|
return {
|
|
@@ -28,13 +28,11 @@ declare class ReleaseService {
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/types/tool.d.ts
|
|
30
30
|
/**
|
|
31
|
-
* The outcome of
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* combined
|
|
35
|
-
* under the package label.
|
|
36
|
-
* warning/error counts: the formats are unstable and not uniform across tools
|
|
37
|
-
* (tsc and oxfmt have no machine output at all). See decisions/013.
|
|
31
|
+
* The outcome of a check-family tool (lint / format / static check / type
|
|
32
|
+
* check) captured rather than streamed. `ok` is the tool's exit code — never a
|
|
33
|
+
* guess parsed from output, since tool summaries are unstable and not uniform
|
|
34
|
+
* (tsc and oxfmt emit none) — and `output` is the combined stdout+stderr (color
|
|
35
|
+
* preserved), flushed verbatim under the package label. See decisions/013.
|
|
38
36
|
*/
|
|
39
37
|
type RunReport = {
|
|
40
38
|
ok: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rrlab/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "The CLI toolbox to fullstack common scripts in Variable Land",
|
|
5
5
|
"homepage": "https://github.com/variableland/dx/tree/main/run-run/cli#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"memoize": "10.2.0",
|
|
57
57
|
"nypm": "0.6.0",
|
|
58
58
|
"rimraf": "6.1.3",
|
|
59
|
-
"@vlandoss/clibuddy": "0.
|
|
59
|
+
"@vlandoss/clibuddy": "0.7.0",
|
|
60
60
|
"@vlandoss/loggy": "0.2.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
package/src/program/board.ts
CHANGED
|
@@ -17,32 +17,22 @@ function pkgName(appPkg: Pkg): string {
|
|
|
17
17
|
return appPkg.packageJson.name ?? basename(appPkg.dirPath);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* The one canonical row label for a single-target run: `<command> (<tool>) · <package>`.
|
|
22
|
-
* Every command/subcommand that acts on one target (lint, format, jsc, pack,
|
|
23
|
-
* single-app tsc, a `doctor` subcommand) builds its row through here so they
|
|
24
|
-
* all read identically.
|
|
25
|
-
*/
|
|
20
|
+
/** The canonical single-target row label, `<command> (<tool>) · <package>`, so every command reads alike. */
|
|
26
21
|
export function targetLabel(command: string, provider: Provider, appPkg: Pkg): string {
|
|
27
22
|
return `${commandTool(command, provider)} ${palette.dim(`· ${pkgName(appPkg)}`)}`;
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
/**
|
|
31
|
-
* The
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* the per-unit name.
|
|
26
|
+
* The canonical fan-out section title, `<command> (<tool>) · <n> <unit>`. The
|
|
27
|
+
* tool is omitted when the fan-out spans several tools (`rr doctor` → `doctor ·
|
|
28
|
+
* 3 tools`), since the rows then carry the per-tool name.
|
|
35
29
|
*/
|
|
36
30
|
export function fanoutTitle(command: string, provider: Provider | undefined, count: number, unit: string): string {
|
|
37
31
|
const head = provider ? commandTool(command, provider) : command;
|
|
38
32
|
return `${head} · ${count} ${unit}`;
|
|
39
33
|
}
|
|
40
34
|
|
|
41
|
-
/**
|
|
42
|
-
* Bridges a check-family verb (which returns a `RunReport`) to a board row.
|
|
43
|
-
* The row's spinner reflects the in-flight run; the captured `output` becomes
|
|
44
|
-
* the detail the board flushes grouped under the label.
|
|
45
|
-
*/
|
|
35
|
+
/** Bridges a check-family verb (returns a `RunReport`) to a board row, its `output` becoming the flushed detail. */
|
|
46
36
|
export function reportTask(label: string, run: () => Promise<RunReport>): BoardTask {
|
|
47
37
|
return {
|
|
48
38
|
label,
|
|
@@ -53,11 +43,8 @@ export function reportTask(label: string, run: () => Promise<RunReport>): BoardT
|
|
|
53
43
|
};
|
|
54
44
|
}
|
|
55
45
|
|
|
56
|
-
// `rr check`
|
|
57
|
-
//
|
|
58
|
-
// sections — so while check is dispatching, force every board to stay framed.
|
|
59
|
-
// While active, the collector also gathers each section's result in run order
|
|
60
|
-
// so `check` can print one overall verdict.
|
|
46
|
+
// While `rr check` is dispatching, boards stay framed (to divide the sections)
|
|
47
|
+
// and their results land in this collector so `check` can print one verdict.
|
|
61
48
|
let collector: BoardResult[] | null = null;
|
|
62
49
|
|
|
63
50
|
export async function runCheckSections(run: () => Promise<void>): Promise<BoardResult[]> {
|
|
@@ -6,17 +6,11 @@ import type { Context } from "#src/services/ctx.ts";
|
|
|
6
6
|
import { logger } from "#src/services/logger.ts";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* `rr check`
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* applies its declared option defaults exactly as if the user had typed
|
|
15
|
-
* `rr jsc` directly.
|
|
16
|
-
*
|
|
17
|
-
* Commander binds the running command as `this` inside an action (see
|
|
18
|
-
* `command.js` — `fn.apply(this, actionArgs)`). `this.parent` gives us the
|
|
19
|
-
* parent program without any late-binding ceremony.
|
|
9
|
+
* `rr check` runs `jsc` then `tsc`. Rather than keep a parallel action
|
|
10
|
+
* registry, it reuses commander's command tree: it finds each sibling on
|
|
11
|
+
* `this.parent` and runs it via `parseAsync([])`, which applies the sibling's
|
|
12
|
+
* own option defaults. (`this` is the running command inside a non-arrow
|
|
13
|
+
* action — see cli/CLAUDE.md.)
|
|
20
14
|
*/
|
|
21
15
|
export function createCheckCommand(ctx: Context) {
|
|
22
16
|
return createCommand("check")
|
|
@@ -32,13 +26,11 @@ export function createCheckCommand(ctx: Context) {
|
|
|
32
26
|
throw new Error("`rr check` requires the parent program to dispatch sibling subcommands.");
|
|
33
27
|
}
|
|
34
28
|
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// never by a fragile dispatch-vs-render index. A section that runs no
|
|
41
|
-
// board (tsc with no tsconfig) simply reports no results.
|
|
29
|
+
// Sequentially, not in parallel: two live boards can't animate the same
|
|
30
|
+
// terminal region at once (decision 012). Each section runs in its own
|
|
31
|
+
// `runCheckSections` scope, which frames it and returns the boards it
|
|
32
|
+
// rendered — so a failure is attributed by section name, not a fragile
|
|
33
|
+
// dispatch-vs-render index.
|
|
42
34
|
const start = Date.now();
|
|
43
35
|
const failed: string[] = [];
|
|
44
36
|
let rendered = false;
|
|
@@ -85,12 +77,9 @@ function findCommand(program: Command, name: string): Command | undefined {
|
|
|
85
77
|
}
|
|
86
78
|
|
|
87
79
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* neither sibling has a provider, falls back to the standard `(not
|
|
92
|
-
* configured)` annotation so the help reads consistently with other
|
|
93
|
-
* commands.
|
|
80
|
+
* Flattens the underlying tool labels of `jsc` + `tsc` for the help summary —
|
|
81
|
+
* e.g. `(biome, oxlint)`, deduped, not `(biome + biome, oxlint)`. Falls back to
|
|
82
|
+
* the standard `(not configured)` when neither sibling has a provider.
|
|
94
83
|
*/
|
|
95
84
|
function checkAnnotation(ctx: Context): string {
|
|
96
85
|
const directJsc = ctx.registry.get("jsc");
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import type { Doctor, Formatter, Linter, RunReport, StaticChecker, StaticCheckerOptions } from "#src/plugin/types.ts";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Synthesises
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* The check runs lint then format sequentially — interleaved stdout from a
|
|
10
|
-
* parallel run is hard to read for the user — and merges their reports into one
|
|
11
|
-
* so the board renders the pair as a single row. `fixStaged` is dropped because
|
|
12
|
-
* the underlying tools don't have a uniform staged-aware mode.
|
|
4
|
+
* Synthesises the `jsc` capability (`StaticChecker & Doctor`) by composing a
|
|
5
|
+
* separately-registered linter and formatter — used when the plugin set
|
|
6
|
+
* provides `lint` and `format` independently (e.g. oxc) but no plugin claims
|
|
7
|
+
* `jsc`. Runs lint then format sequentially (parallel stdout interleaves badly)
|
|
8
|
+
* and merges their reports into one board row.
|
|
13
9
|
*/
|
|
14
10
|
export function composedJscProvider(linter: Linter & Doctor, formatter: Formatter & Doctor): StaticChecker & Doctor {
|
|
15
11
|
return {
|
package/src/types/tool.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The outcome of
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* combined
|
|
6
|
-
* under the package label.
|
|
7
|
-
* warning/error counts: the formats are unstable and not uniform across tools
|
|
8
|
-
* (tsc and oxfmt have no machine output at all). See decisions/013.
|
|
2
|
+
* The outcome of a check-family tool (lint / format / static check / type
|
|
3
|
+
* check) captured rather than streamed. `ok` is the tool's exit code — never a
|
|
4
|
+
* guess parsed from output, since tool summaries are unstable and not uniform
|
|
5
|
+
* (tsc and oxfmt emit none) — and `output` is the combined stdout+stderr (color
|
|
6
|
+
* preserved), flushed verbatim under the package label. See decisions/013.
|
|
9
7
|
*/
|
|
10
8
|
export type RunReport = {
|
|
11
9
|
ok: boolean;
|