Skip to content

Client/host command classification with role-aware CLI display - #462

Closed
sammy-vastai wants to merge 1 commit into
masterfrom
cln-3582-client-host-cli
Closed

Client/host command classification with role-aware CLI display#462
sammy-vastai wants to merge 1 commit into
masterfrom
cln-3582-client-host-cli

Conversation

@sammy-vastai

@sammy-vastai sammy-vastai commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Classifies every CLI command as host-only or not (is_host_only_command() in vastai/cli/parser.py), replacing the 26 hand-written [Host] help-text prefixes with an auto-rendered one derived from the classification.
  • Adds a stored client/host role (~/.config/vastai/vast_role) that filters --help, tab completion, and error hints — display-only, never gates execution; the server remains the real permission enforcement layer.
  • Client is the default. Host-only commands only show once the role is explicitly resolved to host (vastai set role host, or auto-detection in the follow-up PR). An unset or unrecognized role is treated as client, not "show everything" — this is what actually makes fresh installs show the filtered view without requiring the auto-detection in Auto-detect the client/host role from an existing API key #463.
  • vastai set role host|client to manually set/override the role.
  • A client-role user hitting a machine_read-style 401 on a host command gets a "did you mean" hint (e.g. show machinesshow instances).

Auto-detecting the role from an existing API key (rather than requiring set role to be run manually) is split into a follow-up stacked PR: #463.

Test plan

  • poetry run pytest tests/cli — 397 passed
  • Manually verified: a completely fresh install (no role file, no key) shows the filtered client view by default; set role host/set role client toggle correctly; the 401 hint fires even with an unset role
  • Confirmed pre-existing failures in test_tar_utils.py/test_search.py are unrelated (present on master too)

CLN-3582

@sammy-vastai

Copy link
Copy Markdown
Contributor Author

Superseded by #484, which combines this and #463 into a single branch (rebased onto current master, conflicts resolved, tests passing).

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