banger/internal/cli
Thales Maciel d867d61eb3
update: refresh install.toml commit + built_at from new binary
After `banger update` swaps binaries, install.toml needs to reflect
the just-installed identity. The previous code passed
buildinfo.Current().{Commit,BuiltAt} into installmeta.UpdateBuildInfo
— but buildinfo.Current() in the running CLI is the OLD pre-swap
binary's identity (we're it), not the staged one. install.toml's
version field got refreshed to target.Version while commit and
built_at stayed pinned at the previous release. `banger doctor`
compares the running CLI's three fields against install.toml's
three fields and so raised a false-positive drift warning on
every update.

Fix: after the swap, exec /usr/local/bin/banger version, parse the
three-line output, and write all three fields to install.toml. If
the exec fails for any reason we fall back to the old behaviour
(version + stale commit/built_at) with a warning, since install.toml
drift is a doctor warning not a broken host — same posture as
before for the failure path.

The parser is split out (parseVersionOutput) and table-tested:
happy path, whitespace-tolerance, missing-field rejection, empty
input rejection, ignoring unrelated lines.

Caught by running v0.1.0 → v0.1.1 live as the first end-to-end
smoke test of the self-update flow, which was the whole point of
that exercise.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 14:38:59 -03:00
..
style cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
aliases_test.go remove vm session feature 2026-04-20 12:47:58 -03:00
banger.go cli: add banger update command 2026-04-29 12:35:04 -03:00
bangerd.go update: docs + publish script for the self-update feature 2026-04-29 12:43:46 -03:00
cli_test.go cli: add banger update command 2026-04-29 12:35:04 -03:00
commands_daemon.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
commands_image.go Merge model,cli,docs polish for v0.1.0 2026-04-28 17:36:47 -03:00
commands_internal.go cli + daemon: move test seams off package globals onto injected structs 2026-04-19 19:03:55 -03:00
commands_kernel.go cli,docs: trivial polish for v0.1.0 2026-04-28 17:31:54 -03:00
commands_ssh_config.go cli: rewrite help text for AI-driven discovery 2026-04-26 15:02:08 -03:00
commands_system.go firecracker: adopt firecracker-jailer for VM launch (Phase B) 2026-04-28 14:38:07 -03:00
commands_update.go update: refresh install.toml commit + built_at from new binary 2026-04-29 14:38:59 -03:00
commands_update_test.go update: refresh install.toml commit + built_at from new binary 2026-04-29 14:38:59 -03:00
commands_vm.go Merge model,cli,docs polish for v0.1.0 2026-04-28 17:36:47 -03:00
completion.go cli,docs: trivial polish for v0.1.0 2026-04-28 17:31:54 -03:00
completion_test.go remove vm session feature 2026-04-20 12:47:58 -03:00
daemon_lifecycle.go cli: wait for the daemon socket to answer ping after install/restart 2026-04-26 21:22:31 -03:00
daemon_lifecycle_test.go firecracker: adopt firecracker-jailer for VM launch (Phase B) 2026-04-28 14:38:07 -03:00
deps.go seams: move the last four package globals onto instance fields 2026-04-22 12:07:14 -03:00
errors.go cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
errors_test.go cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
formatters_test.go cli,docs: trivial polish for v0.1.0 2026-04-28 17:31:54 -03:00
known_hosts.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
make_bundle_test.go banger internal make-bundle: build image bundles from flat rootfs tars 2026-04-17 15:17:50 -03:00
printers.go cli,docs: trivial polish for v0.1.0 2026-04-28 17:31:54 -03:00
prune_test.go cli + daemon: move test seams off package globals onto injected structs 2026-04-19 19:03:55 -03:00
ssh.go smoke: five more scenarios + fix exit-code propagation bug the new ones caught 2026-04-22 19:37:07 -03:00
vm_create.go cli: maturity polish — color, error translation, tabwriter consistency 2026-04-26 22:27:07 -03:00
vm_exec.go feat(vm): add vm exec command with workspace dirty detection 2026-04-26 23:53:45 -03:00
vm_run.go daemon: split owner daemon from root helper 2026-04-26 12:43:17 -03:00
vm_spec_test.go vm defaults: host-aware sizing + spec line on spawn + doctor check 2026-04-19 13:06:51 -03:00
workspace_preview.go noteUntrackedSkipped: fix subdir underreport + be best-effort everywhere 2026-04-22 12:42:33 -03:00
workspace_preview_test.go noteUntrackedSkipped: fix subdir underreport + be best-effort everywhere 2026-04-22 12:42:33 -03:00