Skip to content

Fix btw --version and require ellmer (>= 0.4.2) - #214

Merged
gadenbuie merged 7 commits into
mainfrom
fix/btw-cli-version
Sep 7, 2026
Merged

gadenbuie merged 7 commits into
mainfrom
fix/btw-cli-version

Conversation

@gadenbuie

Copy link
Copy Markdown
Collaborator

Summary

Fixes btw --version, which previously printed Rapp's usage message and exited before the script body ran: Rapp marks top-level switches required by default, so the version flag was never checked. The top-level switch is now optional and the auto-generated --no-version alias is suppressed.

Also modernizes ellmer usage, raising the minimum version to 0.4.2:

  • Removed the set_model() monkey-patch — ellmer has shipped Chat$set_model() since 0.4.2.
  • Replaced client_get_models()'s 75-line per-provider dispatch table with a thin wrapper over ellmer's internal models_list() generic (feat: add models_list() S7 generic to Provider class tidyverse/ellmer#993), which now handles per-provider URL and credential details.
  • Removed the dead ellmer <= 0.3.0 branch in chat_get_tokens().
  • Replaced the deprecated get_provider()@model accessor with get_model() in tests, and test snapshots no longer depend on ellmer's default Anthropic model (scrubbed to DEFAULT_MODEL via the snapshot transform).

Verification

btw --version   # now prints e.g. "1.4.0.9000"
Rscript -e 'devtools::test()'   # all 2211 tests pass

Rapp command switches are required by default, so Rapp printed usage
and exited before the script body ran, and the version flag was never
checked. Mark the top-level switch as optional so the body (including
the version block and the no-command self-help path) executes. Also
suppress the generated --no-version alias.
Snapshot tests printing chat clients broke whenever ellmer changed its
default model. Normalize it to DEFAULT_MODEL in scrub_system_info().
Guard the set_model() shim to ellmer < 0.4.2, the versions that
predate Chat$set_model() and still use the @model slot. Also switch
a test assertion to the get_model() accessor.
Remove the set_model() monkey-patch, now shipped by ellmer since
0.4.2, and replace client_get_models()'s provider dispatch table
with ellmer's internal models_list() generic (tidyverse/ellmer#993).
Also drop the dead ellmer <= 0.3.0 branch in chat_get_tokens().
@gadenbuie
gadenbuie marked this pull request as ready for review September 7, 2026 01:56
@gadenbuie
gadenbuie merged commit 4c39fcf into main Sep 7, 2026
9 checks passed
@gadenbuie
gadenbuie deleted the fix/btw-cli-version branch September 7, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant