@rrlab/cli 1.3.3 → 1.3.5

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 CHANGED
@@ -79,19 +79,23 @@ _.path = ["{{config_root}}/node_modules/.bin"]
79
79
  PATH_add node_modules/.bin
80
80
  ```
81
81
 
82
- Then add a guarded eval to your shell rc — the guard makes it a no-op when you open a shell outside any project:
82
+ Then add a guarded eval to your shell rc:
83
83
 
84
84
  ```sh
85
85
  # zsh — ~/.zshrc
86
- command -v rr >/dev/null 2>&1 && eval "$(rr completion zsh)"
86
+ command -v rr >/dev/null 2>&1 && eval "$(rr completion zsh 2>/dev/null)"
87
87
 
88
88
  # bash — ~/.bashrc
89
- command -v rr >/dev/null 2>&1 && eval "$(rr completion bash)"
89
+ command -v rr >/dev/null 2>&1 && eval "$(rr completion bash 2>/dev/null)"
90
90
 
91
91
  # fish — ~/.config/fish/config.fish
92
- command -v rr >/dev/null 2>&1; and rr completion fish | source
92
+ command -v rr >/dev/null 2>&1; and rr completion fish 2>/dev/null | source
93
93
  ```
94
94
 
95
+ The `command -v` guard skips the line when no `rr` is on `PATH`. A mise shim still passes it: recent versions of mise keep `~/.local/share/mise/shims` on `PATH` after `mise activate`, even outside any project (the `activate_shims` setting, on by default). Once mise has installed a tool that provides `rr`, such as `npm:@rrlab/cli` in some project's `mise.toml`, an `rr` shim exists in every directory, and where no version is active it fails with `mise ERROR No version is set for shim: rr` on stderr. The `2>/dev/null` discards that error, so the line stays silent outside a project.
96
+
97
+ The line hides every error, so if completion doesn't load, run `rr completion zsh` by hand to see why.
98
+
95
99
  ### Option B — without a per-project PATH manager
96
100
 
97
101
  Cache the completion script once, then source the cached file from your shell rc. Run the generation step from inside a project that has `@rrlab/cli` installed:
@@ -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.3.3"
4
+ version "1.3.5"
5
5
  usage "[options] [command]"
6
6
  flag --about help="show credits & inspiration"
7
7
  flag --usage help="print KDL spec for this CLI (https://kdl.dev)"
@@ -52,7 +52,7 @@ cmd doctor help="run all plugin doctors" {
52
52
  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."
53
53
  }
54
54
  cmd completion help="print shell completion script" {
55
- 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"
55
+ long_help "Prints a shell completion script for rr. Add your shell's line to its rc file:\n\n # bash — ~/.bashrc\n command -v rr >/dev/null 2>&1 && eval \"$(rr completion bash 2>/dev/null)\"\n\n # zsh — ~/.zshrc\n command -v rr >/dev/null 2>&1 && eval \"$(rr completion zsh 2>/dev/null)\"\n\n # fish — ~/.config/fish/config.fish\n command -v rr >/dev/null 2>&1; and rr completion fish 2>/dev/null | source"
56
56
  arg <shell> help="target shell" {
57
57
  choices bash zsh fish
58
58
  }
@@ -1,6 +1,6 @@
1
1
  import { ToolService } from "../tool-service.mjs";
2
2
  import { probeBins } from "../bin-probe.mjs";
3
- import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.mjs";
3
+ import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-h0bAJWRJ.mjs";
4
4
  //#region src/lib/plugin/__tests__/bin-probe.test.ts
5
5
  const FROM = import.meta.url;
6
6
  var ResolvableService = class extends ToolService {
@@ -1,5 +1,5 @@
1
1
  import { decideScaffold } from "../decide-scaffold.mjs";
2
- import { i as it, n as vi, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.mjs";
2
+ import { i as it, n as vi, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-h0bAJWRJ.mjs";
3
3
  //#region src/lib/plugin/__tests__/decide-scaffold.test.ts
4
4
  function makeCtx(overrides = {}) {
5
5
  return {
@@ -1,6 +1,6 @@
1
1
  import { ToolService } from "../tool-service.mjs";
2
2
  import { definePlugin } from "../define-plugin.mjs";
3
- import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.mjs";
3
+ import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-h0bAJWRJ.mjs";
4
4
  //#region src/lib/plugin/__tests__/define-plugin.test.ts
5
5
  function ctx() {
6
6
  return {
@@ -1,5 +1,5 @@
1
1
  import { pickPreset } from "../pick-preset.mjs";
2
- import { i as it, n as vi, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.mjs";
2
+ import { i as it, n as vi, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-h0bAJWRJ.mjs";
3
3
  //#region src/lib/plugin/__tests__/pick-preset.test.ts
4
4
  function makeCtx(overrides = {}) {
5
5
  return {
@@ -1,5 +1,5 @@
1
1
  import { t as PluginRegistry } from "../../registry-B-GhzVIO.mjs";
2
- import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.mjs";
2
+ import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-h0bAJWRJ.mjs";
3
3
  //#region src/lib/plugin/__tests__/registry.test.ts
4
4
  function plugin(name) {
5
5
  return {
package/dist/run.mjs CHANGED
@@ -622,11 +622,16 @@ const SHELLS = [
622
622
  ];
623
623
  const usageColor = colorize("#24C55E");
624
624
  function createCompletionCommand() {
625
- return createCommand("completion").summary(`print shell completion script`).description(`Prints a shell completion script for rr. Add to your shell rc file:
625
+ return createCommand("completion").summary(`print shell completion script`).description(`Prints a shell completion script for rr. Add your shell's line to its rc file:
626
626
 
627
- bash: eval "$(rr completion bash)"
628
- zsh: eval "$(rr completion zsh)"
629
- fish: rr completion fish | source`).addArgument(new Argument("<shell>", `target shell`).choices(SHELLS)).addHelpText("afterAll", `\nUnder the hood, this command uses ${usageColor("usage")} (https://usage.jdx.dev).
627
+ # bash — ~/.bashrc
628
+ command -v rr >/dev/null 2>&1 && eval "$(rr completion bash 2>/dev/null)"
629
+
630
+ # zsh — ~/.zshrc
631
+ command -v rr >/dev/null 2>&1 && eval "$(rr completion zsh 2>/dev/null)"
632
+
633
+ # fish — ~/.config/fish/config.fish
634
+ command -v rr >/dev/null 2>&1; and rr completion fish 2>/dev/null | source`).configureHelp({ helpWidth: Number.POSITIVE_INFINITY }).addArgument(new Argument("<shell>", `target shell`).choices(SHELLS)).addHelpText("afterAll", `\nUnder the hood, this command uses ${usageColor("usage")} (https://usage.jdx.dev).
630
635
  Make sure to have it installed and available in your PATH.`);
