feat: instance context, openclaw proxy, and shell pass-through#16
Merged
feat: instance context, openclaw proxy, and shell pass-through#16
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
status,start,stop,restart,delete,shell,openclaw) resolve the target instance via a 4-level chain:--instance/-iflag →CLAWCTL_INSTANCEenv var →.clawctlfile (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.clawctlin cwd or~/.config/clawctl/context.json).<name>→ optional[name]: all instance commands still accept a positional name for convenience, but it's no longer required.clawctl oc/clawctl shellinstead of rawlimactl shellcommands.Test plan
bun test— 275 tests pass (20 new: shell-quote + instance-context)bun run lint— cleanbun run format:check— cleanclawctl use <name>sets context, subsequent commands resolve without nameclawctl oc doctorruns openclaw doctor in the VMclawctl shell -- whoamiruns command and exitsclawctl status/clawctl status -i <name>/CLAWCTL_INSTANCE=<name> clawctl statusall work🤖 Generated with Claude Code