14 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 f3052e5a8e feat(upgrade): releases checked by two of three release keys, bridged from the old key
devvm upgrade and install.sh accept a release's SHA256SUMS when any two
of three release keys signed it (CI's, the co-signer's and an offline
recovery key's), each in SHA256SUMS.<role>.minisig, checked only against
its own role's key, with the trusted comment devvm-release <version>
compared exactly; one signer counts once. While releases bridge from it,
the old release key's single SHA256SUMS.minisig (devvm <version>) still
passes alone, so 0.1 and 0.2 keep upgrading and --to/--version can
install them; install.sh now checks that key's trusted comment too.

The keys themselves aren't made yet, so packaging/keys holds none and
install.sh's three key lines are empty: a devvm built so checks each
release with the old release key alone, and a release that only the
release keys signed is refused. Releases go out as before, signed with
the old key, until the keys are made and added, all three at once.

- internal/minisign: the one owner of signature checks (moved from
  internal/upgrade): ParsePublicKey, PublicKey.Check (comment always
  compared), Role (CI, Cosign, Recovery), Kind (Release, Base),
  Kind.Comment, SigName, KeyFile, Keys/NewKeys/Keys.Check (two of three,
  distinct keys and key IDs). minisigntest/ signs for tests. Stdlib and
  blake2b only (depguard), a leaf; FuzzCheck, FuzzKeysCheck,
  FuzzParsePublicKey.
- The structure test's signatures rule: outside internal/minisign no
  code calls ed25519/rsa/ecdsa's Verify functions or imports blake2b,
  but signatureFree's files (ubuntu/pgp.go, proxy/nixcache.go).
- internal/upgrade: Source.Keys, checkSums (signatures.go); the bridge
  in legacy.go (checkLegacy, legacyKey, Source.Key); FuzzSumOf.
- packaging/keys/release-{ci,cosign,recovery}.pub, none yet;
  packaging.Key ("" without one). TestReleaseKeys (checkReleaseKeys:
  none, or three distinct minisign keys, none the old key),
  TestCheckReleaseKeys (fixture keys from minisigntest),
  TestInstallScriptKeys (checkInstallScriptKeys: one line per role,
  empty without keys), TestReleaseRefusesPlaceholders (no key in keys/
  marked PLACEHOLDER).
- scripts/release.sh (a tag, --check, --tag; never a snapshot) needs
  none or all three of packaging/keys' release keys. With none,
  install.sh's release_<role>_key lines are empty or missing; with all
  three, each is a minisign key, distinct, not the old release key, not
  marked PLACEHOLDER (placeholder), and equal to its install.sh line.
- install.sh checks with minisign -VHQm: prehashed signatures only.
- The structure guard also flags dot imports of the verifier packages
  and calls of x509's CheckSignature* method names.
- install.sh: release_<role>_key lines, download_signatures (a role's
  signature only when the script has its key), check_signature,
  signed_by_two, check_legacy; plainer warning without minisign, with
  the commands to check by hand.
- Tests: signatures_test.go (TestFetchWithoutReleaseKeys among them),
  upgrade.txtar (-legacy, -keys, and the keys built in, none),
  install.txtar (stub minisign with -Q; NO_KEYS), install_minisign.txtar
  (real minisign), release.txtar (none, nolines, nokeyline, old, marked
  and the rest); DEVVM_RELEASE_KEYS override.
- Docs: internals/install.md, using/upgrading.md, maintaining.md's
  Release keys, structure, tests, testing, SECURITY.md, CHANGELOG,
  releases/0.2.0.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 21:36:37 -07:00
CJandClaude Opus 5.5 72b648df31 feat(release): prereleases on the Homebrew tap, as devvm-rc (#19)
Prereleases now reach the Homebrew tap through a second formula, `devvm-rc`. The stable `devvm` formula stays on the last final release.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-07 11:36:20 -07:00
CJandClaude Opus 5.5 63e41118c6 feat(release): release candidates and betas, as GitHub prereleases (#13)
devvm can ship prereleases, such as release candidates and betas, for
people to try before a release is out. A prerelease's version is
`x.y.z-<word>.N`, such as `0.2.0-rc.1` or `0.2.0-beta.2`. `VERSION`
holds it, the tag is `v0.2.0-rc.1`, and it gets a `CHANGELOG.md` entry
as usual.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-06 23:36:15 -07:00
w3cjandClaude Opus 5.5 f4f2ec6a8f chore: the repo is devvmhq/devvm
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 00:09:04 -07:00
w3cjandClaude Opus 5.5 8e914b17c9 refactor(proxy): one typed, versioned config for every proxy, read as a private file
devvm _proxy runs with one argument, -config FILE: proxy.Config as JSON
(version 1), which a VM's proxy (vms/<hash>/run/proxy.json, written by
netpolicy.Proxy) and a build's (build-proxy/proxy.json, written by
backend.ProxyStarter) both use. It holds what the flags and the run
folder's sidecars held: the address, the VM, the password (proxy.auth),
the built-in policies and the user's files (proxy.policy), the logs, the
lifeline, the CA, the secrets, the user's CAs (proxy.cas), the company
proxy (proxy.upstream, now proxy.Upstream), upstream_unresolved, the Nix
cache and its cap, the links, and the SHA-256 of devvm's binary and CA
(proxy.bin, proxy.ca), which the proxy doesn't read. devvm writes it whole,
mode 600, before each start, and starts a running VM's proxy again when
the config it would start it with has another Sum. ReadConfig reads it as
the links' list is read (readPrivate): O_NOFOLLOW and O_NONBLOCK, fstat,
a regular file owned by the proxy's user that nobody else may read or
write, at most 1 MiB, of ConfigVersion, no unknown field, a password, a
loopback listen address. The VM's proxy is found by _proxy -config with
its own config's path. paths.VM names ProxyConfig, ProxyPID and
ProxyStatus.

Policy files are read only as regular files of at most 1 MiB
(proxy.ReadRegular, PolicyMax), in the proxy, devvm network and doctor, so
a FIFO or a link to /dev/zero can't hang them (ErrNotRegular, ErrTooLong;
ErrNotPrivate for the config and the links' list); the proxy keeps a
file's last rules and logs why once.

hostOK refuses a name with an empty label (evil.test.., evil..test,
.evil.test), so no form of a name gets past a deny the policy's own trim
would miss.

A build proxy that can't be spawned leaves no config behind.

Tests: config round trip and Sum; ReadConfig refusing a link, a FIFO, a
folder, group-readable and group-writable files, a long file, other
versions, unknown fields, two configs, no password, non-loopback
addresses, a CA without its key, a negative cap; ReadRegular and the
policy readers on a FIFO, /dev/zero and a big file without hanging; the
running proxy keeping its last rules; hostOK and requests with empty
labels (failing on the code before); Prepare's config, restarts on a
binary change, a missing config and one others may read; concurrent
config writes; the build proxy's config and its removal; proxy.txtar,
network.txtar, nix_cache.txtar and layout.txtar; e2e checks of the
config's mode, password and the proxy's arguments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 17:51:45 -07:00
w3cjandClaude Opus 5.5 ee8146a5e4 fix: scripts and tests work without shasum, and two CLI scripts start Lima outside devvm on bash 5.2's sh
Fedora 43 has sha256sum but no shasum (Perl's Digest::SHA), and its /bin/sh
is bash 5.3, which runs the last command of an `a && b` -c string in sh's
place.

- install.sh's check_host stops with "needs sha256sum or shasum" before
  downloading; its sha256 already used either. install.txtar covers
  shasum alone, both, sha256sum alone and neither, with made-up sums.
- scripts/release.sh and scripts/bump.sh get a sha256 helper (sha256sum,
  else shasum -a 256) in place of four shasum calls.
- gc_orphans, release, release_head and tools scripts hash with sha256sum,
  else shasum. tools' old fallback never fell back (the pipeline's
  status was cut's).
- ls and existing_agents restart a VM outside devvm with
  `sh -c '... && limactl start ...; exit $?'`: without the exit, bash's
  sh exec'd the stub, whose ha.pid then named the test runner (the pid
  devvm recorded), so the VM still looked confined.
- The install page lists sha256sum or shasum among the script's needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-03 07:13:46 -07:00
w3cjandClaude Opus 5.5 ddbc377f8f test: testscript commands for the scripts' setup, and a coverage baseline per package
script_test.go's sandbox sets DEVVM_MESSAGES=names and DATA, VMS, RUN
and CFG by default, and adds stub_reset, catg (the one file a glob
matches), vm_name VAR NAME (the folder's VM) and project NAME [git];
script_cmds.txtar checks each. Every script is rewritten onto them, its
assertions kept; TestCommandLines leaves the scripts' own commands out.

mise run test runs scripts/test.sh: the tests as before, with the CLI
tests' devvm built with -cover for every package (CLI_GOCOVERDIR),
merged with the Go tests' counters by go tool covdata, then
scripts/coverage.sh holds each package to testdata/coverage/<os>.txt.
mise run coverage raises the baselines; coverage.txtar checks the
comparison. The macOS baseline is recorded from this tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 14:25:09 -07:00
w3cjandClaude Opus 5.5 cd6fc60576 feat(cli): --json on every command that shows or lists
ls, images, tools, size, ports, network (and -g), network log (and
--blocked), ssh-agent, git-protect, secret, history, space, retention and
doctor take --json: one JSON object on stdout with "version": 1 first,
messages on stderr (ui.DataOnly), lists [] when empty. Settings commands
only show with --json and refuse a value (json_shows_only). doctor --json
replaces --fixes: problems with key, fix (null without one) and message,
warnings, docker and every backend's features; it prints nothing else and
succeeds whatever is missing, and install.sh reads its problems with awk.
TestJSONShapes holds each command's field names and types. Each shape is
documented on its command's page, with the contract under Everyday
commands' Output for scripts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 03:06:56 -08:00
w3cjandClaude Opus 5.5 c65ab1f507 fix(install): find Homebrew's devvm without running brew
check_brew ran brew list --formula devvm on every install, and Homebrew's
wrapper can download its own Ruby when it runs. The script now looks for
a devvm keg (Cellar/devvm/<version>) in the Cellar next to the brew on
PATH, in HOMEBREW_CELLAR and HOMEBREW_PREFIX/Cellar, and in
/opt/homebrew, /usr/local and /home/linuxbrew/.linuxbrew (brew_prefixes,
which the tests set). --force and the refusal stay as they were.

path_hint resolves paths with readlink -f --, so a PATH entry starting
with a dash isn't read as an option.

Tests: install.txtar's brew stub only logs; a Cellar folder fixture
stands for the keg (next to brew, HOMEBREW_CELLAR, HOMEBREW_PREFIX, a
usual prefix, an empty rack, no brew on PATH), and brew is never run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 23:50:17 -07:00
w3cjandClaude Opus 5.5 7f9f1316ec feat(doctor): warn on small hosts; builds say when base's size was fitted
devvm doctor warns when this machine has less than 8 GiB of memory or
fewer than 4 CPUs, the host devvm recommends. The warnings go to stderr
in doctor's normal output only: doctor's exit status and --fixes are
unchanged. Its checks move into a doctor type with field seams (Path,
Free, Host) and a run method returning the last problem, which the
command dies with as before. Long also names the warning about another
devvm first on PATH.

When fitting base to the host gives it fewer CPUs or less memory than
base.yaml's, the backend returns that size in backend.Built's Fitted
(backend.Fitted), and the build says so once (base_fitted) before
image ready. Lima's buildSize returns base.yaml's size and the fitted
one; smolvm's and Docker's base.yaml reading becomes baseYAML(fs.FS),
with fitted(fs.FS, cpus, mem), as functions to keep their types' method
counts.

install.sh runs devvm doctor when nothing is missing too, so a new user
sees its warnings.

- messages: host_memory_low, host_cpus_few (doc link
  getting-started/install#requirements), base_fitted
  (using/ports-size#size-and-ports)
- docs: install's Requirements (a recommended-host row in both tables,
  what devvm does on less) and Checking what devvm needs; internals'
  install (doctor after the fixes, warnings have no --fixes keys);
  ports-size's size paragraph; the doctor CLI page
- tests: TestSmallHost, TestDoctorSmallHostWarnsOnly, TestFitted,
  TestBuildSaysFitted; Lima's TestBuildImageSmallHost, smolvm's
  TestSmallHost and Docker's TestBaseSize check Fitted; install.txtar
  checks doctor runs when nothing is missing
- smolvm.txtar: the ports check matches only forwards of 22 and 3000,
  not a random ssh port starting with 22

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 23:44:35 -07:00
w3cjandClaude Opus 5.5 effcdfece0 feat(install): install.sh and doctor catch a second devvm
Installing with both Homebrew and the install script left two devvms, and
the one first on PATH ran without a word while brew upgrade might update
the other.

- install.sh: before downloading, check_brew stops (exit 1, in a terminal
  or not) when brew is on PATH and brew list --formula devvm succeeds;
  brew runs with stdin from /dev/null and its output discarded, only its
  exit status read. --force (in the usage, the header and the parser)
  installs anyway.
- install.sh: path_hint, after installing, warns when ~/.local/bin is on
  PATH but command -v devvm resolves (readlink -f) to another copy, naming
  it and what to do; it only looks the path up, never runs it. When
  ~/.local/bin isn't on PATH it prints only the existing hint.
- devvm doctor: warns (u.Warn, not a backend.Problem) when the devvm first
  on PATH isn't this binary, both resolved with filepath.EvalSymlinks;
  skipped when devvm isn't on PATH, and never with --fixes; exit status
  unchanged. Seams: onPath's LookPath and Executable fields.
- Message devvm_other_first (first, self), linked to
  getting-started/install#one-devvm.
- Tests: TestOnPathOther (this copy by either link, another copy, none on
  PATH, a broken link); install.txtar: a stub brew reporting devvm makes
  the script refuse before downloading, --force goes on, another devvm
  earlier on PATH gets the warning and isn't run, a link to the installed
  copy gets none; the stub brew answers list from $BREW_DEVVM.
- Docs: Installing's One devvm section (one way, the refusal, --force,
  switching through Uninstalling's step 4, the PATH warnings), --force in
  the options, doctor's warning; Installing and updating: the Homebrew
  check, the PATH check and doctor's check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 17:54:04 -07:00
w3cjandClaude Opus 5.5 851e39ef86 build: embed devvm's files in its binary
devvm is one file: assets/ (base.yaml, layers/, features/,
shared-tools/, guest/, oci/, smolvm/) is embedded as assets.FS, which
cli passes to every constructor; backends, the builder, the shared
tools, the proxy and Ubuntu's key check read it as an fs.FS. Scripts
reach VMs on stdin (backend.Script carries their contents). What needs
a path (limactl create's base.yaml, oci/ mounted into the conversion
VM, the proxies' policy files) is written out to
~/.local/share/devvm/assets/<hash>, atomically, files 600 and folders
700; devvm gc deletes older copies no VM's proxy was started with
(gc_assets, deleted_assets). Release archives hold the binary with
README.md, CHANGELOG.md and LICENSE, and the formula installs the
binary alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 18:12:37 -06:00
w3cjandClaude Opus 5.5 9f24d2639e refactor: group devvm's files under assets/
assets/ holds the files devvm ships: base.yaml, layers/, features/,
shared-tools/ (mise.toml, build.sh, the tools' policies), guest/ and
oci/. devvm reads them from assets/ beside its binary (paths.Root,
paths.RootOf); releases, the Homebrew formula, the CLI tests and e2e
put them there. Image keys hash them by their names in assets/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:08:33 -06:00
w3cjandClaude Opus 5.5 37d2fa57e4 feat(install): install.sh for the per-platform release archives
install.sh picks this host's archive (devvm-<version>-<os>-<arch>.tar.gz:
darwin or linux, arm64 or amd64; Apple silicon's under Rosetta, from
sysctl hw.optional.arm64), checks SHA256SUMS's minisign signature (an
empty key still skips it, with a warning; no minisign prints the command
to check by hand), then the archive's checksum, and installs the binary
with its data files in <prefix>/lib/devvm/<version>, linked from
<prefix>/bin/devvm. Older versions go, except one a running process
names in its arguments (a VM's proxy, QEMU's guestfwd on Linux): it's
kept until a later install. Then it offers devvm doctor --fixes' fixes,
asking first (Homebrew's Lima or Lima's checked release tarball, QEMU,
the kvm group), and runs devvm doctor. Downloads are HTTPS only. Its text
isn't messages: it runs before devvm is there.

release.sh --head now needs install.sh too.

Tests: testdata/script/install.txtar sources install.sh (host and archive
names, Rosetta, version choice and validation, HTTPS-only fetch, run_fix
as words, install and links, reinstall, an older version in use kept
(and the real ps), signature good, bad, missing, no minisign, a bad
checksum, no archive for this host, Lima's tarball for the host and
arch and a bad checksum, the PATH hint, the fixes with --yes, the kvm
re-login, no yes, Lima's release once allowed, nothing missing, main's
options, and the tests' devvm binary installed and finding its files);
release_head.txtar: a HEAD without install.sh is refused.

docs: install.md (Homebrew and the install script, upgrading,
uninstalling), maintaining.md (trying install.sh on a --head build),
README.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 23:24:22 -06:00