13 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 b6954e1e11 refactor(vmname): a VM's name is a vmname.VM, parsed where it's read
vmname.VM is the name of every machine devvm runs on a backend: a
project VM, an image's machine (devvm-img-<key>), a build VM and a
remake's aside. Fields, parameters, results and map keys that held a VM's
name as a string now hold a VM, from the backend interface down to the
CLI's --json structs, whose output is byte for byte the same.

Boundary parsers, the only places a string becomes a VM:
- vmname.Parse: a project VM's name (state's vm.json name, export file
  names, devvm _links's argument, the forwarder's -vm, project.Nth)
- vmname.ParseListed: one path element, for what a backend lists
- VM.UnmarshalText: JSON (Lima's list, proxy config and events, links'
  targets in state, link lists); empty stays no VM
- vmname.Image(key), VM.Aside(), and typed constants for Lima's build VMs
- msg.M.VM: the VM a message's function took, read back

vmname's functions on names became methods (Hash, Slug, Short, Aside,
AsideHash, ImageKey, IsProject); Lima's image prefix moved to vmname;
vmname.Join joins VM lists. Messages' vm and vm_name fields are typed
by the generator. Seven messages whose field took something else became
what= (backend_lacks, backend_unreviewed, backend_unreviewed_used,
starting, deleting, configuring, running_script) and rm_vm_failed's
name=: the text is unchanged, the names-mode scripts follow.
Review.RequireFor names an image or the tools being built.

Typed sites per package (added lines with vmname.VM, non-test): msg 347
(generated), vm 124, lima 48, backendtest 32, vmssh 31, netpolicy 22,
backend 16, gitprotect 14, proxy 11, cli 11, project 10, state 8,
ports 6, paths 3, sshagent 2, sshconfig 2, tools 2.

The structure test's owners rule now fails on a field, parameter or
result named for a VM (vm, vms, otherVM, vmName) typed string, []string
or map[string]…, and on converting anything but a literal to vmname.VM
outside the files it lists; internal/stubtest is free. depguard holds
internal/vmname to the standard library, and the proxy may import it.

ParseListed and UnmarshalText refuse a name starting with -, which would read as a flag in limactl's argv, and vmname.Image refuses a key that's empty, holds a / or NUL, or makes a project VM's name, so Lima's ImageSize and DeleteImage no longer check it themselves. The check also fails on a *string VM name and an alias of vmname.VM, and says what it doesn't see.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:28 -07:00
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 fb19879aaa fix(msg): one rule for which characters reach the terminal
msg.Safe is the one owner: a graphic character in any script is safe;
controls, bidi controls, format characters, variation selectors, private
use and the invisible fillers are not. Printable and OneLine drop what
Safe refuses, agent save's diff escapes it, and forbidigo bans
unicode.IsGraphic, IsPrint, IsControl and Bidi_Control outside
internal/msg.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 10:04:59 -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 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 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 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 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 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