Remove opencode package + vm acp command (dead code)

The `internal/opencode` package and the `opencodeCapability` that
consumed it were hard-wired to wait for opencode on guest port 4096
when an image shipped an initrd. After the prune commits (void /
alpine / customize.sh / image build all removed), nothing banger
produces today carries an initrd, so the capability's wait path was
unreachable: every startup short-circuited to the "direct-boot, skip
opencode" branch.

Same logic for `banger vm acp`: it SSHes to `opencode acp --cwd
<path>`, a binary the golden image no longer ships. Users who run
their own image with opencode can still invoke
`ssh vm -- opencode acp --cwd /root/repo` directly — no banger
scaffolding required.

Removed:
- internal/opencode/ (whole package, 255 LOC incl. tests)
- internal/daemon/opencode.go (opencodeCapability)
- cli `vm acp` command + its helpers (runVMACP, sshACPCommandArgs,
  vmACPRemoteCommand) + their tests
- The opencodeCapability{} entry in registeredCapabilities() plus
  the test that pinned its presence
- `wait_opencode` progress-stage label from the vm-create renderer
- Stale mentions in daemon/doc.go, README, and webui test fixtures

~480 lines gone, 12 added. `banger/internal` is now 25 packages
instead of 26.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thales Maciel 2026-04-18 16:54:37 -03:00
parent 0933deaeb1
commit b5c13e3938
No known key found for this signature in database
GPG key ID: 33112E6833C34679
10 changed files with 12 additions and 482 deletions

View file

@ -56,7 +56,6 @@ func (d *Daemon) registeredCapabilities() []vmCapability {
}
return []vmCapability{
workDiskCapability{},
opencodeCapability{},
dnsCapability{},
natCapability{},
}

View file

@ -144,13 +144,13 @@ func TestContributeHooksPopulateGuestAndMachineConfig(t *testing.T) {
}
}
func TestRegisteredCapabilitiesIncludeOpencode(t *testing.T) {
func TestRegisteredCapabilitiesInOrder(t *testing.T) {
d := &Daemon{}
var names []string
for _, capability := range d.registeredCapabilities() {
names = append(names, capability.Name())
}
want := []string{"work-disk", "opencode", "dns", "nat"}
want := []string{"work-disk", "dns", "nat"}
if !reflect.DeepEqual(names, want) {
t.Fatalf("capabilities = %v, want %v", names, want)
}

View file

@ -58,7 +58,6 @@
// session_controller.go guestSessionController, sessionRegistry
// ssh_client_config.go daemon-managed SSH client key material
// workspace.go ExportVMWorkspace, PrepareVMWorkspace
// opencode.go opencode host-side helpers
//
// Host bootstrap (in this package):
//

View file

@ -1,25 +0,0 @@
package daemon
import (
"context"
"strings"
"banger/internal/model"
"banger/internal/opencode"
)
type opencodeCapability struct{}
func (opencodeCapability) Name() string { return "opencode" }
func (opencodeCapability) PostStart(ctx context.Context, d *Daemon, vm model.VMRecord, image model.Image) error {
if strings.TrimSpace(image.InitrdPath) == "" {
// Direct-boot images (OCI pulls) don't ship the opencode
// service — skip the readiness check so the VM isn't marked
// as error for lacking an opinionated add-on.
return nil
}
return opencode.WaitReady(ctx, d.logger, vm.Runtime.VSockPath, func(stage, detail string) {
vmCreateStage(ctx, stage, detail)
})
}