@rrlab/cli 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/README.md +10 -10
- package/bin +3 -5
- package/dist/cli.usage.kdl +26 -25
- package/dist/config.d.mts +1 -1
- package/dist/magic-string.es-BgIV5Mu3.mjs +1011 -0
- package/dist/plugin/__tests__/bin-probe.test.d.mts +1 -0
- package/dist/plugin/__tests__/bin-probe.test.mjs +64 -0
- package/dist/plugin/__tests__/decide-scaffold.test.d.mts +1 -0
- package/dist/plugin/__tests__/decide-scaffold.test.mjs +103 -0
- package/dist/plugin/__tests__/define-plugin.test.d.mts +1 -0
- package/dist/plugin/__tests__/define-plugin.test.mjs +130 -0
- package/dist/plugin/__tests__/pick-preset.test.d.mts +1 -0
- package/dist/plugin/__tests__/pick-preset.test.mjs +72 -0
- package/dist/plugin/__tests__/registry.test.d.mts +1 -0
- package/dist/plugin/__tests__/registry.test.mjs +104 -0
- package/dist/plugin/bin-probe.d.mts +4 -0
- package/dist/plugin/bin-probe.mjs +22 -0
- package/dist/plugin/decide-scaffold.d.mts +18 -0
- package/dist/plugin/decide-scaffold.mjs +36 -0
- package/dist/plugin/define-plugin.d.mts +17 -0
- package/dist/plugin/define-plugin.mjs +25 -0
- package/dist/plugin/directory.d.mts +47 -0
- package/dist/plugin/directory.mjs +45 -0
- package/dist/plugin/errors.d.mts +11 -0
- package/dist/plugin/errors.mjs +15 -0
- package/dist/plugin/index.d.mts +7 -0
- package/dist/plugin/index.mjs +50 -0
- package/dist/plugin/pick-preset.d.mts +13 -0
- package/dist/plugin/pick-preset.mjs +17 -0
- package/dist/plugin/registry.d.mts +19 -0
- package/dist/plugin/registry.mjs +2 -0
- package/dist/plugin/tool-service.d.mts +45 -0
- package/dist/plugin/tool-service.mjs +64 -0
- package/dist/plugin/types.d.mts +3 -0
- package/dist/plugin/types.mjs +1 -0
- package/dist/registry-BgqfKK5L.mjs +55 -0
- package/dist/run.mjs +969 -585
- package/dist/test.DNmyFkvJ-09ScyH13.mjs +13617 -0
- package/dist/tool-DKL6TauZ.d.mts +43 -0
- package/dist/{types-snfbujDH.d.mts → types-Iu4IyWof.d.mts} +11 -75
- package/package.json +6 -5
- package/src/actions/clean.ts +36 -0
- package/src/actions/config.ts +46 -0
- package/src/actions/doctor.ts +47 -0
- package/src/actions/format.ts +13 -0
- package/src/actions/jsc.ts +13 -0
- package/src/actions/lint.ts +13 -0
- package/src/actions/pack.ts +12 -0
- package/src/actions/plugins/add.ts +143 -0
- package/src/actions/plugins/list.ts +27 -0
- package/src/actions/plugins/remove.ts +110 -0
- package/src/actions/plugins/shared.ts +58 -0
- package/src/actions/run-tool.ts +23 -0
- package/src/actions/tsc.ts +65 -0
- package/src/errors/invalid-plugin-module.ts +6 -0
- package/src/errors/missing-plugin.ts +17 -0
- package/src/errors/plugin-api-version.ts +6 -0
- package/src/errors/unknown-plugin.ts +7 -0
- package/src/lib/plugin/define-plugin.ts +56 -0
- package/src/lib/plugin/directory.ts +30 -0
- package/src/lib/plugin/errors.ts +15 -0
- package/src/lib/{plugin.ts → plugin/index.ts} +8 -9
- package/src/lib/plugin/registry.ts +82 -0
- package/src/{plugin → lib/plugin}/tool-service.ts +10 -14
- package/src/{plugin → lib/plugin}/types.ts +10 -33
- package/src/program/base.ts +75 -0
- package/src/program/commands/check.ts +31 -62
- package/src/program/commands/clean.ts +12 -43
- package/src/program/commands/completion.ts +6 -4
- package/src/program/commands/config.ts +6 -11
- package/src/program/commands/doctor.ts +5 -54
- package/src/program/commands/format.ts +18 -25
- package/src/program/commands/jscheck.ts +18 -31
- package/src/program/commands/lint.ts +18 -26
- package/src/program/commands/pack.ts +18 -22
- package/src/program/commands/plugins.ts +17 -364
- package/src/program/commands/tscheck.ts +19 -77
- package/src/program/index.ts +20 -27
- package/src/program/root.ts +62 -0
- package/src/render/banner.ts +25 -0
- package/src/render/board.ts +41 -0
- package/src/render/footer.ts +31 -0
- package/src/render/labels.ts +28 -0
- package/src/render/lines.ts +100 -0
- package/src/render/plugin-view.ts +68 -0
- package/src/render/steps.ts +20 -0
- package/src/run.ts +2 -8
- package/src/services/config.ts +4 -0
- package/src/services/context.ts +84 -0
- package/src/services/file-ops.ts +79 -0
- package/src/services/json-edit.ts +1 -1
- package/src/services/plugin-meta.ts +63 -0
- package/src/services/plugin-services.ts +41 -0
- package/src/services/prompts.ts +1 -1
- package/src/services/static-checker.ts +46 -0
- package/src/types/config.ts +2 -1
- package/src/types/tool.ts +13 -26
- package/src/ui/theme.ts +5 -0
- package/dist/plugin.d.mts +0 -87
- package/dist/plugin.mjs +0 -214
- package/src/plugin/define-plugin.ts +0 -54
- package/src/plugin/registry.ts +0 -48
- package/src/program/board.ts +0 -86
- package/src/program/composed-jsc.ts +0 -43
- package/src/program/missing-plugin.ts +0 -18
- package/src/program/ui.ts +0 -59
- package/src/services/ctx.ts +0 -71
- package/src/services/plugins-registry.ts +0 -22
- /package/src/{plugin → lib/plugin}/bin-probe.ts +0 -0
- /package/src/{plugin → lib/plugin}/decide-scaffold.ts +0 -0
- /package/src/{plugin → lib/plugin}/pick-preset.ts +0 -0
package/README.md
CHANGED
|
@@ -6,15 +6,6 @@ CLI toolbox to fullstack common scripts in [Variable Land](https://variable.land
|
|
|
6
6
|
|
|
7
7
|
- Node.js >= 20.0.0
|
|
8
8
|
|
|
9
|
-
## Toolbox
|
|
10
|
-
|
|
11
|
-
- [biome](https://biomejs.dev)
|
|
12
|
-
- [tsc](https://www.typescriptlang.org)
|
|
13
|
-
- [rimraf](https://www.npmjs.com/package/rimraf)
|
|
14
|
-
- [oxfmt](https://oxc.rs/docs/guide/usage/formatter.html)
|
|
15
|
-
- [oxlint](https://oxc.rs/docs/guide/usage/linter.html)
|
|
16
|
-
- [tsdown](https://tsdown.dev)
|
|
17
|
-
|
|
18
9
|
## Installation
|
|
19
10
|
|
|
20
11
|
```sh
|
|
@@ -37,7 +28,16 @@ See [`CLI.md`](./CLI.md) for the full reference (auto-generated per release).
|
|
|
37
28
|
|
|
38
29
|
## Plugins
|
|
39
30
|
|
|
40
|
-
`rr` is a microkernel: every tool
|
|
31
|
+
`rr` is a microkernel: every tool lives in its own `@rrlab/<tool>-plugin` package. The official plugins are:
|
|
32
|
+
|
|
33
|
+
| Plugin | Wraps | Install |
|
|
34
|
+
| -------- | -------------------------------------------------------------------------------------------------------------- | ------------------------ |
|
|
35
|
+
| `biome` | [Biome](https://biomejs.dev) | `rr plugins add biome` |
|
|
36
|
+
| `oxc` | [oxlint](https://oxc.rs/docs/guide/usage/linter.html) + [oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) | `rr plugins add oxc` |
|
|
37
|
+
| `ts` | [tsc](https://www.typescriptlang.org) | `rr plugins add ts` |
|
|
38
|
+
| `tsdown` | [tsdown](https://tsdown.dev) | `rr plugins add tsdown` |
|
|
39
|
+
|
|
40
|
+
Install one with:
|
|
41
41
|
|
|
42
42
|
```sh
|
|
43
43
|
rr plugins add biome
|
package/bin
CHANGED
|
@@ -32,14 +32,12 @@ fi
|
|
|
32
32
|
|
|
33
33
|
# `--usage` emits a KDL spec for downstream parsers (e.g. `usage generate
|
|
34
34
|
# completion`). Force NO_COLOR so command summaries don't leak ANSI escapes
|
|
35
|
-
# into the spec — colors are presentation, KDL is data.
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
# stable across machines.
|
|
35
|
+
# into the spec — colors are presentation, KDL is data. Command summaries are
|
|
36
|
+
# static (no per-environment plugin annotations), so the spec is already stable
|
|
37
|
+
# across machines.
|
|
39
38
|
for arg in "$@"; do
|
|
40
39
|
if [ "$arg" = "--usage" ]; then
|
|
41
40
|
export NO_COLOR=1
|
|
42
|
-
export RR_USAGE_MODE=1
|
|
43
41
|
break
|
|
44
42
|
fi
|
|
45
43
|
done
|
package/dist/cli.usage.kdl
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
// @generated by @usage-spec/commander from Commander.js metadata
|
|
2
2
|
name rr
|
|
3
3
|
bin rr
|
|
4
|
-
version "1.
|
|
5
|
-
usage "
|
|
4
|
+
version "1.2.0"
|
|
5
|
+
usage "[options] [command]"
|
|
6
|
+
flag --about help="show credits & inspiration"
|
|
6
7
|
flag --usage help="print KDL spec for this CLI (https://kdl.dev)"
|
|
7
|
-
cmd
|
|
8
|
-
long_help "
|
|
9
|
-
arg <shell> help="target shell" {
|
|
10
|
-
choices bash zsh fish
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
cmd pack help="pack a ts library" {
|
|
14
|
-
long_help "Compiles TypeScript code into JavaScript and generates type declaration files, packaging the library for distribution."
|
|
15
|
-
cmd doctor help="check if the underlying tool is working correctly"
|
|
8
|
+
cmd check help="run static checks" {
|
|
9
|
+
long_help "Runs `rr jsc` then `rr tsc` in-process, each as its own section. Aggregates their exit codes — non-zero when either subcommand fails."
|
|
16
10
|
}
|
|
17
11
|
cmd jsc help="check format and lint" {
|
|
18
12
|
alias jscheck
|
|
@@ -21,49 +15,56 @@ cmd jsc help="check format and lint" {
|
|
|
21
15
|
flag --fix-staged help="try to fix staged files only"
|
|
22
16
|
cmd doctor help="check if the underlying tool is working correctly"
|
|
23
17
|
}
|
|
24
|
-
cmd tsc help="check
|
|
18
|
+
cmd tsc help="check types errors" {
|
|
25
19
|
alias tscheck
|
|
26
|
-
long_help "Checks
|
|
20
|
+
long_help "Checks type errors, ensuring that the code adheres to the defined type constraints and helps catch potential issues before runtime."
|
|
27
21
|
cmd doctor help="check if the underlying tool is working correctly"
|
|
28
22
|
}
|
|
29
|
-
cmd lint help="check & fix lint
|
|
23
|
+
cmd lint help="check & fix lint issues" {
|
|
30
24
|
long_help "Checks the code for linting issues and optionally fixes them, ensuring it adheres to the defined quality standards."
|
|
31
25
|
flag "-c --check" help="check if the code is valid" default=#true
|
|
32
26
|
flag --fix help="try to fix all the code"
|
|
33
27
|
cmd doctor help="check if the underlying tool is working correctly"
|
|
34
28
|
}
|
|
35
|
-
cmd format help="check & fix format
|
|
29
|
+
cmd format help="check & fix format issues" {
|
|
36
30
|
long_help "Checks the code for formatting issues and optionally fixes them, ensuring it adheres to the defined style standards."
|
|
37
31
|
flag --fix help="format all the code"
|
|
38
32
|
cmd doctor help="check if the underlying tool is working correctly"
|
|
39
33
|
}
|
|
40
|
-
cmd
|
|
41
|
-
long_help "
|
|
34
|
+
cmd pack help="pack a ts library" {
|
|
35
|
+
long_help "Compiles TypeScript code into JavaScript and generates type declaration files, packaging the library for distribution."
|
|
36
|
+
cmd doctor help="check if the underlying tool is working correctly"
|
|
37
|
+
}
|
|
38
|
+
cmd clean help="delete dirty files" {
|
|
39
|
+
long_help "Deletes generated files and folders such as 'dist', 'node_modules', and lock files to ensure a clean state."
|
|
40
|
+
flag --only-dist help="delete 'dist' folders only"
|
|
41
|
+
flag --dry-run help="outputs the paths that would be deleted"
|
|
42
42
|
}
|
|
43
43
|
cmd doctor help="run all plugin doctors" {
|
|
44
44
|
long_help "Runs the `doctor()` of every configured plugin capability. Each plugin reports ok / not working. The exit code is non-zero if any reports not working."
|
|
45
45
|
}
|
|
46
|
+
cmd completion help="print shell completion script" {
|
|
47
|
+
long_help "Prints a shell completion script for rr. Add to your shell rc file:\n\n bash: eval \"$(rr completion bash)\"\n zsh: eval \"$(rr completion zsh)\"\n fish: rr completion fish | source"
|
|
48
|
+
arg <shell> help="target shell" {
|
|
49
|
+
choices bash zsh fish
|
|
50
|
+
}
|
|
51
|
+
}
|
|
46
52
|
cmd plugins subcommand_required=#true help="manage @rrlab plugins" {
|
|
47
53
|
cmd list help="list plugins configured in run-run.config.{ts,mts}"
|
|
48
54
|
cmd add help="install and configure an @rrlab plugin" {
|
|
49
55
|
flag --force help="re-run install even if the plugin is already configured"
|
|
50
56
|
flag --yes help="skip prompts and use defaults (non-interactive)"
|
|
51
57
|
flag --dry-run help="show what would happen, without applying changes"
|
|
52
|
-
arg <name> help="plugin alias (ts|
|
|
58
|
+
arg <name> help="plugin alias (ts|biome|oxc|tsdown), optionally with @<spec> e.g. biome@pr-226"
|
|
53
59
|
}
|
|
54
60
|
cmd remove help="uninstall an @rrlab plugin and undo its config files + deps" {
|
|
55
61
|
flag --yes help="skip the confirmation prompt"
|
|
56
62
|
flag --dry-run help="print the plan without applying changes"
|
|
57
63
|
arg <name> help="plugin alias to remove" {
|
|
58
|
-
choices ts
|
|
64
|
+
choices ts biome oxc tsdown
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
67
|
}
|
|
62
|
-
cmd clean help="delete dirty files (rimraf)" {
|
|
63
|
-
long_help "Deletes generated files and folders such as 'dist', 'node_modules', and lock files to ensure a clean state."
|
|
64
|
-
flag --only-dist help="delete 'dist' folders only"
|
|
65
|
-
flag --dry-run help="outputs the paths that would be deleted"
|
|
66
|
-
}
|
|
67
68
|
cmd config help="display the current config" {
|
|
68
|
-
long_help "Displays the current configuration settings, including their source file path
|
|
69
|
+
long_help "Displays the current configuration settings, including their source file path and the plugins it registers."
|
|
69
70
|
}
|
package/dist/config.d.mts
CHANGED