recoder-code
Version:
๐ Recoder Code - AI-powered CLI for developers. Chat with 40+ models (Claude, GPT-4, DeepSeek, Gemini, Qwen3) with tool calling support. Build projects, automate workflows. Free agentic models included! Features interactive mode, file operations, and opt
280 lines (222 loc) โข 7.66 kB
Markdown
# ๐ณ Recoder Code DevContainer
This devcontainer provides a complete, preconfigured development environment for Recoder Code with all dependencies, tools, and services ready to use.
## ๐ Quick Start
### Option 1: VS Code + Dev Containers Extension
1. Install [VS Code](https://code.visualstudio.com/) and the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
2. Clone the repository: `git clone https://github.com/caelum0x/recoder-code.git`
3. Open in VS Code and click "Reopen in Container" when prompted
4. Wait for the container to build and initialize (first time takes ~5-10 minutes)
### Option 2: Docker Command Line
```bash
# Clone the repository
git clone https://github.com/caelum0x/recoder-code.git
cd recoder-code
# Build and run the devcontainer
docker build -t recoder-dev .devcontainer
docker run -it -v $(pwd):/workspace recoder-dev zsh
```
### Option 3: Codespaces (if available)
Click "Create codespace" from the GitHub repository page.
## ๐ง What's Included
### โ
Pre-installed Software
- **Node.js 20** with npm and global package management
- **Published recoder-code package** (latest NPM version)
- **Development tools**: git, docker, zsh with Oh My Zsh
- **Utilities**: fzf, jq, nano, vim, curl, wget
- **GitHub CLI** for repository management
### โ
Development Environment
- **Workspace**: `/workspace` (your local project directory)
- **Config**: `/home/node/.recoder-code` (persistent across rebuilds)
- **Shell**: zsh with helpful aliases and shortcuts
- **Node**: Global NPM packages and development linking
### โ
VS Code Extensions
- ESLint, Prettier for code quality
- GitLens for Git integration
- Docker extension for container management
- JSON, YAML, TypeScript support
- Terminal enhancements and utilities
### โ
Environment Variables
```bash
RECODER_CONFIG_DIR=/home/node/.recoder-code
OPENROUTER_SITE_NAME=Recoder-Code-DevContainer
OPENROUTER_SITE_URL=https://recoder.xyz
RECODER_DEBUG=true
NODE_OPTIONS=--max-old-space-size=4096
```
## ๐ฏ Quick Commands
The devcontainer comes with helpful aliases for common operations:
### Basic Commands
```bash
rc --help # Show recoder-code help
rcs # Run setup
rcp # Check progress
rcm # List models
rcv # Show version
rci # System information
```
### Development Commands
```bash
rcd # Run with debug mode
rcl # Run in lite mode
rcf # Run with streaming
rchello # Quick test command
rctest # Create test file
```
### Services Management
```bash
rcsrv # Services commands
rcstart # Start services
rcstop # Stop services
rcstatus # Check service status
```
### Project Management
```bash
rcinit # Initialize project
rclist # List sessions
rcresume # Resume session
```
## ๐งช Testing Your Setup
Run the integration test to validate everything is working:
```bash
/workspace/.devcontainer/test-integration.sh
```
This will check:
- โ
Published package installation
- โ
Development workspace setup
- โ
Configuration and environment
- โ
Shell aliases and shortcuts
- โ
Docker and Node.js versions
- โ
File permissions and mounts
## ๐ Directory Structure
```
/workspace/ # Your project (mounted from local)
โโโ cli/ # CLI source code
โโโ .devcontainer/ # DevContainer configuration
โ โโโ devcontainer.json # Main container config
โ โโโ Dockerfile # Container image definition
โ โโโ recoder-init.sh # Initialization script
โ โโโ test-integration.sh # Validation tests
โ โโโ README.md # This file
โโโ package.json # Project configuration
/home/node/.recoder-code/ # Persistent configuration (volume)
โโโ config.json # Main configuration
โโโ .env # Environment variables
โโโ logs/ # Application logs
โโโ sessions/ # Saved sessions
```
## ๐ API Key Setup
### Method 1: Environment Variable (Recommended)
Set the `OPENROUTER_API_KEY` environment variable on your host machine:
**macOS/Linux:**
```bash
export OPENROUTER_API_KEY=your_key_here
```
**Windows:**
```powershell
$env:OPENROUTER_API_KEY="your_key_here"
```
### Method 2: Configuration File
Edit `/home/node/.recoder-code/.env` in the container:
```bash
OPENROUTER_API_KEY=your_key_here
```
### Method 3: CLI Command
```bash
rc --setup # Interactive setup wizard
```
## ๐ ๏ธ Development Workflow
### 1. Working with Published Package
The devcontainer automatically installs the latest published version:
```bash
which recoder-code # Shows: /usr/local/bin/recoder-code
rc --version # Published version
```
### 2. Working with Development Version
Your local code is linked for development:
```bash
npm link # Link development version
node cli/run.js # Run development version directly
```
### 3. Testing Changes
```bash
npm run lint # Check code quality
npm run test # Run tests
npm run build # Build project
```
### 4. Package Development
```bash
npm pack # Create package tarball
npm version patch # Bump version
npm publish # Publish to NPM (requires auth)
```
## ๐ณ Docker Services
The devcontainer supports running Recoder Code's microservices:
```bash
# Check Docker availability
docker --version
# Generate docker-compose file
rc services compose
# Start services (requires docker-compose.services.yml)
rc services start
# Check service status
rc services status
```
## ๐ง Customization
### Adding VS Code Extensions
Edit `.devcontainer/devcontainer.json`:
```json
"extensions": [
"your.extension.id"
]
```
### Adding System Packages
Edit `.devcontainer/Dockerfile`:
```dockerfile
RUN apt-get update && apt-get install -y your-package
```
### Modifying Environment
Edit `.devcontainer/devcontainer.json`:
```json
"containerEnv": {
"YOUR_VAR": "your_value"
}
```
## ๐ Troubleshooting
### Container Won't Start
1. Check Docker is running on your host machine
2. Ensure you have enough disk space (>2GB needed)
3. Try rebuilding: Command Palette โ "Dev Containers: Rebuild Container"
### NPM Global Packages Issues
```bash
npm config list # Check NPM configuration
npm prefix -g # Should show /usr/local/share/npm-global
```
### Permission Issues
```bash
sudo chown -R node:node /home/node/.recoder-code
```
### Network Issues
```bash
curl -v https://api.openrouter.com/api/v1/models # Test API access
ping google.com # Test internet
```
### Development Version Not Working
```bash
cd /workspace
npm install # Reinstall dependencies
npm link # Relink global command
```
## ๐ Additional Resources
- **Recoder Website**: https://recoder.xyz
- **NPM Package**: https://www.npmjs.com/package/recoder-code
- **Documentation**: Check `/workspace/README.md`
- **VS Code Dev Containers**: https://code.visualstudio.com/docs/devcontainers/containers
## ๐ค Contributing
When working in the devcontainer:
1. Make your changes in `/workspace`
2. Test with `npm run test` and integration tests
3. Use development version: `node cli/run.js your-command`
4. Compare with published version: `rc your-command`
5. Submit PR to `https://github.com/caelum0x/recoder-code`
**Happy coding with Recoder Code! ๐**