opencode-box
v1.5.1
Published
A secure, lightweight Docker environment for AI-assisted development with OpenCode
Maintainers
Readme
opencode-box
OpenCode Box is a secure, containerized development environment for AI-assisted coding with OpenCode.
It provides an isolated Docker environment where you can safely work with AI-powered development tools while keeping your host system secure.
Installation
Install OpenCode Box globally via npm:
npm install -g opencode-boxQuick Start
- Navigate to any Git repository:
cd /path/to/your/git/project- Launch OpenCode Box:
opencodeboxOpenCode Box will automatically:
- Build the Docker image (if not already built)
- Securely forward your SSH/Git credentials to the container
- Copy OpenCode configurations (
~/.local/share/opencodeand~/.config/opencode) - Clone the current repository inside the container
- Checkout to the current branch from your host machine
- Start OpenCode in the isolated environment
Workspace Modes
OpenCode Box supports three workspace modes:
--gitcheckout (default)
Clones repository inside container.
opencodebox --gitcheckout- Interactive terminal session
- SSH credentials required
- Dedicated workspace volume
- Automatic cleanup on exit
--mount-ro
Mount workspace as read-only.
opencodebox --mount-ro- Code examination only
- No file modifications allowed
- No SSH requirements
- Direct workspace mounting
--mount-rw
Mount workspace as read-write.
opencodebox --mount-rw- Direct file editing
- Changes saved to host filesystem
- No SSH requirements
- Direct workspace mounting
Advanced Usage
Interactive shell
opencodebox --gitcheckout --itForce rebuild
opencodebox --gitcheckout --rebuildMultiple instances
cd ~/project-a
opencodebox --mount-ro
cd ~/project-b
opencodebox --mount-rwCommand Reference
Modes
| Mode | Description | SSH Required | Interactive | |------|------------|-------------|------------| | --gitcheckout | Clone repository inside container | Yes | Yes | | --mount-ro | Mount workspace as read-only | No | No | | --mount-rw | Mount workspace as read-write | No | No |
Options
| Option | Description | |--------|------------| | --it | Interactive shell | | --rebuild | Force rebuild Docker image | | --help, -h | Show help | | --version, -v | Show version |
System Requirements
- Node.js 16+
- npm 7+
- Docker 20.10+
- Git 2.25+
SSH Setup
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
ssh-add -lGit Configuration
git config --global user.name
git config --global user.emailDocker Check
docker --version
docker info
docker run hello-worldTroubleshooting
SSH issues
ssh-add -lDocker permissions
sudo usermod -aG docker $USERGit auth
ssh -T [email protected]Container Architecture
- Base image: node:20-alpine
- OpenCode CLI installed globally
- Non-root user
- Isolated environment
- Volume mounts for workspace
Roadmap
- Workspace modes (completed)
- Container management (completed)
- Interactive shell (completed)
- Volume mounting improvements
- Multi-platform support
- Performance improvements
