5 Commits
Author SHA1 Message Date
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 e6f64dae31 refactor(vm): one VM inventory per run
vm.Inventory (internal/vm/inventory.go) holds each project VM's state,
backend and Instance, read in one place: ReadStates for the states
alone, ReadInventory (UsedBackends or AllBackends) for the backends'
lists too, each within the host's list wait (30 s), with the backend's
Check saying why a list failed. It replaces Env.mounts, recordedVMs,
vm.List and vm.ToolsInUse, linkstate's clientStates listing, the
secret list's, Leftovers.Find's (and backendVMs), cli/space.go's two
(backendRows' list, vmFolders), images' state.Backends and sshconfig's
running list: sshconfig.Write takes the inventory's Running VMs.
state.ReadAll reads each VM folder on its own (only the inventory calls
it, a structure-test callers rule); state.Backends and Registry.Used go.

One failure policy:
- a backend that can't list fails a listing (Inventory.Err) only when
  some VM's state names it: devvm ls and the ssh config fail, and the
  ssh config stays as it was rather than lose that backend's entries;
  space and gc --orphans name it and leave its VMs alone;
- an unreadable vm.json is its own row: ls lists the VM with its name
  and status alone and warns (vm_state_unreadable); links, the secret
  list, rm VM and link targets leave it out; gc --orphans never takes it
  for an orphan; ToolsInUse and Mounts (images, gc, space, the SSH
  agent's mounted-key check) fail on it, naming the file;
- FolderOf is bounded (5 s): a folder on a hung share is there.

Mounts come from the states alone, stopped VMs and agents' folders
included, so the mounted-key check asks no backend. ui.Table shows every
cell through msg.OneLine, so ls's cells can't move the cursor or break
a row.

Docs: internals/overview's listing, troubleshooting's file devvm can't
read, ssh's mounted keys, contributing's owners table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 02:30:53 -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 a169ebb1cf feat(ui): a feature a backend lacks is dim in devvm doctor's table, not red
none isn't a fault, and Docker's column, with many features it lacks,
read as mostly red. Red is left for unreviewed emulations and
unenforced network policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 17:26:35 -07:00
w3cjandClaude Opus 5.5 bb48f435cc feat(ui): color devvm's tables when stdout is a terminal
devvm ls, devvm images, devvm space and devvm doctor's feature table
are colored with the messages' rule for stdout (NO_COLOR or names mode
off, FORCE_COLOR or CLICOLOR_FORCE on, TERM=dumb off, else only when
stdout is a terminal). Pipes, scripts, --json, doctor --fixes, the run
log, DEVVM_MESSAGES=names and tests stay byte-identical.

Header rows and totals bold; names, paths, sizes and counts in the
default color; base 16 colors only. The roles, by table:

- images: current green (32); stale, unfinished, unused, not built
  yellow (33); DIGEST and KEY dim (2)
- ls: Running green, Stopped yellow, any other status (Broken) red
  (31); GIT on, strict and clone green; NET on green, unenforced red
- space: KEPT only copy and leftover yellow; the total row bold
- doctor: native green, emulated yellow, unreviewed and none red

internal/ui: Table (Header, Row, Total, Break, Flush), Cell and Role
(Plain, Good, Attention, Bad, Secondary), from u.Table(), on stdout and
colored as it is; cli never reads the environment. Table pads each
cell on its plain text before painting it, as text/tabwriter counts
the codes' bytes; a plain table is byte for byte tabwriter's with
padding 2. New's UIs color only when FORCE_COLOR or CLICOLOR_FORCE says
so, which is how cli's tests get a colored one. ui.UI's method max
goes to 43 for Table.

internal/cli: writeImages, writeList, writeSpace and writeFeatures
take a *ui.Table; cell, dim, cellAs and the role functions imageStates,
toolStates, vmStatuses, gitModes, netModes, keptRoles, supportCell.

Tests: TestTableLikeTabwriter (plain and colored, against tabwriter),
TestTableBreak, TestUITable; cli's tables helper renders each table
plain and colored and checks they match without the codes, in
TestWriteListColored, TestWriteImagesColored, TestWriteImagesTools,
TestWriteSpace and TestWriteFeatures, with the expected codes.

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

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 15:57:03 -07:00