19 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 cb36951de2 refactor(git-protect): drop strict, convert strict VMs to on
devvm git-protect strict (0.1.0, 0.1.1-rc.1) set diff.ignoreSubmodules =
all in the locked .git/config, which can't keep git on this machine out
of a submodule the VM adds: a .gitmodules ignore line the VM writes
overrides it, and git add -A/-u, describe --dirty, diff-index,
diff-files, fetch and pull recursion and --ignore-submodules on the
command line enter submodules anyway (#37). --clone is the only way to
keep VM code away from host git.

- devvm git-protect takes on|off; strict is a usage error
  (git_protect_strict_refused) naming devvm clone on. Use, help,
  completion (Modes) and --json reflect it.
- A VM left strict reads as on (Mode, Next) and is pinned and kept as on.
  The first check that finds it stopped (Check, then converter.unstrict:
  launches, devvm stop, devvm clone on and its undo) removes the value all
  from the .git/config of each repo its state recorded before that check,
  under the host's git lock, and only where .git's identity is the
  recorded git_id (a replaced .git, or a VM with no record after devvm
  adopt, is left alone, its all named with the manual remedy:
  git_strict_unknown). Each config is read through safefile first,
  unlocked for the edit and locked again even after an interrupt
  (context.WithoutCancel), and checked to still be a regular file in that
  .git afterwards (git_lock_raced). On a watching host, a config whose sum
  isn't the check's is left, and the new sums go into the watch's. An
  interrupt records nothing. Then on is recorded (mode and next) with one
  warning (git_strict_converted), none when next is off. Set on/off and
  Unlock (devvm rm) remove it the same way, silently (strictLeft).
- strict recorded nothing about a value it overwrote, so nothing can be
  restored: only all is removed (--unset-all '^all$'); any other value is
  the user's and stays. This fixes off, which unset any local value.
- A config another VM keeps locked keeps it, named with the manual
  remedy (git_strict_kept, via msg.M.Value), and its repo goes in the
  state's strict_left, retried at each later stopped check until empty.
  A config git can't change is named (git_strict_left).
- Messages: git_locked and git_embedded_new say what on can't stop;
  git_locked_strict and git_config_failed go.
- Docs: .git protection's Strict section becomes VMs that were strict,
  with the remedies; on and Not covered say a submodule or repo the VM
  adds runs through host git until the next check names it, and only
  --clone keeps VM code away; attack vectors, How it works, the design
  notes, the commands table, ls, the cli skill and the CLI reference
  follow.
- Tests: strict_test.go (conversion, values kept, off/on/unlock, nested,
  kept and retried, replaced and unrecorded .git, interrupted, next off,
  changed since the check, Linux pins and sums, Watch, next, a failed
  edit), TestUnstrictFIFO, msg TestValue, git_protect.txtar,
  git_pins.txtar, fixture_v010_strict.txtar (0.1.0's app VM made strict
  on macOS), e2e project checks on macOS and Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:20:00 -07:00
w3cjandClaude Opus 5.5 2b68a2347c feat(gitprotect): .git protection on Linux without root, through a user namespace around QEMU
On Linux, a start of a VM whose protection is on pins .git, its git dirs
and every lock path read-only in a user and mount namespace that devvm
_qemu pinned makes around QEMU. It keeps the pins while QEMU runs, records
each re-pin, refuses hard links and fails closed on watches and records;
doctor says why a host can't lock, and such hosts watch .git instead. The
pins' events file is read through safefile, and the command-line check
takes "devvm lock" in prose as English.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:06:17 -07:00
w3cjandClaude Opus 5.5 cda2d09f42 feat(gitprotect): on Linux, warn at each launch and report .git hooks and config that changed (#20)
Linux hosts have no unprivileged immutable flag, so devvm can't lock
.git there. It now warns at every launch of a VM that mounts a folder
with a .git (git_unprotected), unless it's a --clone VM or the user
chose devvm git-protect off (git.chosen), and it names, after the fact,
the hooks and config that changed (git_changed). It sums what a lock
would cover, .git/commondir, include.path targets and the folder
core.hooksPath names, never through a symlink out of the project folder
and within bounds (git_watch_blind names what it can't fully watch), at
each launch that finds the VM stopped and at devvm stop.

A check on such a host runs protect's reports without locking:
git_replaced, git_commondir, stray worktrees, git dirs that appeared,
core.hooksPath and delegations into the project folder, and a
submodule's folder that isn't a git dir (git_gitdir_not_git), in which
nothing is created and which the watch doesn't sum as a git dir.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-07 19:16:30 -07:00
w3cjandClaude Opus 5.5 8d44175601 refactor: the Go module is github.com/devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 06:16:29 -07:00
w3cjandClaude Opus 5.5 297c8f9d23 fix(vm): devvm's first run asks its defaults and base's features first, then this folder's VM
The first run starts with a line saying its questions set devvm's
defaults for every new VM and its base image (first_run_defaults), then
asks new VMs' size and agents and base's features (build's
Choice.Choose, before the summary rather than at the build), then shows
the summary, now headed as this folder's new VM, and asks to customize
it. A base whose features are chosen asks nothing, as before.

new_vm_customize no longer carries its own [y/N], which Ask prints:
TestEveryMessageRenders fails on any message with [y/N] or [Y/n], as
the prompts own them.

Docs: first-vm.md's walkthrough and flowchart, commands.md's questions
table in the first run's order, customizing.md's features question,
images.md's summary and the README.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 22:54:01 -07:00
w3cjandClaude Opus 5.5 ae0fd533fc refactor(msg): names mode is the UI's, read once with each stream's style
A msg.M always renders as its text: String, Error, Parts and Segments no
longer read DEVVM_MESSAGES, and Line is gone. internal/ui reads names mode
in newStyle, with each stream's color, and shows messages as names through
the style (message, segments, line, valueParts). ui.New takes the function
it reads the environment with, so tests make a names-mode UI without
t.Setenv. Messages shown as data go through UI.Text or Table.Text (doctor
--json, ls's image cell, setup's network choices); vm.PickRow.Desc is a
msg.M that cli renders. A config.toml value's refusal keeps its message
(state.CorruptError.Msg, Shown), so fail shows its names in names mode.

Tests: ui TestNamesMode; state TestFiles covers Msg and Shown; Go tests
compare NamesOf or Names, and drop t.Setenv("DEVVM_MESSAGES") outside ui,
msg's TestNames and the testscript runner. The structure test lists
DEVVM_MESSAGES in internal/ui/style.go only; ui.UI's method limit is 47
(Text).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 17:01:47 -07:00
w3cjandClaude Opus 5.5 7929eafaf5 fix(msg): every message value renders without control characters
A value a VM made reached the terminal unfiltered wherever a caller
forgot msg.Shown, such as the errors passed as err.Error() and a link's
name. Four cleaners did the job in different ways: msg.Shown (quoting),
ui's printable and oneLine, netpolicy's oneLine and the port
forwarder's log (which let C1 through, in UTF-8).

msg.Printable and msg.OneLine are now the one cleaner: they drop C0 but
newline and tab (OneLine drops those too), DEL and C1, in UTF-8 or as a
lone byte. Every message value goes through OneLine as the message
renders, in Text, Segments and names mode, so no caller can forget it,
and msg.Shown is gone with its 68 calls. The status line, the run log's
end and verbose output, Pick, devvm network log, the forwarder's log and
a clone's status lines use them too.

Tests: TestPrintable and TestValuesArePrintable (internal/msg), the
hostile-value segments test, TestLogLimit (internal/backend/vmssh) with
C1 in UTF-8 and as a lone byte; TestCheckLinks and
TestNewVMOtherRepoAndCommondir expect the cleaned values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 18:19:23 -07:00
w3cjandClaude Opus 5.5 bb564f4966 feat(ui): bold a message's values in a terminal
The values a message's template fills in (a VM's name, a path, a port,
a count, a value inside a command) are bold (SGR 1) in a terminal; the
template's own words stay in the default foreground. Bold, not italic,
which some terminals don't draw or draw as reverse video. Same enable
rule and streams as the other colors; the run log, DEVVM_MESSAGES=names,
M.String/Line and anything not a terminal are byte-identical.

internal/msg: M.Segments returns the text as segments (the template's
words, or a value) and the doc link apart; names mode gives the names as
one segment and no link. It renders the template with each value between
U+E000 and U+E001, after dropping those runes from the values, so a
value can't start or end a marking; VM-made values still go through
msg.Shown, so their control characters are quoted. Joined, the segments
are Text.

internal/ui: style.message bolds value segments (per line) and paints
the link; the status line's label and the done line are parts, values
bold, cut and counted on their plain text (style.fit), so truncation
inside a value closes its code. DieLogged's log end stays Line inside
dim.

Tests: TestSegments (a VM name, a path, a log path, both plural forms,
two values, an empty value), TestSegmentsOfHostileValues (marker runes,
escape codes through Shown), TestSegmentsInNamesMode; TestEveryMessageRenders
checks every message's segments join to its text with each field a
value, in every language; ui's TestMessagesColored with the value bold,
TestStatusLineValuesBold (bold, cut at 12 columns, plain unchanged),
TestDoneMarkGreen with a bold value.

Docs: using/settings (Colors); contributing (Messages: Colors).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 16:25:01 -07:00
w3cjandClaude Opus 5.5 b94c99e226 feat(ui): color errors, warnings, doc links and log text in a terminal
devvm colors the labels and links around its messages with the
terminal's 16 base colors, so the theme picks shades that read on its
background; a message's own text stays in the default foreground.

- Die's devvm: label bold red (1;31), Warn's bold yellow (1;33)
- doc links underlined blue (4;34)
- Info's ==> bold (1)
- DieLogged's log end and its --- lines, and the status line's log
  text, dim (2), each line painted apart
- the done mark green (32)

No bright colors, backgrounds, 256 colors or truecolor, and no
background detection.

Each stream decides apart (colorOn): NO_COLOR or DEVVM_MESSAGES=names
off, then FORCE_COLOR or CLICOLOR_FORCE (but 0) on, then TERM=dumb off,
else only when that stream is a terminal. Names mode stays plain in a
terminal too, so e2e's checks under script read the names unchanged.
The run log and Stdout() data are never colored; no --color flag and no
message text changes.

internal/ui: a style per stream (style.go: paint, paintLines, message,
labelled, fit), made in onTerminal; Die and Warn share labelled. The
status line cuts and counts its plain text (style.fit) before painting,
so it fits and clears at the right width; statusText returns the log
part apart. Codes are added after printable() and msg.Shown.
internal/msg: M.Parts returns the text and the doc link apart, names and
no link in names mode; String joins them as before.

mise run test unsets NO_COLOR, FORCE_COLOR and CLICOLOR_FORCE, and
tests/e2e.sh unsets FORCE_COLOR and CLICOLOR_FORCE, so a user's own
settings don't change what they check.

Tests: TestColorOn (env x terminal), TestMessagesColored (Say, Info,
Note, Warn, Die colored and plain, the link apart), TestNamesModeStaysPlain,
TestDieLoggedColored, TestColoredStatusLineFits, TestDoneMarkGreen;
msg's TestStringAddsDocLink checks Parts.

Docs: using/settings (Colors, the environment table); contributing
(Messages: Colors).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 15:36:13 -07:00
w3cjandClaude Opus 5.5 ee06f051ff refactor(msg): remaining messages in the docs voice
Rewrites the messages outside the prompt, network policy, secrets, project folder, .git, --clone, backend, host, image, build and shared tool groups (agent_, ssh_, ports_, size_, disk_, vm_, no_, devcontainer_ and the rest) as full sentences: what happened first, then one action as a command, without chained colons and semicolons. Status steps and short ==> result lines stay as they are, and every template keeps its fields.

Adds doc links for the actionable warnings and errors that had none: no_devcontainer_flag_ignored, no_ssh_agent, ssh_agent_empty, load_key_with, no_vm_ssh_agent, agent_key_not_found, agent_load_failed, agent_start_failed, mounts_next_start, no_feature, no_image_named, no_image_named_from, not_an_image, no_vm, no_vm_size, no_vm_ports, no_vm_git_protect, no_vm_policy, no_token, bad_secret_service, start_failed, stop_failed, delete_failed, vm_create_failed, sync_failed and pack_failed.

msg_unknown's wording is checked by TestValuesAsGiven and msg.txtar, which follow it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 10:26:23 -07:00
w3cjandClaude Opus 5.5 09d25457d5 docs(site): user pages, How it works and Contributing, sections moved into place
Sections move verbatim; new pages open with a one-sentence placeholder.

Moved pages: safety/clone.md -> using/clone.md; safety/security.md ->
internals/security.md.

New pages: using/ports-size.md, using/settings.md,
using/troubleshooting.md, internals/overview.md, internals/install.md,
internals/images.md, internals/ports.md (placeholder only),
internals/network.md, internals/git-protection.md,
internals/backends.md, internals/lima.md, internals/smolvm.md,
internals/docker.md.

Moved sections:
- getting-started/install.md: the install script's steps, the Docker
  Linux-build fetch, the signature paragraph, doctor --fixes and its
  keys, "devvm is one binary", removing old versions -> internals/install.md
- getting-started/commands.md: An existing VM, Stopping a VM, Deleting a
  VM -> internals/overview.md; Size and ports -> using/ports-size.md;
  Environment -> using/settings.md
- using/images.md: Ubuntu's cloud image, Versions, Building tools,
  Building, Caching (Rebuilding, Outdated VMs) -> internals/images.md;
  Ports, Size, Disk use -> using/ports-size.md; Where state lives ->
  using/settings.md; Build logs and interrupts -> using/troubleshooting.md
- using/from.md: How it's converted (The image is untrusted), Digests ->
  internals/images.md
- using/coding-agents.md: MCP servers, Keys in settings files ->
  internals/network.md
- safety/network.md: the start-up list, The proxy, The self-check, How
  the proxy puts them in, Agents' logins and settings, devvm _proxy ->
  internals/network.md
- safety/git-protection.md: What's locked, On each launch, What a lock
  can't stop -> internals/git-protection.md
- safety/attack-vectors.md: Staying safe -> safety/_index.md (The
  habits), with a copy of the security model's reach table
- backends/_index.md: Features, Missing and unreviewed features, VM names
  -> internals/backends.md
- backends/lima.md: A Lima home of its own, Confinement, Clones and
  overlays, Ports -> internals/lima.md
- backends/smolvm.md: Its machines through No init system ->
  internals/smolvm.md
- backends/docker.md: What's devvm's in Docker, Building images, What
  devvm sets on a VM, Network policy, No init system, ssh for editors,
  Ports, SSH agent forwarding, Shared tools -> internals/docker.md

Titles and weights follow the target tree; How it works is weight 95,
after the CLI reference. Index pages list the new pages. Links, message
doc links (internal/msg/docs.go), the home page, README.md, SECURITY.md,
internal/proxy/README.md and AGENTS.md point at the new places.
Contributing and AGENTS.md say what goes on user pages, How it works and
Contributing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 09:21:03 -07:00
w3cjandClaude Opus 5.5 11eb2da70f docs(site): served at devvm.dev; docs-only changes run only the docs checks
The site's base URL, the doc links devvm prints, the README, CONTRIBUTING,
SECURITY and the home page recording point at https://devvm.dev; the local
server is at http://localhost:1313/.

lint runs lint:code (golangci-lint, shellcheck) and lint:docs (markdownlint,
Vale, lychee, TestDocLinks). CI skips changes only to docs/ and Markdown
files, except the generated CLI reference; the Docs workflow lints and
builds the site on pull requests touching the docs and deploys from main.
mise-action goes to v5.2.4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 07:20:19 -07:00
w3cjandClaude Opus 5.5 857c0e8c53 docs(site): sections in the reader's order, attack vectors and a first-VM page
The docs move into a folder per sidebar section, in the order a new user
needs them: getting-started (install, first-vm, commands), using (images,
customizing, from, devcontainer, coding-agents, ssh, limits), safety
(attack-vectors, network, clone, git-protection, security), backends
(backends.md as the section's _index.md, lima, smolvm, docker), internals
(design), cli, and contributing (contributing.md as its _index.md,
testing, maintaining). Each section has an _index.md listing its pages,
and the docs index is grouped the same way. Commands is now Everyday
commands, SSH is SSH and editors.

New pages:
- safety/attack-vectors.md: Staying safe first (seven habits), then
  common attacks sorted into Blocked, Kept inside the VM, Narrowed, not
  closed, and Left to you.
- getting-started/first-vm.md: making a VM, the first run, what's in it,
  coding agents, coming back to it.

Links to Staying safe from the home page, README, security, install,
coding agents and clone. Every relative link, the home page's, the
README's, SECURITY.md's, CONTRIBUTING.md's, AGENTS.md's, the proxy and
oci READMEs', release.sh's hints and the recording's URL use the new
paths. internal/msg/docs.go names pages by path (using/images#...), and
checkDoc takes a section's _index.md for its folder (backends#...).
contributing/_index.md describes the sections and how links name them.

Also carries the docs edits made alongside the forwarder work in the
tree (backends, images, limits, security, design, commands and the
generated devvm ports page), whose code isn't in this commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 23:20:58 -07:00
w3cjandClaude Opus 5.5 d73c010ec4 feat(msg): messages carry the error they report
msg.M.Because(err) returns the message carrying err, and Unwrap returns
it, so errors.Is and errors.As see through a message to its cause. The
text stays the message's own.

Messages made from an error carry it: proxy_failed (secrets and the
proxy command), login_copy_failed, run_log_failed and fail's fallback
message. TestBecause covers errors.Is and errors.As through a message,
through %w wrapping, and through a message in a message.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 15:37:32 -06:00
w3cjandClaude Opus 5.5 7fcac40758 refactor: test seams on structs, not package vars
Tests set fields; no test outside internal/proxy and internal/ui assigns
a package var.

- backend.Review: Unreviewed and Warn, with Require and Allowed as its
  methods; Registry embeds it, set by backends.Registry (a test build
  reads DEVVM_UNREVIEWED); build.Builder.Review, sshconfig.Config.Review,
  and Tools.Build takes the review with the backend
- netpolicy.Log: Path and Tick (NewLog), with Write and WriteBlocked;
  Proxy.Terminal for Choose and SelfCheck
- vm.Env.Terminal, sshconfig.Config.Terminal
- cli: setup's terminal check and backend picker are fields of setup;
  versionOf takes the release's version
- from.Registry.RetryDelay, ubuntu.Finder.RetryDelay, lima.Lima.OCIWait
- msg's tests use real messages, not entries added to docs and specs

The tests these free run in parallel. AGENTS.md: test seams are fields;
internal/proxy's globals and internal/ui's process-wide state are the
exceptions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 15:28:37 -06:00
w3cjandClaude Opus 5.5 53c37e4dee feat(up): create a project VM and open a shell
devvm [IMAGE] in a folder creates its VM: the folder checked (its path,
unsafe folders, a folder made again), its size and ports, the image
named or detected and built, cloned with only the folder mounted, its
state, .git hooks and config locked (macOS), started, then the backend's
shell in place of devvm. Network policy isn't there yet, so a VM is
created only with --no-network-policy; an existing VM is refused for
now. Ctrl+C before the first shell deletes the VM and unlocks .git.

Global flags: --backend, --network-policy/--no-network-policy, --cpus,
--memory, --disk, --ports; up's own --unsafe-folder, --no-git-protect.
tests/e2e.sh gains a project section, with Lima's Exec quoting checked
on a real VM. New docs: commands, security model, .git protection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 09:14:27 -06:00
w3cjandClaude Opus 5.5 e182e3787a feat(ui): output helpers, spinner, run logs and cleanups
internal/ui is now the only package that prints: the message helpers,
prompts, tty detection, the status line, the run log (Logged, step
counts, proxy keys redacted) and ui.Main, which recovers Die, runs the
cleanup stack and handles INT/TERM/HUP (exit 130). main runs devvm
through it, and Cobra's errors print as one-line devvm errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 02:27:59 -06:00
w3cjandClaude Opus 5.5 09581cb9b6 refactor(msg): standard go-i18n TOML, doc links in Go
locales/*.toml now hold only go-i18n's message fields and load with
go-i18n's own loader (RegisterUnmarshalFunc with BurntSushi/toml, then
LoadMessageFileFS), so go-i18n's tools work on them. Doc links move to
the docs map in internal/msg/docs.go; TestDocLinks checks every key is a
message and every page and heading exists. The generator decodes en.toml
into go-i18n's message fields and refuses anything else.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 02:16:08 -06:00
w3cjandClaude Opus 5.5 13b9afa59e feat(msg): generated typed messages with go-i18n
locales/en.toml holds every message; go generate ./internal/msg writes
one typed function per message. internal/msg renders them through a
go-i18n bundle in the user's language (LC_ALL, LC_MESSAGES, LANG), with
names mode (DEVVM_MESSAGES=names) and doc links. devvm _msg prints a
message's text. Tests check the generated file is current, every
message renders and is called, and every doc link exists; lint runs
the doc link check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 01:42:46 -06:00