631
636
  }
632
637
  //#endregion
@@ -5092,7 +5092,7 @@ function manageArtifactAttachment(attachment) {
5092
5092
  if (attachment.body != null) attachment.bodyEncoding ??= "base64";
5093
5093
  }
5094
5094
  //#endregion
5095
- //#region ../../node_modules/.pnpm/vitest@4.1.6_@types+node@25.9.1_vite@8.0.13_@types+node@25.9.1_yaml@2.8.4_/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js
5095
+ //#region ../../node_modules/.pnpm/vitest@4.1.6_@types+node@25.9.1_vite@8.0.13_@types+node@25.9.1_yaml@2.9.1_/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js
5096
5096
  const NAME_WORKER_STATE = "__vitest_worker__";
5097
5097
  function getWorkerState() {
5098
5098
  const workerState = globalThis[NAME_WORKER_STATE];
@@ -9971,10 +9971,10 @@ function offsetToLineNumber(source, offset) {
9971
9971
  return line + 1;
9972
9972
  }
9973
9973
  //#endregion
9974
- //#region ../../node_modules/.pnpm/vitest@4.1.6_@types+node@25.9.1_vite@8.0.13_@types+node@25.9.1_yaml@2.8.4_/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js
9974
+ //#region ../../node_modules/.pnpm/vitest@4.1.6_@types+node@25.9.1_vite@8.0.13_@types+node@25.9.1_yaml@2.9.1_/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js
9975
9975
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
9976
9976
  //#endregion
9977
- //#region ../../node_modules/.pnpm/vitest@4.1.6_@types+node@25.9.1_vite@8.0.13_@types+node@25.9.1_yaml@2.8.4_/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js
9977
+ //#region ../../node_modules/.pnpm/vitest@4.1.6_@types+node@25.9.1_vite@8.0.13_@types+node@25.9.1_yaml@2.9.1_/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js
9978
9978
  const RealDate = Date;
9979
9979
  let now = null;
9980
9980
  var MockDate = class MockDate extends RealDate {
@@ -10937,7 +10937,7 @@ function raceWith(promise, other) {
10937
10937
  }))]);
