Repository navigation
Closed
Description
Context
The containerized OpenCode environment is ready — containerfile#1 delivered the Containerfile, devfiles, podman-compose, and scripts. The missing piece is a uf sandbox CLI command that orchestrates the multi-step Podman workflow into a single command.
Part of: Discussion #88
Depends on: containerfile#1 (closed, complete)
Proposed Command
uf sandbox start # start container + attach TUI
uf sandbox start --detach # start container, print URL
uf sandbox attach # attach to running container
uf sandbox stop # stop and remove container
uf sandbox extract # git format-patch from container to hostWhat uf sandbox start Does
- Check prerequisites: Podman installed (LookPath), Ollama running (probe localhost:11434), API keys in environment
- Detect platform: arm64/amd64 (runtime.GOARCH), SELinux presence (
:Zflag on Fedora) - Resolve image: Default
quay.io/unbound-force/opencode-dev:latest, overridable via--imageflag orUF_SANDBOX_IMAGEenv var - Pull if needed:
podman pull <image> - Start container:
podman run -dwith correct volume mounts, env vars, resource limits, port mapping - Wait for ready: Poll
http://localhost:4096/healthuntil healthy (timeout 60s) - Attach: Run
opencode attach http://localhost:4096(or return URL if--detach)
What uf sandbox extract Does
- Check container is running (
podman ps) - Run
git format-patchinside container - Present patch for human review (summary of changes)
- Apply on confirmation (
git am)
Modes
--mode isolated(default): Read-only source mount. Agent works on a copy. Changes extracted via git format-patch. Maximum safety.--mode direct: Read-write volume mount. Agent writes directly to host. Convenience for trusted tasks.
Configurable via UF_SANDBOX_MODE=isolated|direct or CLI flag.
Design Decisions
- Single container only: One
uf-sandboxcontainer at a time. No concurrent container support (simplifies naming, ports, mental model). - Podman as prerequisite:
uf doctorcan check if Podman is installed butuf setupdoes NOT install it (platform-specific, typically handled by OS). - Ollama on host: Container connects via
DEWEY_EMBEDDING_ENDPOINT=http://host.containers.internal:11434. Keeps the image light. - Resource limits: Default
--memory 8g --cpus 4, overridable via--memoryand--cpusflags.
New Package
internal/sandbox/
\u251c\u2500\u2500 sandbox.go # Core logic (start, stop, attach, extract)
\u251c\u2500\u2500 detect.go # Platform detection (arch, SELinux, Podman version)
\u251c\u2500\u2500 config.go # Container config (image, volumes, env, limits)
\u2514\u2500\u2500 sandbox_test.go # Tests with mock exec
Plus Cobra command wiring in cmd/unbound-force/.
Estimated Scope
- ~300 lines Go code (
internal/sandbox/) - ~100 lines Cobra commands
- ~400 lines tests
- ~20 lines AGENTS.md
- Speckit strategic spec (028)
Platforms
- macOS arm64 (MacBook Pro)
- Fedora amd64 (workstation/server)
- SELinux-aware volume mounting (
:Zflag detection)
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsNo status
Activity