devvm cursor is devvm code's twin for Cursor, the editor. It gets the
folder's VM ready as devvm host does, then runs
`cursor --remote ssh-remote+HOST DIR` in devvm's place, with the SSH
agent devvm started with. Without `cursor` on PATH it fails with
no_cursor_command, naming the host to connect to.
Cursor's Agent and your sign-in (from CJ's manual check with a real
login): recent Cursor runs Agent in the editor's server in the VM, which
holds your Cursor sign-in in memory only (no token on disk, in any
environment or command line) and calls Cursor from the VM. Cursor's
`cursorAgentHost.remoteInferenceRoute` is application-scoped, so it's
read only from the user settings on this machine; with it set to
"always", Agent's own requests go through the Cursor app here, while
the VM's server still talks to Cursor.
- vm: Code and Cursor share openRemote; vm.CursorCommand names the
editor's command, apart from the CLI agent's agents.Cursor. After
LookPath finds `cursor`, devvm reads Cursor's user settings on this
machine (platform.AppSettingsDir: Application Support on macOS,
$XDG_CONFIG_HOME or ~/.config on Linux) through safefile.Read, 1 MiB
at most, read-only, as JSON with comments, and warns with
cursor_agent_in_vm unless the route is "always". It never fails on
the file.
- sync.sh: Cursor's ~/.cursor-server/data/Machine/settings.json gets VS
Code's remote.autoForwardPorts, git.terminalAuthentication and
github.gitAuthentication off, in one loop over both editors' files.
devvm doesn't write the route there, since Cursor ignores it.
- structure: nameFree lets a literal that is an agent's name stand in
one file, with its reason, and fails when it frees nothing.
- cli: cursor.go (--ssh-config, --here, --parent), registered beside
code; cursor_failed, no_cursor_command, cursor_agent_in_vm and their
doc links; ssh_host_info names Cursor too; the cli skill's judgment
note: an editor's command is a bare verb named after the editor's.
- Tests: host_code.txtar (cursor, its full-name host, the missing
command, the warning and no warning once the route is set),
guest.txtar, TestCursorAgentWarning (always, absent, other values, no
file, broken JSON, too long, a FIFO, the XDG path; never written),
e2e network: devvm cursor passes the editor only the host and folder,
a fake editor sign-in on this machine reaches neither the VM's home,
its processes' environments nor the proxy's logs, and a Cursor login
in the store reaches the CLI's methods while the agent store's are
refused.
- Docs: SSH and editors (commands first; "Cursor's Agent": it runs in
the VM with your sign-in, the user-settings line, what it doesn't
cover, open only VMs you trust; if Tab doesn't work on the allowlist
tier, devvm network allow api3.cursor.sh), the agents page's Cursor
notes, Commands, attack vectors, design, the home page, CHANGELOG,
generated CLI pages.
Reviewed adversarially before the push: the settings read (size, FIFOs,
links), the warning's wording and when it fires. Researched with PR
#44's design as reference only.
Co-authored-by: JB <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A command's metadata moves from hand-kept tables into the command itself:
an about (docs page, help group, why no --json) set as its Cobra
Annotations. msg.commandDocs, commandGroups and withoutJSON are gone;
TestDocLinks reads the links from the generated CLI reference, and help
output and the reference are byte-identical. AGENTS.md's cli and vm rows
point at new doc.go package comments.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Commands fail by returning: RunE returns the error, as failed(err, what)
when it may not be a message (replacing fail and the direct Die calls in
cli), and a.env returns its failure. checkLayout returns its error from the
root's PersistentPreRunE. execute alone prints a failure (showFailure): a
backend.LoggedError with the run log's end (ui.ErrorLogged, which replaces
DieLogged), a message as it is, else what failed or output_failed, with a
corrupt file's message as names mode shows it. Exit codes stay 0, 1, 2, 130.
Die is now the UI's own die, for where no command can return: a question
without an answer, a run log that can't be opened. Error prints nothing once
the run is interrupted.
After INT, TERM or HUP, Main waited only for the logged command and then ran
the cleanups while the command's own code still ran. It now also waits for
the command to return, up to returnGrace (2 s), when there are cleanups to
run; a run without cleanups ends at once, so the proxy and the other
background processes still stop as soon as they are told to. A start's
undoStart stays registered once interrupted (interruptCleanup), as the
cleanups now run after the start returned.
Tests: TestSignalsWaitForTheCommandBeforeTheCleanups (failed on the old
ordering), TestSignalsWaitForAStuckCommandAWhile,
TestSignalsWithoutCleanupsEndAtOnce, TestExecuteShowsEachFailure;
DieLogged's tests are ErrorLogged's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The VM a folder uses is decided once, by vm's resolveFolder, from the
folder's own VM, the nearest parent folder's (with any repo of its own
in between) and the command's rule (vm.Env.Folder): by default the
folder's own, else the parent's unless a nested repo is in between,
else none (devvm makes the folder's own, other commands say no_vm).
--here takes only the folder's own; --parent takes the parent's across
a nested repo and past the folder's own, and refuses a folder inside
none with a VM (no_parent_vm). devvm asks nothing now, in a terminal
or not: use_parent_vm and use_parent_vm_repo are gone. The questions
before deleting, remaking or widening a parent's VM stay.
find resolves through it; own is the folder's own VM (adopt, --clone);
lookup and useParent are gone; Options.Here is the rule's.
cli: addFolderFlags (flags.go) adds --here and --parent into the run's
app, which vmEnv sets as the rule; the two are exclusive, and with -g
where a command has it; --clone and --parent are exclusive; devvm rm VM
takes neither (rm_vm_folder_flag). Commands: devvm, restart, stop,
update, rm, code, desktop, host, history export, tools (add, rm,
update), size, ports (add, rm), network (allow, deny, rm, log),
ssh-agent, git-protect, clone, secret use, secret unuse, layer add,
layer rm, group (join, leave), link (add, rm, publish, unpublish).
Tests: TestResolveFolder (own, parent, none, nested repo, --here,
--parent), TestFolderFlags (every folder command takes both, and no
other; refusals before anything runs; the rule each sets), the parent
tests and subfolder.txtar's cases updated for no questions and --parent.
Docs: the Commands page's subfolder section, first VM, --clone's
subfolders, the overview's subfolder VM; the CLI reference regenerated.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
NewRoot makes one app for the run's UI and hands it to every command.
The app makes each service the first time a command asks for it and
keeps it, or its error, for the rest of the run: devvm's folders
(dirs), a test build's overrides, the secrets store, the backends'
registry, the shared tools, the VM environment (vmEnv) and the image
builder of the backend new VMs get (builder). The retention that runs
before a command and the command itself share them.
- paths.FromEnv: 23 of 24 calls go through a.dirs; partNames, which the
parser's flag and word checks call before any command, keeps its own.
- The registry is made once (8 newRegistry calls and newEnv's).
- builder(u) (6 calls) and cli's newBuilder are gone: a.builder and the
per-backend builders in images, space and gc are vm.Env.Builder,
exported, the only builder. setup's feature choice takes a build.Env
of its folders and prompts alone.
- The shared tools are made once (newTools and vm.NewEnv's), and the
secrets store once (companyProxy's, newTools', vm.NewEnv's and
_proxy's): vm.NewEnv takes the run's tools and store.
- withEnv (46 calls) is a.env; autoRetain, retainOrphans and gc
--orphans use the run's VM environment.
- thisHost and readOverrides' other callers read the overrides once
(a.host); space and gc --caches time out on the registry's host.
TestAppMakesEachServiceOnce checks that one run makes each service once
and that the VM environment and builder share the run's registry and
tools; TestAppKeepsAFailure that a failure is kept.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm --help lists the commands in groups: Your VM, Change your VM,
Images, Disk space and This machine, with help under Cobra's Additional
Commands. A group whose commands don't exist yet, such as Links between
VMs, stays out of the help.
Each command's Long is one to three sentences, and the rules it held are
on the command's docs page. Every visible command has an Example, with
the most common invocations first, each with a comment. Flag
descriptions are shorter. Each help ends with the address of the
command's docs page, and the root's also ends with the issue tracker.
- internal/cli/help.go: commandGroups, addGroups, addDocs (Cobra's usage
template with Docs and Issues sections), examples
- internal/msg/docs.go: commandDocs, CommandDoc, CommandDocURL,
IssuesURL; TestDocLinks checks commandDocs (user pages only)
- docgen: each reference page has a Docs section before See also
- docs: commands.md in the help's groups, with new sections on
restarting and stopping and on deleting a VM; install.md has doctor's
engine, feature values, Docker and CA notes; Contributing describes a
command's help
- tests: TestExamples, TestHelpGroupsAndDocs, TestAddGroups,
TestWithDocs, TestCheckCommandDocs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A global --no-input (persistent on the root, with --help and -v): no
question is asked or read. The ui's prompts (Ask, Confirm, Answer,
Secret, Pick/PickOne in a terminal) show the question, then fail with
no_input naming what answers it (msg.AnswerFor, by the question's ID),
or no_input_terminal for a question only a terminal answers. ui.Flags
and SetFlags carry -v and --no-input.
Answers: --network-policy/--no-network-policy, --here, devvm size -g,
devvm setup --features/--backend, devvm network -g, devvm ssh-agent add,
devvm restart, --ssh-config (new, on devvm, host and code: the Include
line without asking; sshconfig.Config.AddInclude, vm.Env.AddInclude),
--stdin, and --force.
--force (-f) only skips a confirmation, and destructive commands need it
without a terminal (force_needed, a failure, not a usage error): rm (new
rm_confirm), gc (it went ahead without a terminal), gc --caches (now
allowed without a terminal with --force), images rm (images_rm_confirm),
secret rm (secret_rm_confirm), adopt (adopt_vm), rebuild when images
are built on the one rebuilt (build.Env.Force). rm --no-export skips the
export; rm's parent-folder, earlier-folder and --clone confirmations are
terminal-only and --force never answers them (vm.RmOptions). gc --tools
--force splits: --recent (only with --tools, gc_recent_needs_tools)
drops the hour's hold and keeps the refusal while a VM is being made
(gc_recent_making); gc_tools_recent names devvm gc --tools --recent.
gc_caches_need_terminal goes.
Tests: TestNoInput, TestAnswers, TestConfirmed, TestRmConfirms, TestAdopt
(--force), TestRebuild (force_needed, then Force); secret, rebuild,
images, gc*, clone, subfolder, existing scripts. e2e: rm/gc/images
rm/secret rm/rebuild with --force (and --no-export where rm -f skipped
the export), and the clone section's rm with its checks. Docs:
commands.md (Questions devvm asks, rm, flags), first-vm, clone, images
(cleaning up, --recent), space, coding-agents, internals overview and
images; CLI reference.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every argument and flag error is a devvm message naming what the command
expected, followed by usage_help naming that command's own --help, and
exits with 2. Arguments and flag values are checked in Args, before the
root's PersistentPreRun and any VM lookup.
- internal/cli/args.go: noArgs, exactArgs, maxArgs, minArgs (argsN, with
ValidArgs), argsOf (the arguments in Use), checkCommands (wraps every
command's Args with checkFlags and marks RunE's errors as ranError),
checkFlagValue (--cpus, --memory, --disk, --ports, --lifetime,
--older-than), exclusive (flag groups checked first, then Cobra's own
required flags and groups), flagError (SetFlagErrorFunc: pflag's
NotExist, ValueRequired, InvalidValue, InvalidSyntax errors).
- Execute: 0, 1 for a failure (RunE's error: a message, or
output_failed), 2 for a usage error; usage_error is only the fallback.
- Checked early: ports LIST and add/rm LIST (vm.ParsePortList), network
allow/deny RULEs, network on/off(/ask with -g), layer new NAME
(build.CheckLayerName), retention KEY=VALUE (state.CheckRetention),
setup --features '', secret NAME, completion SHELL, git-protect and
ssh-agent values.
- ui.UI.Error prints an error without ending the run (UI's method limit
44).
- Messages: usage_help, arg_missing, args_too_many, args_none,
arg_not_choice, no_subcommand, flag_unknown, flag_needs_value,
flag_bad_value, flag_bad_switch, flags_exclusive, output_failed;
usage_error reworded; doc links to troubleshooting.
- Tests: TestUsageErrorsEveryCommand, TestRanErrorIsAFailure, TestArgsOf,
TestFlagErrors; txtars check message names; e2e checks a bad port list
exits 2.
- Docs: troubleshooting (a command refused before it runs, exit codes),
contributing (command arguments), AGENTS.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm ssh is devvm host. devvm tools shows this folder's VM's shared
tools (TOOL VERSION NEWER BUILT, from the lock as it is, never online);
devvm tools add/rm TOOL... add and take out shared tools, each a word of
its own (joined with + refused: tools_joined; add takes only shared
tools: unknown_tool), and devvm tools update moves the VM to the newest.
devvm IMAGE on a VM that exists adds nothing and asks nothing: it fails
with vm_lacks_tools, naming the devvm tools add command, or
vm_lacks_layer, as only a new VM gets a layer. devvm export is devvm
history export [FILE]; devvm history lists the exports in the exports
folder (FILE VM FOLDER DATE SIZE), the folder from a <export>.folder
file written beside devvm's own exports and deleted with them. gc
--exports is gc --history, retention's exports.age/count are
history.age/count, and devvm space's row is history.
The in-place layer machinery goes: Launch.addLayers and runLayers,
dockerLayers' inPlace/set/unset, backend.DockerLayerVM.SetDockerLayer
and the Docker backend's SetDockerLayer, with the add_in_place,
restart_for_mounts, no_terminal_confirm, keeping, adding and
add_layer_failed messages. vm.Tools (tools.go) holds Add, Remove,
Update and List; tools.VMs.Show lists a VM's tools; tools.Remove takes
names as a list; VMs.Update compares a VM's files as a set.
New messages: vm_lacks_tools, vm_lacks_layer, has_tools, tools_joined,
history_failed, tools_failed; renamed: unknown_tool, gc_history,
gc_history_export, deleted_history, gc_older_than_needs_history.
Command files: host.go, tools.go, history.go, refreshtools.go
(_refresh-tools); ssh.go, remove.go, update.go, export.go and
gc_exports.go gone. Tests: TestImageLacks, TestToolsAdd, TestShow,
TestCompleteToolNames; history.txtar, gc_history.txtar, host_code.txtar
and the e2e tools, docker layer and host checks updated. Docs, the CLI
reference, AGENTS.md and the e2e header follow.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Env holds the shared dependencies NewEnv sets and the helpers every
group uses: finding the folder's VM, starting it, applying its size and
ports, the image builder and the ssh config. The commands are on types
that embed *Env:
- Launch: up, restart, remove, update, ssh and code; a new VM
(up.go), an existing one (existing.go), ssh.go, agents' mounts
- Lifecycle: stop, adopt, rm and export (lifecycle.go)
- Settings: .git protection (settings.go), size (size.go), ports
(ports.go), SSH agent forwarding (sshagent.go)
- Net: network policy, its log and allowlist (network.go), secrets
(secret.go)
- clones (clone.go) and syncer (sync.go), used by the others
env.go holds Env, UI, NewEnv and the shared helpers. cli's commands
call the group they need, e.g. vm.Launch{Env: env}.Up. Tests follow
their code: env_test.go holds the shared helpers, with up_test.go,
lifecycle_test.go, network_test.go and ports_test.go beside them.
The most methods on one type is 24 (Launch).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
internal/ui has no package state: ui.UI holds the streams, terminal
flags, run log, status line, cleanup stack and interrupt flag, and its
functions are methods. ui.Main makes the run's UI on devvm's own
streams, owns signals, recovers Die and runs the cleanups; ui.New makes
one on other streams. cmd/devvm passes it to cli.Execute, and every cli
command gets it through its constructor.
Only cmd/devvm and internal/cli import internal/ui (a depguard rule).
Each other package defines the small UI interface it needs, which its
constructor takes, filling fields tests set:
- gitprotect.New, secrets.NewStore, from.NewLookup: a warn func
- ubuntu.New: LoggedCmd, Note
- netpolicy.NewProxy: Note, Warn, Ask, Confirm, StdinIsTerminal; its
log lines drop control characters themselves (oneLine)
- sshagent.New: Info, Note, Warn, LogWriter
- tools.New: Info, Warn, LogNote, Status, LoggedCmd, AddCleanup
- lima.New, smolvm.New: Info, Warn, LoggedCmd (their Runner's Run),
WithSteps, AddCleanup, Interrupted; lima LogNote and ubuntu's too
- backends.Registry: lima's and smolvm's
- vm.NewEnv: all of the above, Say, Stdout, Stderr; Env has Stdout,
LogNote, LogWriter, LoggedCmd, AddCleanup, Interrupted fields
- build.Builder: Terminal and LogNote fields
- sshconfig.New: its caller sets what it prints and asks
ui's tests build their own UI over buffers and run in parallel; other
packages' tests use small fakes; cli's unit tests a UI over buffers.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
devvm ssh gets this folder's VM ready for ssh and editors, as a launch
does without its shell, then names the host they reach it by; devvm code
does the same, then opens the folder in VS Code over Remote-SSH.
- vm: launch (from open: .git and set-id checks, a stopped VM's size,
ports and agent forwarding, the user's agent checked, run with its
self-check) and setUpVM (from setUp: sync, ssh config, a --clone VM's
clone) shared by launches, SSH and Code; reach requires the backend's
ssh, then offers the Include line (EnsureInclude). Code runs code
--remote ssh-remote+HOST DIR in devvm's place with the environment
devvm started with (Env.Environ), so the editor keeps the user's
SSH_AUTH_SOCK.
- sshconfig: Host (the alias among every backend's project VMs), with
the listing shared with Write.
- cli: ssh and code commands; CLI reference regenerated.
- Messages: ssh_host_info, no_code_command (linked to ssh.md),
ssh_failed, code_failed.
- Tests: ssh_code.txtar (no VM, usage, a stopped VM started and set up
without a shell, the Include line shown not added, a pending size
waiting, code's arguments and agent, two folders named alike, no code
on PATH, a direct route stopping the VM); guest.txtar's VS Code
Machine settings case; a stub code. e2e: devvm ssh on a stopped VM and
ssh reaching it, the Machine settings set and set again, devvm code
with a stub code; network: devvm ssh's self-check, passing and
stopping a VM started outside devvm.
- Docs: ssh.md (devvm ssh and devvm code, VS Code), commands.md,
security.md, clone.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>