Files
devvm/internal/cli/refreshtools.go
T
w3cjandClaude Opus 5.5 bdd26779b4 fix(cli): only a test build reads the test overrides
DEVVM_HOST_MISE (which replaced the pinned, checksummed mise), DEVVM_KVM
and DEVVM_UBUNTU_URL were read in every build, a release's included. One
ldflag in a leaf package, internal/testbuild (testBuild=yes, set by
tests/e2e.sh and the CLI tests), now marks a test build, and cli's
readOverrides is the one place devvm reads every test override, into
Overrides (registry.Overrides, with platform.Overrides for the host's
size, and HostMise): empty unless testbuild.On(). registry.New takes
them; lima.New takes Ubuntu's URL; ubuntu.New takes a URL, not getenv;
Lima's and smolvm's KVM default to /dev/kvm; tools.Env has Mise in place
of reading DEVVM_HOST_MISE; platform.NewHost takes Overrides. Gone:
registry.unreviewed, registry.Host, newFor, hostFor, ubuntu.URLEnv. The
documented settings (DEVVM_LIMA_HOME, DEVVM_SECRET_SERVICE,
DEVVM_NO_TOOL_CHECK, DEVVM_FROM) stay as they are.

Tests: TestReleaseReadsNoOverrides (cli: a release reads none, its mise,
KVM, unreviewed and host its own), TestOverrides (registry: every override
reaches its backend, none leaves the defaults), TestHostOverrides and
TestListTimeout (platform) and ubuntu's TestNew moved to the new shapes.

Docs: contributing/testing.md's Test builds, contributing's sandbox table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 19:13:23 -07:00

32 lines
908 B
Go

package cli
import (
"github.com/spf13/cobra"
"github.com/w3cj/devvm/assets"
"github.com/w3cj/devvm/internal/msg"
"github.com/w3cj/devvm/internal/paths"
"github.com/w3cj/devvm/internal/tools"
"github.com/w3cj/devvm/internal/ui"
)
// newRefreshToolsCmd is devvm _refresh-tools: the daily check for newer
// shared tools, which devvm starts in the background (tools.RefreshDaily).
// Hidden: it's not for users.
func newRefreshToolsCmd(u *ui.UI) *cobra.Command {
return &cobra.Command{
Use: "_refresh-tools",
Short: "Resolve the shared tools' versions again",
Hidden: true,
Args: noArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
dirs, err := paths.FromEnv()
if err == nil {
err = tools.Versions{Env: newTools(dirs, assets.FS, u, thisHost())}.Refresh(cmd.Context())
}
fail(u, err, func(string) msg.M { return msg.ToolsCheckFailed() })
return nil
},
}
}