Skip to content

feat: instance context, openclaw proxy, and shell pass-through#16

Merged
TimBeyer merged 9 commits intomainfrom
feat/instance-context-cli-proxy
Mar 13, 2026
Merged

feat: instance context, openclaw proxy, and shell pass-through#16
TimBeyer merged 9 commits intomainfrom
feat/instance-context-cli-proxy

Conversation

@TimBeyer
Copy link
Owner

Summary

  • Instance context resolution: all instance commands (status, start, stop, restart, delete, shell, openclaw) resolve the target instance via a 4-level chain: --instance/-i flag → CLAWCTL_INSTANCE env var → .clawctl file (walks up from cwd) → ~/.config/clawctl/context.json. No more typing the instance name every time.
  • clawctl openclaw / clawctl oc: proxy any openclaw subcommand into the VM from the host — clawctl oc doctor, clawctl oc daemon status, clawctl oc config get gateway.name, etc.
  • clawctl shell -- <cmd>: run an arbitrary command in the VM without an interactive shell — clawctl shell -- whoami, clawctl shell -- systemctl --user status openclaw-gateway.
  • clawctl use [name] [--global]: set or show the current instance context (writes .clawctl in cwd or ~/.config/clawctl/context.json).
  • Positional <name> → optional [name]: all instance commands still accept a positional name for convenience, but it's no longer required.
  • Updated all user-facing hints: post-onboarding messages, retry instructions, wizard finish screen, and device approval steps now use clawctl oc / clawctl shell instead of raw limactl shell commands.
  • Updated docs: README (commands table, new sections for instance context and openclaw proxy), getting-started, architecture, troubleshooting, and TODO.

Test plan

  • bun test — 275 tests pass (20 new: shell-quote + instance-context)
  • bun run lint — clean
  • bun run format:check — clean
  • Manual: clawctl use <name> sets context, subsequent commands resolve without name
  • Manual: clawctl oc doctor runs openclaw doctor in the VM
  • Manual: clawctl shell -- whoami runs command and exits
  • Manual: clawctl status / clawctl status -i <name> / CLAWCTL_INSTANCE=<name> clawctl status all work

🤖 Generated with Claude Code

TimBeyer and others added 9 commits March 13, 2026 11:54
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Instance resolution: --instance/-i flag → CLAWCTL_INSTANCE env →
  .clawctl file (walk up) → ~/.config/clawctl/context
- `clawctl openclaw` (alias: `oc`) proxies commands to VM
- `clawctl shell -- <cmd>` runs a command in the VM via --
- `clawctl use <name>` sets local/global instance context
- All instance commands accept optional positional [name] or -i flag
- Shared requireInstance() replaces duplicated registry lookup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Context files now store `{ "instance": "name" }` instead of plain text.
Reading still falls back to plain text for backwards compatibility.
Global context file renamed from `context` to `context.json`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Commander rejected positional arguments like `openclaw doctor` because
the command had no declared arguments. Adding `[args...]` lets all
subcommand args pass through.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- README: updated commands table, added instance context and openclaw
  proxy sections, refreshed day-to-day examples
- getting-started: use `clawctl oc doctor` and `clawctl use`
- architecture: added new files to directory listing
- troubleshooting: use context-aware command forms
- TODO: marked instance registry, CLI proxy, and restart as done

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The thrown error from resolveInstance was bubbling up as an unhandled
exception with a stack trace. Now caught and printed as a clean message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace raw `limactl shell <vm> -- openclaw ...` instructions with the
new `clawctl oc` and `clawctl shell` forms in all user-facing output:
wizard finish screen, onboarding retry hints, device approval steps,
and headless completion messages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Commander mixes positional args after -- into declared [name], causing
`shell -- ls /` to treat "ls" as the instance name. Now parses
process.argv to find -- and separates the instance name (before --)
from the pass-through command (after --).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@TimBeyer TimBeyer merged commit cd4266a into main Mar 13, 2026
4 checks passed
@TimBeyer TimBeyer deleted the feat/instance-context-cli-proxy branch March 13, 2026 11:20
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