Skip to content

tui: run onctl claude on a VM and switch providers - #1216

Merged
cdalar merged 2 commits into
mainfrom
tui-claude-and-provider-switch
Oct 22, 2026
Merged

cdalar merged 2 commits into
mainfrom
tui-claude-and-provider-switch

Conversation

@cdalar

@cdalar cdalar commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • a / :claude [vm] runs onctl claude --box <vm> from the tui as a child process, like s runs onctl ssh. With no VM named, :claude uses the project's own box (claude-<dir>), as the CLI does. The project is the directory the tui was started in.
  • :provider [name] switches the cloud like k9s's :ctx. Without a name, a providers view lists them with the current one marked, and enter picks one.
  • The switch quits the tui and restarts it on the other provider (ONCTL_CLOUD, config and client redone as onctl -p name tui would). It isn't done in place because several provider clients call os.Exit when credentials are missing, which would leave the terminal on a half-torn alt screen with the log output discarded. A config that fails to load brings the tui back on the provider it had, flashing the reason.

Test plan

  • go test ./cmd/ and golangci-lint run ./cmd/ are clean
  • New tests: claude child args, :provider command (unknown / current / other), providers view and enter, start flash, restore of cloudProvider and ONCTL_CLOUD after a failed switch, claude child's exit handling
  • Manual: onctl tui, a on a VM attaches Claude; :provider hetzner restarts on Hetzner

🤖 Generated with Claude Code

https://claude.ai/code/session_011AG9gwAvNhBSqhahfzk28R

cdalar and others added 2 commits October 22, 2026 06:46
onctl's credentials are its own. Dropped every fallback to what boxctl
saved on this machine:

- the boxes token in ~/.boxctl/config.json (onctl login's file is the
  only one read now)
- the Claude token in the boxctl-claude-oauth-token Keychain entry and
  ~/.boxctl/claude/oauth-token (and logout no longer deletes them)
- the ssh key in ~/.boxctl/claude/id_ed25519 (onctl makes its own)
- BOXCTL_GITHUB_TOKEN for --github store (ONCTL_GITHUB_TOKEN only)

Paths on the box itself (/root/.boxctl/..., BOXCTL_GH_SOCKET) stay: the
box image's helpers read them.

Claude-Session: https://claude.ai/code/session_01SB788HixFrKbYGCxDRi8fX
The tui runs `onctl claude --box <vm>` as a child process, like ssh and
create: a on the VM under the cursor, or :claude [vm] (the project's
own box without a name). :provider [name] switches the cloud the way
k9s's :ctx switches clusters: without a name a providers view lists
them and enter picks one. The switch quits the tui and starts it again
on the other provider, since a provider's client exits the process when
its credentials are missing; a config that fails to load brings the tui
back on the provider it had, with the reason.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011AG9gwAvNhBSqhahfzk28R
@cdalar
cdalar enabled auto-merge (squash) October 22, 2026 04:56
@cdalar
cdalar merged commit e171e43 into main Oct 22, 2026
12 checks passed
@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.22330% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.57%. Comparing base (870b760) to head (76fa1b0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/tui.go 55.81% 19 Missing ⚠️
cmd/claudeauth.go 0.00% 13 Missing ⚠️
cmd/tuiactions.go 74.19% 8 Missing ⚠️
internal/providerboxes/credentials.go 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1216      +/-   ##
==========================================
+ Coverage   45.24%   45.57%   +0.33%     
==========================================
  Files          75       75              
  Lines        8735     8778      +43     
==========================================
+ Hits         3952     4001      +49     
+ Misses       4782     4777       -5     
+ Partials        1        0       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

⌂ 换网址