@rrlab/cli 1.3.0 → 1.3.2-git-234d4f0.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/errors-VlWGAo7D.mjs +27 -0
- package/dist/plugin/__tests__/bin-probe.test.mjs +1 -1
- package/dist/plugin/__tests__/decide-scaffold.test.mjs +1 -1
- package/dist/plugin/__tests__/define-plugin.test.mjs +1 -1
- package/dist/plugin/__tests__/pick-preset.test.mjs +1 -1
- package/dist/plugin/__tests__/registry.test.mjs +2 -2
- package/dist/plugin/decide-scaffold.d.mts +1 -1
- package/dist/plugin/define-plugin.d.mts +1 -1
- package/dist/plugin/directory.d.mts +1 -1
- package/dist/plugin/errors.d.mts +13 -1
- package/dist/plugin/errors.mjs +1 -14
- package/dist/plugin/index.d.mts +2 -2
- package/dist/plugin/pick-preset.d.mts +1 -1
- package/dist/plugin/registry.d.mts +2 -2
- package/dist/plugin/registry.mjs +1 -1
- package/dist/plugin/tool-service.d.mts +2 -2
- package/dist/plugin/tool-service.mjs +1 -1
- package/dist/plugin/types.d.mts +2 -2
- package/dist/{registry-BgqfKK5L.mjs → registry-B-GhzVIO.mjs} +2 -2
- package/dist/run.mjs +42 -8
- package/dist/{test.DNmyFkvJ-09ScyH13.mjs → test.DNmyFkvJ-CipsEAq5.mjs} +1 -1
- package/dist/{types-CNXhLCKf.d.mts → types-CJ251E7V.d.mts} +3 -3
- package/package.json +7 -7
- package/src/actions/clean.ts +1 -1
- package/src/actions/config.ts +1 -1
- package/src/errors/invalid-plugin-module.ts +3 -1
- package/src/errors/known-error.ts +10 -0
- package/src/errors/missing-plugin.ts +2 -1
- package/src/errors/plugin-api-version.ts +3 -1
- package/src/errors/unknown-plugin.ts +2 -1
- package/src/lib/plugin/errors.ts +3 -1
- package/src/lib/plugin/tool-service.ts +1 -1
- package/src/lib/plugin/types.ts +2 -2
- package/src/program/commands/check.ts +1 -1
- package/src/program/commands/clean.ts +1 -1
- package/src/program/commands/completion.ts +1 -1
- package/src/program/index.ts +1 -1
- package/src/program/report-error.ts +19 -0
- package/src/program/root.ts +1 -1
- package/src/render/banner.ts +1 -1
- package/src/render/board.ts +1 -1
- package/src/render/footer.ts +1 -1
- package/src/render/labels.ts +1 -1
- package/src/render/plugin-view.ts +1 -1
- package/src/run.ts +12 -3
- package/src/services/context.ts +1 -1
- package/src/services/logger.ts +1 -1
- package/src/services/workspace-target.ts +1 -1
- package/src/ui/theme.ts +1 -1
- /package/dist/{magic-string.es-BgIV5Mu3.mjs → magic-string.es-Dk-MMA0F.mjs} +0 -0
- /package/dist/{tool-z8C0qtc5.d.mts → tool-faVTe0v0.d.mts} +0 -0
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.3.0"
|
|
4
|
+
version "1.3.2-git-234d4f0.0"
|
|
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)"
|
package/dist/config.d.mts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/errors/known-error.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base class for user-facing domain errors. The top-level handler (`reportError`
|
|
4
|
+
* in `src/program/report-error.ts`) renders a `KnownError` as a clean message —
|
|
5
|
+
* no stack trace — and exits 1. Anything that is NOT a `KnownError` is treated
|
|
6
|
+
* as an unexpected bug and surfaces its full stack so it can be reported.
|
|
7
|
+
*
|
|
8
|
+
* Don't set `this.name` in subclasses — keep the plain `Error:` prefix so output
|
|
9
|
+
* stays clean.
|
|
10
|
+
*/
|
|
11
|
+
var KnownError = class extends Error {};
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/lib/plugin/errors.ts
|
|
14
|
+
/**
|
|
15
|
+
* Thrown by `PluginRegistry.get` when more than one plugin provides the same
|
|
16
|
+
* capability. The message is load-bearing for the "ambiguity → user narrows
|
|
17
|
+
* config" UX (decision 003) — `registry.test.ts` asserts the plugin names appear.
|
|
18
|
+
*/
|
|
19
|
+
var MultipleProvidersError = class extends KnownError {
|
|
20
|
+
constructor(kind, pluginNames) {
|
|
21
|
+
const names = pluginNames.join(", ");
|
|
22
|
+
const example = pluginNames.map((name) => `${name}({ only: ['${kind}'] })`).join(" or ");
|
|
23
|
+
super(`Multiple plugins provide capability '${kind}': ${names}. Narrow each plugin's capabilities in run-run.config.ts using the 'only' option — e.g. ${example}.`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { KnownError as n, MultipleProvidersError as t };
|
|
@@ -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-
|
|
3
|
+
import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.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-
|
|
2
|
+
import { i as it, n as vi, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.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-
|
|
3
|
+
import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.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-
|
|
2
|
+
import { i as it, n as vi, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-CipsEAq5.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
|
-
import { t as PluginRegistry } from "../../registry-
|
|
2
|
-
import { i as it, r as describe, t as globalExpect } from "../../test.DNmyFkvJ-
|
|
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";
|
|
3
3
|
//#region src/lib/plugin/__tests__/registry.test.ts
|
|
4
4
|
function plugin(name) {
|
|
5
5
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Plugin, d as PluginServices, f as UninstallContext, i as InstallContext, l as PluginCapability, m as UninstallResult, o as InstallResult, u as PluginContext } from "../types-
|
|
1
|
+
import { c as Plugin, d as PluginServices, f as UninstallContext, i as InstallContext, l as PluginCapability, m as UninstallResult, o as InstallResult, u as PluginContext } from "../types-CJ251E7V.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/lib/plugin/define-plugin.d.ts
|
|
4
4
|
type PluginDefinition<TServices extends PluginServices> = {
|
package/dist/plugin/errors.d.mts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
//#region src/errors/known-error.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base class for user-facing domain errors. The top-level handler (`reportError`
|
|
4
|
+
* in `src/program/report-error.ts`) renders a `KnownError` as a clean message —
|
|
5
|
+
* no stack trace — and exits 1. Anything that is NOT a `KnownError` is treated
|
|
6
|
+
* as an unexpected bug and surfaces its full stack so it can be reported.
|
|
7
|
+
*
|
|
8
|
+
* Don't set `this.name` in subclasses — keep the plain `Error:` prefix so output
|
|
9
|
+
* stays clean.
|
|
10
|
+
*/
|
|
11
|
+
declare class KnownError extends Error {}
|
|
12
|
+
//#endregion
|
|
1
13
|
//#region src/lib/plugin/errors.d.ts
|
|
2
14
|
/**
|
|
3
15
|
* Thrown by `PluginRegistry.get` when more than one plugin provides the same
|
|
4
16
|
* capability. The message is load-bearing for the "ambiguity → user narrows
|
|
5
17
|
* config" UX (decision 003) — `registry.test.ts` asserts the plugin names appear.
|
|
6
18
|
*/
|
|
7
|
-
declare class MultipleProvidersError extends
|
|
19
|
+
declare class MultipleProvidersError extends KnownError {
|
|
8
20
|
constructor(kind: string, pluginNames: readonly string[]);
|
|
9
21
|
}
|
|
10
22
|
//#endregion
|
package/dist/plugin/errors.mjs
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Thrown by `PluginRegistry.get` when more than one plugin provides the same
|
|
4
|
-
* capability. The message is load-bearing for the "ambiguity → user narrows
|
|
5
|
-
* config" UX (decision 003) — `registry.test.ts` asserts the plugin names appear.
|
|
6
|
-
*/
|
|
7
|
-
var MultipleProvidersError = class extends Error {
|
|
8
|
-
constructor(kind, pluginNames) {
|
|
9
|
-
const names = pluginNames.join(", ");
|
|
10
|
-
const example = pluginNames.map((name) => `${name}({ only: ['${kind}'] })`).join(" or ");
|
|
11
|
-
super(`Multiple plugins provide capability '${kind}': ${names}. Narrow each plugin's capabilities in run-run.config.ts using the 'only' option — e.g. ${example}.`);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
1
|
+
import { t as MultipleProvidersError } from "../errors-VlWGAo7D.mjs";
|
|
15
2
|
export { MultipleProvidersError };
|
package/dist/plugin/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as InstallFlags, c as Plugin, d as PluginServices, f as UninstallContext, g as ReleaseServiceOptions, h as ReleaseService, i as InstallContext, l as PluginCapability, m as UninstallResult, n as ClackPromptsSelectOption, o as InstallResult, p as UninstallFlags, r as FileOp, s as JsonEdit, t as ClackPrompts, u as PluginContext } from "../types-
|
|
2
|
-
import { a as Linter, c as StaticChecker, d as TestRunner, f as TypeCheckOptions, i as LintOptions, l as StaticCheckerOptions, n as FormatOptions, o as Packer, p as TypeChecker, r as Formatter, s as RunReport, t as Doctor, u as TestRunOptions } from "../tool-
|
|
1
|
+
import { a as InstallFlags, c as Plugin, d as PluginServices, f as UninstallContext, g as ReleaseServiceOptions, h as ReleaseService, i as InstallContext, l as PluginCapability, m as UninstallResult, n as ClackPromptsSelectOption, o as InstallResult, p as UninstallFlags, r as FileOp, s as JsonEdit, t as ClackPrompts, u as PluginContext } from "../types-CJ251E7V.mjs";
|
|
2
|
+
import { a as Linter, c as StaticChecker, d as TestRunner, f as TypeCheckOptions, i as LintOptions, l as StaticCheckerOptions, n as FormatOptions, o as Packer, p as TypeChecker, r as Formatter, s as RunReport, t as Doctor, u as TestRunOptions } from "../tool-faVTe0v0.mjs";
|
|
3
3
|
import { DecideScaffoldOptions, ScaffoldDecision, decideScaffold } from "./decide-scaffold.mjs";
|
|
4
4
|
import { PluginDefinition, definePlugin } from "./define-plugin.mjs";
|
|
5
5
|
import { PickPresetOptions, pickPreset } from "./pick-preset.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as Plugin, d as PluginServices, l as PluginCapability } from "../types-
|
|
2
|
-
import { a as Linter, c as StaticChecker, d as TestRunner, o as Packer, p as TypeChecker, r as Formatter, t as Doctor } from "../tool-
|
|
1
|
+
import { c as Plugin, d as PluginServices, l as PluginCapability } from "../types-CJ251E7V.mjs";
|
|
2
|
+
import { a as Linter, c as StaticChecker, d as TestRunner, o as Packer, p as TypeChecker, r as Formatter, t as Doctor } from "../tool-faVTe0v0.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/plugin/registry.d.ts
|
|
5
5
|
type Provider<K extends PluginCapability> = {
|
package/dist/plugin/registry.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as PluginRegistry } from "../registry-
|
|
1
|
+
import { t as PluginRegistry } from "../registry-B-GhzVIO.mjs";
|
|
2
2
|
export { PluginRegistry };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as RunReport } from "../tool-
|
|
2
|
-
import { ShellService } from "@
|
|
1
|
+
import { s as RunReport } from "../tool-faVTe0v0.mjs";
|
|
2
|
+
import { ShellService } from "@variablelab/clibuddy";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/plugin/tool-service.d.ts
|
|
5
5
|
type ToolServiceOptions = {
|
package/dist/plugin/types.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as InstallFlags, c as Plugin, d as PluginServices, f as UninstallContext, i as InstallContext, l as PluginCapability, m as UninstallResult, n as ClackPromptsSelectOption, o as InstallResult, p as UninstallFlags, r as FileOp, s as JsonEdit, t as ClackPrompts, u as PluginContext } from "../types-
|
|
2
|
-
import { a as Linter, c as StaticChecker, d as TestRunner, f as TypeCheckOptions, i as LintOptions, l as StaticCheckerOptions, n as FormatOptions, o as Packer, p as TypeChecker, r as Formatter, s as RunReport, t as Doctor, u as TestRunOptions } from "../tool-
|
|
1
|
+
import { a as InstallFlags, c as Plugin, d as PluginServices, f as UninstallContext, i as InstallContext, l as PluginCapability, m as UninstallResult, n as ClackPromptsSelectOption, o as InstallResult, p as UninstallFlags, r as FileOp, s as JsonEdit, t as ClackPrompts, u as PluginContext } from "../types-CJ251E7V.mjs";
|
|
2
|
+
import { a as Linter, c as StaticChecker, d as TestRunner, f as TypeCheckOptions, i as LintOptions, l as StaticCheckerOptions, n as FormatOptions, o as Packer, p as TypeChecker, r as Formatter, s as RunReport, t as Doctor, u as TestRunOptions } from "../tool-faVTe0v0.mjs";
|
|
3
3
|
export { ClackPrompts, ClackPromptsSelectOption, type Doctor, FileOp, type FormatOptions, type Formatter, InstallContext, InstallFlags, InstallResult, JsonEdit, type LintOptions, type Linter, type Packer, Plugin, PluginCapability, PluginContext, PluginServices, type RunReport, type StaticChecker, type StaticCheckerOptions, type TestRunOptions, type TestRunner, type TypeCheckOptions, type TypeChecker, UninstallContext, UninstallFlags, UninstallResult };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { providersOf } from "./plugin/directory.mjs";
|
|
2
|
-
import { MultipleProvidersError } from "./
|
|
2
|
+
import { n as KnownError, t as MultipleProvidersError } from "./errors-VlWGAo7D.mjs";
|
|
3
3
|
//#region src/errors/missing-plugin.ts
|
|
4
|
-
var MissingPluginError = class extends
|
|
4
|
+
var MissingPluginError = class extends KnownError {
|
|
5
5
|
constructor(capability) {
|
|
6
6
|
const plugins = providersOf(capability);
|
|
7
7
|
const pkgList = plugins.map((it) => it.pkg).join(", ");
|
package/dist/run.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import path, { basename } from "node:path";
|
|
3
|
-
import { colorize, createPkg, createShellService, cwd, dirnameOf, palette, runTaskBoard, text } from "@
|
|
3
|
+
import { colorize, createPkg, createShellService, cwd, dirnameOf, palette, runTaskBoard, text } from "@variablelab/clibuddy";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import { lilconfig } from "lilconfig";
|
|
7
|
-
import { createLoggy } from "@
|
|
7
|
+
import { createLoggy } from "@variablelab/loggy";
|
|
8
8
|
import { Argument, Command } from "commander";
|
|
9
9
|
import stringWidth from "fast-string-width";
|
|
10
10
|
import { glob } from "glob";
|
|
@@ -15,9 +15,21 @@ import fs$1 from "node:fs/promises";
|
|
|
15
15
|
import { builders, generateCode, loadFile, parseModule, writeFile } from "magicast";
|
|
16
16
|
import * as cjson from "comment-json";
|
|
17
17
|
import { generateToStdout } from "@usage-spec/commander";
|
|
18
|
+
//#region src/errors/known-error.ts
|
|
19
|
+
/**
|
|
20
|
+
* Base class for user-facing domain errors. The top-level handler (`reportError`
|
|
21
|
+
* in `src/program/report-error.ts`) renders a `KnownError` as a clean message —
|
|
22
|
+
* no stack trace — and exits 1. Anything that is NOT a `KnownError` is treated
|
|
23
|
+
* as an unexpected bug and surfaces its full stack so it can be reported.
|
|
24
|
+
*
|
|
25
|
+
* Don't set `this.name` in subclasses — keep the plain `Error:` prefix so output
|
|
26
|
+
* stays clean.
|
|
27
|
+
*/
|
|
28
|
+
var KnownError = class extends Error {};
|
|
29
|
+
//#endregion
|
|
18
30
|
//#region src/errors/plugin-api-version.ts
|
|
19
31
|
/** Thrown when a configured plugin targets an apiVersion the kernel doesn't support. */
|
|
20
|
-
var PluginApiVersionError = class extends
|
|
32
|
+
var PluginApiVersionError = class extends KnownError {
|
|
21
33
|
constructor(pluginName, got) {
|
|
22
34
|
super(`Plugin '${pluginName}' targets apiVersion ${got}, but this kernel supports only apiVersion 1.`);
|
|
23
35
|
}
|
|
@@ -73,7 +85,7 @@ function providersOf(capability) {
|
|
|
73
85
|
}
|
|
74
86
|
//#endregion
|
|
75
87
|
//#region src/errors/missing-plugin.ts
|
|
76
|
-
var MissingPluginError = class extends
|
|
88
|
+
var MissingPluginError = class extends KnownError {
|
|
77
89
|
constructor(capability) {
|
|
78
90
|
const plugins = providersOf(capability);
|
|
79
91
|
const pkgList = plugins.map((it) => it.pkg).join(", ");
|
|
@@ -88,7 +100,7 @@ var MissingPluginError = class extends Error {
|
|
|
88
100
|
* capability. The message is load-bearing for the "ambiguity → user narrows
|
|
89
101
|
* config" UX (decision 003) — `registry.test.ts` asserts the plugin names appear.
|
|
90
102
|
*/
|
|
91
|
-
var MultipleProvidersError = class extends
|
|
103
|
+
var MultipleProvidersError = class extends KnownError {
|
|
92
104
|
constructor(kind, pluginNames) {
|
|
93
105
|
const names = pluginNames.join(", ");
|
|
94
106
|
const example = pluginNames.map((name) => `${name}({ only: ['${kind}'] })`).join(" or ");
|
|
@@ -869,14 +881,14 @@ function createPackCommand(ctx) {
|
|
|
869
881
|
//#endregion
|
|
870
882
|
//#region src/errors/invalid-plugin-module.ts
|
|
871
883
|
/** Thrown when an installed plugin package doesn't export a default factory function. */
|
|
872
|
-
var InvalidPluginModuleError = class extends
|
|
884
|
+
var InvalidPluginModuleError = class extends KnownError {
|
|
873
885
|
constructor(pkgName) {
|
|
874
886
|
super(`Plugin '${pkgName}' did not export a default factory function.`);
|
|
875
887
|
}
|
|
876
888
|
};
|
|
877
889
|
//#endregion
|
|
878
890
|
//#region src/errors/unknown-plugin.ts
|
|
879
|
-
var UnknownPluginError = class extends
|
|
891
|
+
var UnknownPluginError = class extends KnownError {
|
|
880
892
|
constructor(name) {
|
|
881
893
|
super(`'${name}' is invalid for argument 'name'. Allowed choices are ${allPluginNames().join(", ")}.`);
|
|
882
894
|
}
|
|
@@ -1694,7 +1706,29 @@ async function createProgram(meta) {
|
|
|
1694
1706
|
return cmd;
|
|
1695
1707
|
}
|
|
1696
1708
|
//#endregion
|
|
1709
|
+
//#region src/program/report-error.ts
|
|
1710
|
+
/**
|
|
1711
|
+
* Renders a fatal error at the program boundary. A `KnownError` is a user-facing
|
|
1712
|
+
* domain error (missing plugin, bad config, …) — print just its message so the
|
|
1713
|
+
* guidance it carries lands without a wall of stack frames. Anything else is an
|
|
1714
|
+
* unexpected bug: surface the full stack so it can be reported.
|
|
1715
|
+
*
|
|
1716
|
+
* Only renders; the caller sets `process.exitCode`.
|
|
1717
|
+
*/
|
|
1718
|
+
function reportError(error) {
|
|
1719
|
+
if (error instanceof KnownError) {
|
|
1720
|
+
logger.error(error.message);
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1723
|
+
logger.error(error instanceof Error ? error.stack ?? error.message : error);
|
|
1724
|
+
}
|
|
1725
|
+
//#endregion
|
|
1697
1726
|
//#region src/run.ts
|
|
1698
|
-
|
|
1727
|
+
try {
|
|
1728
|
+
await (await createProgram(import.meta)).run();
|
|
1729
|
+
} catch (error) {
|
|
1730
|
+
reportError(error);
|
|
1731
|
+
process.exitCode = 1;
|
|
1732
|
+
}
|
|
1699
1733
|
//#endregion
|
|
1700
1734
|
export {};
|
|
@@ -10228,7 +10228,7 @@ function memo(fn) {
|
|
|
10228
10228
|
};
|
|
10229
10229
|
}
|
|
10230
10230
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
10231
|
-
const MagicString = (await import("./magic-string.es-
|
|
10231
|
+
const MagicString = (await import("./magic-string.es-Dk-MMA0F.mjs")).default;
|
|
10232
10232
|
const files = new Set(snapshots.map((i) => i.file));
|
|
10233
10233
|
await Promise.all(Array.from(files).map(async (file) => {
|
|
10234
10234
|
const snaps = snapshots.filter((i) => i.file === file);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as Linter, c as StaticChecker, d as TestRunner, o as Packer, p as TypeChecker, r as Formatter, t as Doctor } from "./tool-
|
|
2
|
-
import { Pkg, ShellService } from "@
|
|
3
|
-
import { AnyLogger } from "@
|
|
1
|
+
import { a as Linter, c as StaticChecker, d as TestRunner, o as Packer, p as TypeChecker, r as Formatter, t as Doctor } from "./tool-faVTe0v0.mjs";
|
|
2
|
+
import { Pkg, ShellService } from "@variablelab/clibuddy";
|
|
3
|
+
import { AnyLogger } from "@variablelab/loggy";
|
|
4
4
|
|
|
5
5
|
//#region src/services/release.d.ts
|
|
6
6
|
type ReleaseServiceOptions = {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rrlab/cli",
|
|
3
|
-
"version": "1.3.0",
|
|
3
|
+
"version": "1.3.2-git-234d4f0.0",
|
|
4
4
|
"description": "The CLI toolbox to fullstack common scripts in Variable Land",
|
|
5
|
-
"homepage": "https://github.com/
|
|
5
|
+
"homepage": "https://github.com/withvariablelab/dx/tree/main/run-run/cli#readme",
|
|
6
6
|
"bugs": {
|
|
7
|
-
"url": "https://github.com/
|
|
7
|
+
"url": "https://github.com/withvariablelab/dx/issues"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/
|
|
11
|
+
"url": "git+https://github.com/withvariablelab/dx.git",
|
|
12
12
|
"directory": "run-run/cli"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"memoize": "10.2.0",
|
|
58
58
|
"nypm": "0.6.0",
|
|
59
59
|
"rimraf": "6.1.3",
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
60
|
+
"@variablelab/loggy": "0.2.2",
|
|
61
|
+
"@variablelab/clibuddy": "0.7.3-git-234d4f0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"tsdown": "0.22.0",
|
|
65
|
-
"@rrlab/tsdown-config": "^0.1.
|
|
65
|
+
"@rrlab/tsdown-config": "^0.1.1"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsdown && pnpm build:kdl",
|
package/src/actions/clean.ts
CHANGED
package/src/actions/config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { palette } from "@
|
|
1
|
+
import { palette } from "@variablelab/clibuddy";
|
|
2
2
|
import { Lines } from "#src/render/lines.ts";
|
|
3
3
|
import { configuredPlugins, pkgCell, pluginVersionCell, relPath } from "#src/render/plugin-view.ts";
|
|
4
4
|
import type { ContextValue } from "#src/services/context.ts";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { KnownError } from "./known-error.ts";
|
|
2
|
+
|
|
1
3
|
/** Thrown when an installed plugin package doesn't export a default factory function. */
|
|
2
|
-
export class InvalidPluginModuleError extends
|
|
4
|
+
export class InvalidPluginModuleError extends KnownError {
|
|
3
5
|
constructor(pkgName: string) {
|
|
4
6
|
super(`Plugin '${pkgName}' did not export a default factory function.`);
|
|
5
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for user-facing domain errors. The top-level handler (`reportError`
|
|
3
|
+
* in `src/program/report-error.ts`) renders a `KnownError` as a clean message —
|
|
4
|
+
* no stack trace — and exits 1. Anything that is NOT a `KnownError` is treated
|
|
5
|
+
* as an unexpected bug and surfaces its full stack so it can be reported.
|
|
6
|
+
*
|
|
7
|
+
* Don't set `this.name` in subclasses — keep the plain `Error:` prefix so output
|
|
8
|
+
* stays clean.
|
|
9
|
+
*/
|
|
10
|
+
export class KnownError extends Error {}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { providersOf } from "#src/lib/plugin/directory.ts";
|
|
2
2
|
import type { PluginCapability } from "../lib/plugin/index.ts";
|
|
3
|
+
import { KnownError } from "./known-error.ts";
|
|
3
4
|
|
|
4
|
-
export class MissingPluginError extends
|
|
5
|
+
export class MissingPluginError extends KnownError {
|
|
5
6
|
constructor(capability: PluginCapability) {
|
|
6
7
|
const plugins = providersOf(capability);
|
|
7
8
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { KnownError } from "./known-error.ts";
|
|
2
|
+
|
|
1
3
|
/** Thrown when a configured plugin targets an apiVersion the kernel doesn't support. */
|
|
2
|
-
export class PluginApiVersionError extends
|
|
4
|
+
export class PluginApiVersionError extends KnownError {
|
|
3
5
|
constructor(pluginName: string, got: number) {
|
|
4
6
|
super(`Plugin '${pluginName}' targets apiVersion ${got}, but this kernel supports only apiVersion 1.`);
|
|
5
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { allPluginNames } from "#src/lib/plugin/directory.ts";
|
|
2
|
+
import { KnownError } from "./known-error.ts";
|
|
2
3
|
|
|
3
|
-
export class UnknownPluginError extends
|
|
4
|
+
export class UnknownPluginError extends KnownError {
|
|
4
5
|
constructor(name: string) {
|
|
5
6
|
super(`'${name}' is invalid for argument 'name'. Allowed choices are ${allPluginNames().join(", ")}.`);
|
|
6
7
|
}
|
package/src/lib/plugin/errors.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { KnownError } from "#src/errors/known-error.ts";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Thrown by `PluginRegistry.get` when more than one plugin provides the same
|
|
3
5
|
* capability. The message is load-bearing for the "ambiguity → user narrows
|
|
4
6
|
* config" UX (decision 003) — `registry.test.ts` asserts the plugin names appear.
|
|
5
7
|
*/
|
|
6
|
-
export class MultipleProvidersError extends
|
|
8
|
+
export class MultipleProvidersError extends KnownError {
|
|
7
9
|
constructor(kind: string, pluginNames: readonly string[]) {
|
|
8
10
|
const names = pluginNames.join(", ");
|
|
9
11
|
const example = pluginNames.map((name) => `${name}({ only: ['${kind}'] })`).join(" or ");
|
package/src/lib/plugin/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Pkg, ShellService } from "@
|
|
2
|
-
import type { AnyLogger as Logger } from "@
|
|
1
|
+
import type { Pkg, ShellService } from "@variablelab/clibuddy";
|
|
2
|
+
import type { AnyLogger as Logger } from "@variablelab/loggy";
|
|
3
3
|
import type { ReleaseService } from "#src/services/release.ts";
|
|
4
4
|
import type { Doctor, Formatter, Linter, Packer, StaticChecker, TestRunner, TypeChecker } from "#src/types/tool.ts";
|
|
5
5
|
|
package/src/program/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { dirnameOf } from "@
|
|
2
|
+
import { dirnameOf } from "@variablelab/clibuddy";
|
|
3
3
|
import { ContextService } from "#src/services/context.ts";
|
|
4
4
|
import { createCheckCommand } from "./commands/check.ts";
|
|
5
5
|
import { createCleanCommand } from "./commands/clean.ts";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { KnownError } from "#src/errors/known-error.ts";
|
|
2
|
+
import { logger } from "#src/services/logger.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Renders a fatal error at the program boundary. A `KnownError` is a user-facing
|
|
6
|
+
* domain error (missing plugin, bad config, …) — print just its message so the
|
|
7
|
+
* guidance it carries lands without a wall of stack frames. Anything else is an
|
|
8
|
+
* unexpected bug: surface the full stack so it can be reported.
|
|
9
|
+
*
|
|
10
|
+
* Only renders; the caller sets `process.exitCode`.
|
|
11
|
+
*/
|
|
12
|
+
export function reportError(error: unknown): void {
|
|
13
|
+
if (error instanceof KnownError) {
|
|
14
|
+
logger.error(error.message);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
logger.error(error instanceof Error ? (error.stack ?? error.message) : error);
|
|
19
|
+
}
|
package/src/program/root.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { generateToStdout } from "@usage-spec/commander";
|
|
2
|
-
import { palette } from "@
|
|
2
|
+
import { palette } from "@variablelab/clibuddy";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { getBannerText } from "#src/render/banner.ts";
|
|
5
5
|
import { getFooterText } from "#src/render/footer.ts";
|
package/src/render/banner.ts
CHANGED
package/src/render/board.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BoardOptions, type BoardResult, type BoardTask, runTaskBoard } from "@
|
|
1
|
+
import { type BoardOptions, type BoardResult, type BoardTask, runTaskBoard } from "@variablelab/clibuddy";
|
|
2
2
|
import type { RunReport } from "#src/types/tool.ts";
|
|
3
3
|
|
|
4
4
|
export type { BoardResult, BoardTask };
|
package/src/render/footer.ts
CHANGED
package/src/render/labels.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { palette } from "@
|
|
2
|
+
import { palette } from "@variablelab/clibuddy";
|
|
3
3
|
import { allPluginNames, isPluginName, PLUGINS_DIRECTORY } from "#src/lib/plugin/directory.ts";
|
|
4
4
|
import type { ContextValue } from "#src/services/context.ts";
|
|
5
5
|
import { readPluginMeta } from "#src/services/plugin-meta.ts";
|
package/src/run.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { createProgram } from "./program/index.ts";
|
|
2
|
+
import { reportError } from "./program/report-error.ts";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
await program.run();
|
|
4
|
+
try {
|
|
5
|
+
const program = await createProgram(import.meta);
|
|
6
|
+
await program.run();
|
|
7
|
+
} catch (error) {
|
|
8
|
+
// Both context build-up (createProgram) and command execution (run) can throw
|
|
9
|
+
// domain errors; render them cleanly here rather than letting Node dump a raw
|
|
10
|
+
// stack trace. `process.exitCode` (not `process.exit`) lets the logger's
|
|
11
|
+
// stderr write flush before the process tears down.
|
|
12
|
+
reportError(error);
|
|
13
|
+
process.exitCode = 1;
|
|
14
|
+
}
|
package/src/services/context.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import { createPkg, createShellService, cwd, type Pkg, type ShellService } from "@
|
|
2
|
+
import { createPkg, createShellService, cwd, type Pkg, type ShellService } from "@variablelab/clibuddy";
|
|
3
3
|
import { PluginApiVersionError } from "#src/errors/plugin-api-version.ts";
|
|
4
4
|
import { PluginRegistry } from "#src/lib/plugin/registry.ts";
|
|
5
5
|
import type { PluginContext } from "#src/lib/plugin/types.ts";
|
package/src/services/logger.ts
CHANGED
package/src/ui/theme.ts
CHANGED
|
File without changes
|
|
File without changes
|