- vmname.IsVM takes a name's folder part only as project.Slug makes it
([a-z0-9-], a letter or digit at each end), so a hand-edited name never
carries spaces, slashes, newlines or ssh patterns. TestSlug checks that
every name project.New makes is one.
- vmname.Short and vmname.IsAlias: a VM's alias is devvm-<folder> of its
own name or the name itself. sshconfig.Host, ChooseAlias and
project.Named ignore any other alias, so one edited into vm.json never
reaches the ssh config's Host line or names a VM.
- state's writeFileMode makes a missing folder with PrivateDir (exactly
700, whatever the umask, a link refused); a folder already there keeps
its mode.
- ports.Allocator.Build chooses a build VM's ssh port on macOS under the
claims lock (state.Claims, which VM.Claim now shares), records it in
run/build-ports/<name> until limactl start returns, and ports.Used
reads those records, so no VM or forwarder takes the port before Lima
binds it. Lima's own freePort and platform.PortFree, its only user, go;
Lima gets a Ports field (the allocator). paths.Dirs.BuildPorts is new,
and Dirs' method limit goes to 54.
Tests: TestIsVM, TestIsAlias, TestSlug, TestChooseAlias, TestWrite,
TestTargets, TestWriteFileMakesPrivateDir, TestBuild,
TestStartBuildSSHPort; layout.txtar lists run/build-ports on macOS.
Docs: internals (backends, overview, design), contributing, using/space.
Co-Authored-By: Claude Opus 5.5 <[email protected]>