Files
w3cjandClaude Opus 5.5 2b176c92b3 feat(ui): every slow step shows a status line, and messages and questions never land on it
Any work that can take noticeable time now runs under the UI's status
line: a Reporter's Status with a label message, or a LoggedCmd step.

The UI:
- status lines are a stack: a Status or LoggedCmd inside another shows
  its own line, then the outer one is drawn again, where before it
  ended the outer one for good
- a message (Info, Warn, Note, Say, data on Stdout/Stderr) clears the
  line, prints and draws it again below; an unended line holds it
- a question (Ask, Confirm, Answer, Secret), the picker and
  ui.Terminal hold it until they're done
- no status line starts once the run is interrupted, as nothing would
  clear it
- the run log's path is read without the log's lock, as the status line
  reads it under outMu

Covered, by site and label:
- finder.target: finding_vm; Lima's limactl --version: checking_backend
- bringUp's checks (seeds, instance, recordFolder, hostChecks, ssh,
  requirements) and a running VM's go-on (proxy, pins, mount check):
  checking_vm; startOnce after the agent: starting; the self-check's
  probes: checking_network; pinHostKeys: reading_host_keys
- setUpVM (sync, ssh config, links, clone seed): setting_up_vm; each
  devcontainer command: running_script; makeMachine: creating;
  buildOnce: checking_image; paste's count and rm: reading_pasted
- volumeOf's lookup (diskutil), for launch, adopt, move, ls and rm:
  looking_up_volume
- vm.ListAll (devvm ls): reading_vms; devvm doctor's checks:
  doctor_checking
- devvm agent import: agent_import_reading (walk, links, opencode),
  agent_store_saving (copy, marketplace git checks, tmutil); devvm agent
  save: agent_save_reading, agent_save_comparing, agent_store_saving
- devvm stop (from its pins check on): checking_vm; a delete, an
  orphan's teardown and Lima's DeleteImage: deleting; devvm git-protect
  and clone on/off's .git work (leftBehind, mountFolder, unmountFolder):
  git_protecting; git-protect's re-read: finding_vm
- devvm clone add: clone_reading, clone_adding; clone fetch:
  clone_fetching; planClone: clone_planning; the clone check before rm
  or a remake: clone_checking; history export and import:
  history_exporting, history_importing; a remake's home: saving_home,
  restoring_home
- devvm upgrade's install: upgrade_installing; the shared tools' step
  back and .NET's downloads: resolving_tools; gc's caches: reading_space;
  the retention settings (daily and in gc): retaining

Work that takes the terminal stays off: the shell, ssh-add's
passphrase (checkAgent, Agent.Ensure, reloadAgent) and an agent's login.

Tests and guard:
- msg.Fake: OnStatus and Showing; its LoggedCmd shows its step
- backendtest.Fake: OnCall
- TestLaunchStatusLines: every backend call of a new, running and
  stopped VM's launch runs under a status line but the shell's and
  Running's (pid files)
- TestSSHAddOffStatusLine: ssh-add, on the user's agent or devvm's, never
  runs under one; chflagsCalls fails a .git lock or unlock with none
- the structure test's status-lines rule (statusSites, statusFree)
- TestStatusLinesNest, TestMessagesClearTheStatusLine,
  TestQuestionsHoldTheStatusLine, TestSecretAndPickerHoldTheStatusLine,
  TestTerminalHoldsTheStatusLine, TestNoStatusLineOnceInterrupted,
  TestFakeStatus, TestAgentImportStatus, TestAgentSaveStatus,
  TestDoctorReport, TestProblems, TestList, TestListLooksUpVolumesOnce,
  TestVolumeOfCache, TestWithSDKDownloads, TestRetainStatus,
  TestSetCloneOn, TestTeardownLeavesNothing

The rule is written in the cli skill (rule 14, checklist, review), the
codebase-standards skill (Show what devvm waits for, its checklist line
and rules.md's row), Contributing's CLI page (Status lines), its tests
and structure pages, and the troubleshooting page.

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

67 lines
1.9 KiB
Go

package cli
import (
"context"
"github.com/devvmhq/devvm/internal/backend"
"github.com/devvmhq/devvm/internal/msg"
"github.com/devvmhq/devvm/internal/platform"
"github.com/devvmhq/devvm/internal/vm"
)
// gcCaches frees devvm's share of each backend's own caches (gc
// --caches): what each backend can tell only devvm's builds put there and
// no image or VM of devvm's needs. It lists each backend's apart and asks
// for each; it never runs a backend's own prune, which reaches the user's
// own entries too. Never one gc skipped, as it couldn't list its images.
func gcCaches(ctx context.Context, a *app, env *vm.Env, o gcOpts, skipped map[string]bool) error {
u := a.u
reg := env.Registry
for _, be := range reg.All() {
if skipped[be.Name()] {
continue
}
stop := u.Status(msg.ReadingSpace())
entries, ok := cacheEntries(ctx, reg.Host, be)
stop()
if !ok || len(entries) == 0 {
continue
}
var size int64
for _, e := range entries {
size += e.Size
}
u.Say(msg.GCCache(be.Name(), len(entries), humanSize(size)))
for _, e := range entries {
u.Say(msg.GCCacheEntry(humanSize(e.Size), e.What))
}
if !o.force {
yes, err := u.Confirm(msg.GCCacheConfirm(be.Name()).AnsweredBy("--force"))
if err != nil {
return err
}
if !yes {
u.Info(msg.NothingDeleted())
continue
}
}
if err := be.DeleteCache(ctx, entries); err != nil {
return err
}
u.Info(msg.DeletedCache(be.Name(), len(entries)))
}
return nil
}
// cacheEntries is devvm's share of a backend's caches; ok is false when
// the backend can't be asked.
func cacheEntries(ctx context.Context, host platform.Host, be backend.Backend) ([]backend.CacheEntry, bool) {
ctx, cancel := context.WithTimeout(ctx, spaceTimeout(host, be.Name()))
defer cancel()
if backend.Check(ctx, be) != nil {
return nil, false
}
entries, err := be.DevvmCache(ctx)
return entries, err == nil
}