10938
10938
  }
10939
10939
  //#endregion
10940
- //#region ../../node_modules/.pnpm/vitest@4.1.6_@types+node@25.9.1_vite@8.0.13_@types+node@25.9.1_yaml@2.8.4_/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js
10940
+ //#region ../../node_modules/.pnpm/vitest@4.1.6_@types+node@25.9.1_vite@8.0.13_@types+node@25.9.1_yaml@2.9.1_/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js
10941
10941
  var fakeTimersSrc = {};
10942
10942
  var global$1;
10943
10943
  var hasRequiredGlobal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rrlab/cli",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "The CLI toolbox to fullstack common scripts in Variable Land",
5
5
  "homepage": "https://github.com/withvariablelab/dx/tree/main/run-run/cli#readme",
6
6
  "bugs": {
@@ -57,12 +57,12 @@
57
57
  "memoize": "10.2.0",
58
58
  "nypm": "0.6.0",
59
59
  "rimraf": "6.1.3",
60
- "@variablelab/clibuddy": "0.7.3",
61
- "@variablelab/loggy": "0.2.2"
60
+ "@variablelab/loggy": "0.2.3",
61
+ "@variablelab/clibuddy": "0.7.4"
62
62
  },
63
63
  "devDependencies": {
64
64
  "tsdown": "0.22.0",
65
- "@rrlab/tsdown-config": "^0.1.1"
65
+ "@rrlab/tsdown-config": "^0.1.2"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "tsdown && pnpm build:kdl",
@@ -13,12 +13,21 @@ export function createCompletionCommand() {
13
13
  return createCommand("completion")
14
14
  .summary(`print shell completion script`)
15
15
  .description(
16
- `Prints a shell completion script for rr. Add to your shell rc file:
16
+ `Prints a shell completion script for rr. Add your shell's line to its rc file:
17
17
 
18
- bash: eval "$(rr completion bash)"
19
- zsh: eval "$(rr completion zsh)"
20
- fish: rr completion fish | source`,
18
+ # bash — ~/.bashrc
19
+ command -v rr >/dev/null 2>&1 && eval "$(rr completion bash 2>/dev/null)"
20
+
21
+ # zsh — ~/.zshrc
22
+ command -v rr >/dev/null 2>&1 && eval "$(rr completion zsh 2>/dev/null)"
23
+
24
+ # fish — ~/.config/fish/config.fish
25
+ command -v rr >/dev/null 2>&1; and rr completion fish 2>/dev/null | source`,
21
26
  )
27
+ .configureHelp({
28
+ // Commander hard-wraps help at the terminal width; a wrapped rc line breaks when pasted.
29
+ helpWidth: Number.POSITIVE_INFINITY,
30
+ })
22
31
  .addArgument(new Argument("<shell>", `target shell`).choices(SHELLS))
23
32
  .addHelpText(
24
33
  "afterAll",