Skip to content

feat(cli): add the grus client commands and repl - #51

Merged
TheMeinerLP merged 1 commit into
mainfrom
feat/v2-cli-rebased
Nov 25, 2026
Merged

TheMeinerLP merged 1 commit into
mainfrom
feat/v2-cli-rebased

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

What was the problem

The grus binary could only run the controller. Operators had no way to look at pools and instances, apply a pool definition, read a log or stop a server without writing curl calls against the REST API.

What changed

grus is now also the command line client. The existing controller, fetch, openapi and version subcommands behave as before (same flags, same environment variables). New commands: get, describe, apply -f, scale, stop, logs [-f], exec, events, network, login and config, with -o table|json|yaml and shell completion scripts for bash, zsh, fish and PowerShell.

grus shell starts an interactive session on the same commands, with a history file in the user config directory, the context name in the prompt, and tab completion of pool, instance, template, group, environment and host names taken live from the controller (cached for a few seconds).

Connections are saved as contexts in ~/.config/grus/config.yaml. The token comes from GRUS_TOKEN or a token file and is never printed. Groups, environments, hosts and the network count are requested from endpoints that other changes add; an older controller answers with a clear "not supported by this controller" message instead of a raw 404.

How it was tested

Unit tests run the commands in process against httptest servers (output formats, apply ordering and validation, scale, stop, logs, events, contexts, token handling), the API client has its own tests, and completion is tested including cache expiry with an injected clock. The existing end-to-end test still passes. grus shell was smoke-tested by hand.

Move the grus binary to cobra, keeping controller, fetch, openapi and
version as they were. Add get, describe, apply, scale, stop, logs, exec,
events, network, login and config commands on a small typed API client,
plus shell completions and an interactive shell with live completion of
resource names.
@TheMeinerLP
TheMeinerLP merged commit 58123e1 into main Nov 25, 2026
6 checks passed
@TheMeinerLP
TheMeinerLP deleted the feat/v2-cli-rebased branch November 25, 2026 10:00
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