From 6f4a632ec92ebc2408030ec9c1a78324ae3cbf34 Mon Sep 17 00:00:00 2001 From: elvis kahoro Date: Sat, 24 Oct 2026 13:10:47 +0000 Subject: [PATCH] fix(cli): replace invalid preset example and dead recovery URL Use valid example preset b1000, point the invalid-preset error and help text at buridan.reflex.run/create, and send the error to stderr. Co-Authored-By: Claude Sonnet 5.5 --- assets/docs/getting-started/cli.md | 2 +- .../docs/getting-started/components-json.md | 2 +- cli/README.md | 2 +- cli/main.py | 5 ++-- docs/getting_started/cli.md | 2 +- docs/getting_started/components-json.md | 2 +- tests/test_cli_apply_preset.py | 28 +++++++++++++++++++ 7 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 tests/test_cli_apply_preset.py diff --git a/assets/docs/getting-started/cli.md b/assets/docs/getting-started/cli.md index f3fb4156..483c7c5f 100644 --- a/assets/docs/getting-started/cli.md +++ b/assets/docs/getting-started/cli.md @@ -58,7 +58,7 @@ Example: ```bash buridan apply --preset b0 -buridan apply --preset b2D0wqNxT +buridan apply --preset b1000 ``` Re-running `buridan apply` with a different preset overwrites the theme section of `components.json` and the generated CSS variables — it does not touch any components you've already added. diff --git a/assets/docs/getting-started/components-json.md b/assets/docs/getting-started/components-json.md index 05cb64c3..b52f9e39 100644 --- a/assets/docs/getting-started/components-json.md +++ b/assets/docs/getting-started/components-json.md @@ -79,7 +79,7 @@ The raw preset ID from the [theme builder](/docs/getting-started/cli#create), ex ```json { "theme": { - "preset": "b2D0wqNxT" + "preset": "b1000" } } ``` diff --git a/cli/README.md b/cli/README.md index a186da44..2e1fa45b 100644 --- a/cli/README.md +++ b/cli/README.md @@ -34,7 +34,7 @@ Example: ```bash buridan apply --preset b0 -buridan apply --preset b2D0wqNxT +buridan apply --preset b1000 ``` ## add diff --git a/cli/main.py b/cli/main.py index 9b2caf4b..81866451 100644 --- a/cli/main.py +++ b/cli/main.py @@ -513,7 +513,8 @@ def cmd_apply(preset: str): ) if not config: print( - f"Error: Invalid preset ID '{preset}'. Get a valid preset from https://buridan-ui.com/create" + f"Error: Invalid preset ID '{preset}'. Get a valid preset from https://buridan.reflex.run/create", + file=sys.stderr, ) sys.exit(1) @@ -621,7 +622,7 @@ def main(): sub.add_parser("create", help="Open the Buridan UI theme builder in your browser") apply_p = sub.add_parser( - "apply", help="Apply a theme preset (from buridan-ui.com/create)" + "apply", help="Apply a theme preset (from buridan.reflex.run/create)" ) apply_p.add_argument( "--preset", required=True, help="Preset ID e.g. b0 or b2D0wqNxT" diff --git a/docs/getting_started/cli.md b/docs/getting_started/cli.md index f3fb4156..483c7c5f 100644 --- a/docs/getting_started/cli.md +++ b/docs/getting_started/cli.md @@ -58,7 +58,7 @@ Example: ```bash buridan apply --preset b0 -buridan apply --preset b2D0wqNxT +buridan apply --preset b1000 ``` Re-running `buridan apply` with a different preset overwrites the theme section of `components.json` and the generated CSS variables — it does not touch any components you've already added. diff --git a/docs/getting_started/components-json.md b/docs/getting_started/components-json.md index 05cb64c3..b52f9e39 100644 --- a/docs/getting_started/components-json.md +++ b/docs/getting_started/components-json.md @@ -79,7 +79,7 @@ The raw preset ID from the [theme builder](/docs/getting-started/cli#create), ex ```json { "theme": { - "preset": "b2D0wqNxT" + "preset": "b1000" } } ``` diff --git a/tests/test_cli_apply_preset.py b/tests/test_cli_apply_preset.py new file mode 100644 index 00000000..1b7454d0 --- /dev/null +++ b/tests/test_cli_apply_preset.py @@ -0,0 +1,28 @@ +import pytest + +from cli import main as cli_main + + +def test_documented_example_preset_decodes(): + cfg = cli_main.decode_seed( + "b1000", + cli_main.BASE_THEMES, + cli_main.COLOR_THEMES, + cli_main.STYLE_REGISTRY, + cli_main.RADII_OPTIONS, + cli_main.FONT_REGISTRY, + ) + assert cfg + + +def test_invalid_preset_errors_to_stderr(tmp_path, monkeypatch, capsys): + (tmp_path / "rxconfig.py").write_text("") + monkeypatch.chdir(tmp_path) + with pytest.raises(SystemExit) as exc: + cli_main.cmd_apply("zzz-invalid") + assert exc.value.code == 1 + out = capsys.readouterr() + assert "Invalid preset ID" in out.err + assert "buridan.reflex.run/create" in out.err + assert "buridan-ui.com" not in out.err + assert out.out == ""