recoder-code 2.4.3 → 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/.devcontainer/Dockerfile +0 -94
- package/.devcontainer/README.md +0 -280
- package/.devcontainer/devcontainer.json +0 -103
- package/.devcontainer/init-firewall.sh +0 -151
- package/.devcontainer/recoder-devcontainer.json +0 -73
- package/.devcontainer/recoder-dockerfile +0 -74
- package/.devcontainer/recoder-init.sh +0 -213
- package/.devcontainer/test-integration.sh +0 -130
- package/CHANGELOG.md +0 -233
- package/CODE_OF_CONDUCT.md +0 -187
- package/CONTRIBUTING.md +0 -50
- package/LICENSE.md +0 -21
- package/SANDBOX_QUICK_REFERENCE.md +0 -168
- package/SANDBOX_SETUP_GUIDE.md +0 -331
- package/validate.js +0 -81
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "recoder-code",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "🚀 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 optional sandbox security.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/.devcontainer/Dockerfile
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
FROM node:20
|
|
2
|
-
|
|
3
|
-
ARG TZ
|
|
4
|
-
ENV TZ="$TZ"
|
|
5
|
-
|
|
6
|
-
ARG RECODER_VERSION=latest
|
|
7
|
-
ARG NODE_VERSION=20
|
|
8
|
-
|
|
9
|
-
# Install basic development tools and iptables/ipset
|
|
10
|
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
11
|
-
less \
|
|
12
|
-
git \
|
|
13
|
-
procps \
|
|
14
|
-
sudo \
|
|
15
|
-
fzf \
|
|
16
|
-
zsh \
|
|
17
|
-
man-db \
|
|
18
|
-
unzip \
|
|
19
|
-
gnupg2 \
|
|
20
|
-
gh \
|
|
21
|
-
iptables \
|
|
22
|
-
ipset \
|
|
23
|
-
iproute2 \
|
|
24
|
-
dnsutils \
|
|
25
|
-
aggregate \
|
|
26
|
-
jq \
|
|
27
|
-
nano \
|
|
28
|
-
vim \
|
|
29
|
-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
30
|
-
|
|
31
|
-
# Ensure default node user has access to /usr/local/share
|
|
32
|
-
RUN mkdir -p /usr/local/share/npm-global && \
|
|
33
|
-
chown -R node:node /usr/local/share
|
|
34
|
-
|
|
35
|
-
ARG USERNAME=node
|
|
36
|
-
|
|
37
|
-
# Persist bash history.
|
|
38
|
-
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
|
39
|
-
&& mkdir /commandhistory \
|
|
40
|
-
&& touch /commandhistory/.bash_history \
|
|
41
|
-
&& chown -R $USERNAME /commandhistory
|
|
42
|
-
|
|
43
|
-
# Set `DEVCONTAINER` environment variable to help with orientation
|
|
44
|
-
ENV DEVCONTAINER=true
|
|
45
|
-
|
|
46
|
-
# Create workspace and config directories and set permissions
|
|
47
|
-
RUN mkdir -p /workspace /home/node/.recoder-code && \
|
|
48
|
-
chown -R node:node /workspace /home/node/.recoder-code
|
|
49
|
-
|
|
50
|
-
WORKDIR /workspace
|
|
51
|
-
|
|
52
|
-
ARG GIT_DELTA_VERSION=0.18.2
|
|
53
|
-
RUN ARCH=$(dpkg --print-architecture) && \
|
|
54
|
-
wget "https://github.com/dandavison/delta/releases/download/${GIT_DELTA_VERSION}/git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
|
|
55
|
-
sudo dpkg -i "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
|
|
56
|
-
rm "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb"
|
|
57
|
-
|
|
58
|
-
# Set up non-root user
|
|
59
|
-
USER node
|
|
60
|
-
|
|
61
|
-
# Install global packages
|
|
62
|
-
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
|
|
63
|
-
ENV PATH=$PATH:/usr/local/share/npm-global/bin
|
|
64
|
-
|
|
65
|
-
# Set the default shell to zsh rather than sh
|
|
66
|
-
ENV SHELL=/bin/zsh
|
|
67
|
-
|
|
68
|
-
# Set the default editor and visual
|
|
69
|
-
ENV EDITOR=nano
|
|
70
|
-
ENV VISUAL=nano
|
|
71
|
-
|
|
72
|
-
# Default powerline10k theme
|
|
73
|
-
ARG ZSH_IN_DOCKER_VERSION=1.2.0
|
|
74
|
-
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/zsh-in-docker.sh)" -- \
|
|
75
|
-
-p git \
|
|
76
|
-
-p fzf \
|
|
77
|
-
-a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
|
|
78
|
-
-a "source /usr/share/doc/fzf/examples/completion.zsh" \
|
|
79
|
-
-a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
|
80
|
-
-x
|
|
81
|
-
|
|
82
|
-
# Install published Recoder Code package
|
|
83
|
-
RUN npm install -g recoder-code
|
|
84
|
-
|
|
85
|
-
# Install basic dependencies that might be needed
|
|
86
|
-
RUN npm install -g axios
|
|
87
|
-
|
|
88
|
-
# Copy and set up firewall script
|
|
89
|
-
COPY init-firewall.sh /usr/local/bin/
|
|
90
|
-
USER root
|
|
91
|
-
RUN chmod +x /usr/local/bin/init-firewall.sh && \
|
|
92
|
-
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
|
|
93
|
-
chmod 0440 /etc/sudoers.d/node-firewall
|
|
94
|
-
USER node
|
package/.devcontainer/README.md
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
# 🐳 Recoder Code DevContainer
|
|
2
|
-
|
|
3
|
-
This devcontainer provides a complete, preconfigured development environment for Recoder Code with all dependencies, tools, and services ready to use.
|
|
4
|
-
|
|
5
|
-
## 🚀 Quick Start
|
|
6
|
-
|
|
7
|
-
### Option 1: VS Code + Dev Containers Extension
|
|
8
|
-
1. Install [VS Code](https://code.visualstudio.com/) and the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
|
9
|
-
2. Clone the repository: `git clone https://github.com/caelum0x/recoder-code.git`
|
|
10
|
-
3. Open in VS Code and click "Reopen in Container" when prompted
|
|
11
|
-
4. Wait for the container to build and initialize (first time takes ~5-10 minutes)
|
|
12
|
-
|
|
13
|
-
### Option 2: Docker Command Line
|
|
14
|
-
```bash
|
|
15
|
-
# Clone the repository
|
|
16
|
-
git clone https://github.com/caelum0x/recoder-code.git
|
|
17
|
-
cd recoder-code
|
|
18
|
-
|
|
19
|
-
# Build and run the devcontainer
|
|
20
|
-
docker build -t recoder-dev .devcontainer
|
|
21
|
-
docker run -it -v $(pwd):/workspace recoder-dev zsh
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Option 3: Codespaces (if available)
|
|
25
|
-
Click "Create codespace" from the GitHub repository page.
|
|
26
|
-
|
|
27
|
-
## 🔧 What's Included
|
|
28
|
-
|
|
29
|
-
### ✅ Pre-installed Software
|
|
30
|
-
- **Node.js 20** with npm and global package management
|
|
31
|
-
- **Published recoder-code package** (latest NPM version)
|
|
32
|
-
- **Development tools**: git, docker, zsh with Oh My Zsh
|
|
33
|
-
- **Utilities**: fzf, jq, nano, vim, curl, wget
|
|
34
|
-
- **GitHub CLI** for repository management
|
|
35
|
-
|
|
36
|
-
### ✅ Development Environment
|
|
37
|
-
- **Workspace**: `/workspace` (your local project directory)
|
|
38
|
-
- **Config**: `/home/node/.recoder-code` (persistent across rebuilds)
|
|
39
|
-
- **Shell**: zsh with helpful aliases and shortcuts
|
|
40
|
-
- **Node**: Global NPM packages and development linking
|
|
41
|
-
|
|
42
|
-
### ✅ VS Code Extensions
|
|
43
|
-
- ESLint, Prettier for code quality
|
|
44
|
-
- GitLens for Git integration
|
|
45
|
-
- Docker extension for container management
|
|
46
|
-
- JSON, YAML, TypeScript support
|
|
47
|
-
- Terminal enhancements and utilities
|
|
48
|
-
|
|
49
|
-
### ✅ Environment Variables
|
|
50
|
-
```bash
|
|
51
|
-
RECODER_CONFIG_DIR=/home/node/.recoder-code
|
|
52
|
-
OPENROUTER_SITE_NAME=Recoder-Code-DevContainer
|
|
53
|
-
OPENROUTER_SITE_URL=https://recoder.xyz
|
|
54
|
-
RECODER_DEBUG=true
|
|
55
|
-
NODE_OPTIONS=--max-old-space-size=4096
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## 🎯 Quick Commands
|
|
59
|
-
|
|
60
|
-
The devcontainer comes with helpful aliases for common operations:
|
|
61
|
-
|
|
62
|
-
### Basic Commands
|
|
63
|
-
```bash
|
|
64
|
-
rc --help # Show recoder-code help
|
|
65
|
-
rcs # Run setup
|
|
66
|
-
rcp # Check progress
|
|
67
|
-
rcm # List models
|
|
68
|
-
rcv # Show version
|
|
69
|
-
rci # System information
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Development Commands
|
|
73
|
-
```bash
|
|
74
|
-
rcd # Run with debug mode
|
|
75
|
-
rcl # Run in lite mode
|
|
76
|
-
rcf # Run with streaming
|
|
77
|
-
rchello # Quick test command
|
|
78
|
-
rctest # Create test file
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Services Management
|
|
82
|
-
```bash
|
|
83
|
-
rcsrv # Services commands
|
|
84
|
-
rcstart # Start services
|
|
85
|
-
rcstop # Stop services
|
|
86
|
-
rcstatus # Check service status
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Project Management
|
|
90
|
-
```bash
|
|
91
|
-
rcinit # Initialize project
|
|
92
|
-
rclist # List sessions
|
|
93
|
-
rcresume # Resume session
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## 🧪 Testing Your Setup
|
|
97
|
-
|
|
98
|
-
Run the integration test to validate everything is working:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
/workspace/.devcontainer/test-integration.sh
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
This will check:
|
|
105
|
-
- ✅ Published package installation
|
|
106
|
-
- ✅ Development workspace setup
|
|
107
|
-
- ✅ Configuration and environment
|
|
108
|
-
- ✅ Shell aliases and shortcuts
|
|
109
|
-
- ✅ Docker and Node.js versions
|
|
110
|
-
- ✅ File permissions and mounts
|
|
111
|
-
|
|
112
|
-
## 📁 Directory Structure
|
|
113
|
-
|
|
114
|
-
```
|
|
115
|
-
/workspace/ # Your project (mounted from local)
|
|
116
|
-
├── cli/ # CLI source code
|
|
117
|
-
├── .devcontainer/ # DevContainer configuration
|
|
118
|
-
│ ├── devcontainer.json # Main container config
|
|
119
|
-
│ ├── Dockerfile # Container image definition
|
|
120
|
-
│ ├── recoder-init.sh # Initialization script
|
|
121
|
-
│ ├── test-integration.sh # Validation tests
|
|
122
|
-
│ └── README.md # This file
|
|
123
|
-
└── package.json # Project configuration
|
|
124
|
-
|
|
125
|
-
/home/node/.recoder-code/ # Persistent configuration (volume)
|
|
126
|
-
├── config.json # Main configuration
|
|
127
|
-
├── .env # Environment variables
|
|
128
|
-
├── logs/ # Application logs
|
|
129
|
-
└── sessions/ # Saved sessions
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## 🔐 API Key Setup
|
|
133
|
-
|
|
134
|
-
### Method 1: Environment Variable (Recommended)
|
|
135
|
-
Set the `OPENROUTER_API_KEY` environment variable on your host machine:
|
|
136
|
-
|
|
137
|
-
**macOS/Linux:**
|
|
138
|
-
```bash
|
|
139
|
-
export OPENROUTER_API_KEY=your_key_here
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
**Windows:**
|
|
143
|
-
```powershell
|
|
144
|
-
$env:OPENROUTER_API_KEY="your_key_here"
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Method 2: Configuration File
|
|
148
|
-
Edit `/home/node/.recoder-code/.env` in the container:
|
|
149
|
-
```bash
|
|
150
|
-
OPENROUTER_API_KEY=your_key_here
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Method 3: CLI Command
|
|
154
|
-
```bash
|
|
155
|
-
rc --setup # Interactive setup wizard
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## 🛠️ Development Workflow
|
|
159
|
-
|
|
160
|
-
### 1. Working with Published Package
|
|
161
|
-
The devcontainer automatically installs the latest published version:
|
|
162
|
-
```bash
|
|
163
|
-
which recoder-code # Shows: /usr/local/bin/recoder-code
|
|
164
|
-
rc --version # Published version
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### 2. Working with Development Version
|
|
168
|
-
Your local code is linked for development:
|
|
169
|
-
```bash
|
|
170
|
-
npm link # Link development version
|
|
171
|
-
node cli/run.js # Run development version directly
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### 3. Testing Changes
|
|
175
|
-
```bash
|
|
176
|
-
npm run lint # Check code quality
|
|
177
|
-
npm run test # Run tests
|
|
178
|
-
npm run build # Build project
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### 4. Package Development
|
|
182
|
-
```bash
|
|
183
|
-
npm pack # Create package tarball
|
|
184
|
-
npm version patch # Bump version
|
|
185
|
-
npm publish # Publish to NPM (requires auth)
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## 🐳 Docker Services
|
|
189
|
-
|
|
190
|
-
The devcontainer supports running Recoder Code's microservices:
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
# Check Docker availability
|
|
194
|
-
docker --version
|
|
195
|
-
|
|
196
|
-
# Generate docker-compose file
|
|
197
|
-
rc services compose
|
|
198
|
-
|
|
199
|
-
# Start services (requires docker-compose.services.yml)
|
|
200
|
-
rc services start
|
|
201
|
-
|
|
202
|
-
# Check service status
|
|
203
|
-
rc services status
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
## 🔧 Customization
|
|
207
|
-
|
|
208
|
-
### Adding VS Code Extensions
|
|
209
|
-
Edit `.devcontainer/devcontainer.json`:
|
|
210
|
-
```json
|
|
211
|
-
"extensions": [
|
|
212
|
-
"your.extension.id"
|
|
213
|
-
]
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Adding System Packages
|
|
217
|
-
Edit `.devcontainer/Dockerfile`:
|
|
218
|
-
```dockerfile
|
|
219
|
-
RUN apt-get update && apt-get install -y your-package
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Modifying Environment
|
|
223
|
-
Edit `.devcontainer/devcontainer.json`:
|
|
224
|
-
```json
|
|
225
|
-
"containerEnv": {
|
|
226
|
-
"YOUR_VAR": "your_value"
|
|
227
|
-
}
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## 🐛 Troubleshooting
|
|
231
|
-
|
|
232
|
-
### Container Won't Start
|
|
233
|
-
1. Check Docker is running on your host machine
|
|
234
|
-
2. Ensure you have enough disk space (>2GB needed)
|
|
235
|
-
3. Try rebuilding: Command Palette → "Dev Containers: Rebuild Container"
|
|
236
|
-
|
|
237
|
-
### NPM Global Packages Issues
|
|
238
|
-
```bash
|
|
239
|
-
npm config list # Check NPM configuration
|
|
240
|
-
npm prefix -g # Should show /usr/local/share/npm-global
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### Permission Issues
|
|
244
|
-
```bash
|
|
245
|
-
sudo chown -R node:node /home/node/.recoder-code
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Network Issues
|
|
249
|
-
```bash
|
|
250
|
-
curl -v https://api.openrouter.com/api/v1/models # Test API access
|
|
251
|
-
ping google.com # Test internet
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### Development Version Not Working
|
|
255
|
-
```bash
|
|
256
|
-
cd /workspace
|
|
257
|
-
npm install # Reinstall dependencies
|
|
258
|
-
npm link # Relink global command
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
## 📚 Additional Resources
|
|
262
|
-
|
|
263
|
-
- **Recoder Website**: https://recoder.xyz
|
|
264
|
-
- **NPM Package**: https://www.npmjs.com/package/recoder-code
|
|
265
|
-
- **Documentation**: Check `/workspace/README.md`
|
|
266
|
-
- **VS Code Dev Containers**: https://code.visualstudio.com/docs/devcontainers/containers
|
|
267
|
-
|
|
268
|
-
## 🤝 Contributing
|
|
269
|
-
|
|
270
|
-
When working in the devcontainer:
|
|
271
|
-
|
|
272
|
-
1. Make your changes in `/workspace`
|
|
273
|
-
2. Test with `npm run test` and integration tests
|
|
274
|
-
3. Use development version: `node cli/run.js your-command`
|
|
275
|
-
4. Compare with published version: `rc your-command`
|
|
276
|
-
5. Submit PR to `https://github.com/caelum0x/recoder-code`
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
**Happy coding with Recoder Code! 🚀**
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Recoder Code Development Container",
|
|
3
|
-
"build": {
|
|
4
|
-
"dockerfile": "Dockerfile",
|
|
5
|
-
"args": {
|
|
6
|
-
"TZ": "${localEnv:TZ:America/Los_Angeles}",
|
|
7
|
-
"RECODER_VERSION": "latest",
|
|
8
|
-
"NODE_VERSION": "20"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"runArgs": [
|
|
12
|
-
"--cap-add=NET_ADMIN",
|
|
13
|
-
"--cap-add=NET_RAW"
|
|
14
|
-
],
|
|
15
|
-
"customizations": {
|
|
16
|
-
"vscode": {
|
|
17
|
-
"extensions": [
|
|
18
|
-
"dbaeumer.vscode-eslint",
|
|
19
|
-
"esbenp.prettier-vscode",
|
|
20
|
-
"eamodio.gitlens",
|
|
21
|
-
"ms-vscode.vscode-typescript-next",
|
|
22
|
-
"bradlc.vscode-tailwindcss",
|
|
23
|
-
"ms-vscode.vscode-json",
|
|
24
|
-
"redhat.vscode-yaml",
|
|
25
|
-
"ms-vscode.vscode-docker",
|
|
26
|
-
"formulahendry.terminal",
|
|
27
|
-
"streetsidesoftware.code-spell-checker",
|
|
28
|
-
"ms-vscode.vscode-github-actions",
|
|
29
|
-
"ms-vscode.npm-script-runner",
|
|
30
|
-
"christian-kohler.path-intellisense",
|
|
31
|
-
"waderyan.nodejs-extension-pack"
|
|
32
|
-
],
|
|
33
|
-
"settings": {
|
|
34
|
-
"editor.formatOnSave": true,
|
|
35
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
36
|
-
"editor.codeActionsOnSave": {
|
|
37
|
-
"source.fixAll.eslint": "explicit"
|
|
38
|
-
},
|
|
39
|
-
"terminal.integrated.defaultProfile.linux": "zsh",
|
|
40
|
-
"terminal.integrated.profiles.linux": {
|
|
41
|
-
"bash": {
|
|
42
|
-
"path": "bash",
|
|
43
|
-
"icon": "terminal-bash"
|
|
44
|
-
},
|
|
45
|
-
"zsh": {
|
|
46
|
-
"path": "zsh"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"terminal.integrated.env.linux": {
|
|
50
|
-
"OPENROUTER_API_KEY": "${localEnv:OPENROUTER_API_KEY}",
|
|
51
|
-
"RECODER_DEBUG": "true"
|
|
52
|
-
},
|
|
53
|
-
"files.watcherExclude": {
|
|
54
|
-
"**/node_modules/**": true,
|
|
55
|
-
"**/.git/objects/**": true,
|
|
56
|
-
"**/.recoder-code/logs/**": true,
|
|
57
|
-
"**/.recoder-code/sessions/**": true
|
|
58
|
-
},
|
|
59
|
-
"search.exclude": {
|
|
60
|
-
"**/node_modules": true,
|
|
61
|
-
"**/logs": true,
|
|
62
|
-
"**/.recoder-code/sessions": true
|
|
63
|
-
},
|
|
64
|
-
"npm.enableScriptExplorer": true,
|
|
65
|
-
"terminal.integrated.enableBell": false,
|
|
66
|
-
"terminal.integrated.fontSize": 14
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
"remoteUser": "node",
|
|
71
|
-
"mounts": [
|
|
72
|
-
"source=recoder-bashhistory-${devcontainerId},target=/commandhistory,type=volume",
|
|
73
|
-
"source=recoder-config-${devcontainerId},target=/home/node/.recoder-code,type=volume",
|
|
74
|
-
"source=recoder-logs-${devcontainerId},target=/home/node/.recoder-code/logs,type=volume",
|
|
75
|
-
"source=recoder-sessions-${devcontainerId},target=/home/node/.recoder-code/sessions,type=volume"
|
|
76
|
-
],
|
|
77
|
-
"containerEnv": {
|
|
78
|
-
"NODE_OPTIONS": "--max-old-space-size=4096",
|
|
79
|
-
"RECODER_CONFIG_DIR": "/home/node/.recoder-code",
|
|
80
|
-
"OPENROUTER_API_KEY": "${localEnv:OPENROUTER_API_KEY}",
|
|
81
|
-
"OPENROUTER_SITE_NAME": "Recoder-Code-DevContainer",
|
|
82
|
-
"OPENROUTER_SITE_URL": "https://recoder.xyz",
|
|
83
|
-
"RECODER_DEBUG": "true",
|
|
84
|
-
"RECODER_LITE_MODE": "false",
|
|
85
|
-
"PATH": "/usr/local/share/npm-global/bin:/usr/local/bin:${containerEnv:PATH}",
|
|
86
|
-
"SHELL": "/bin/zsh"
|
|
87
|
-
},
|
|
88
|
-
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=delegated",
|
|
89
|
-
"workspaceFolder": "/workspace",
|
|
90
|
-
"postCreateCommand": "chmod +x /workspace/.devcontainer/recoder-init.sh && npm install -g recoder-code && npm install && npm link && /workspace/.devcontainer/recoder-init.sh",
|
|
91
|
-
"postStartCommand": "chmod +x /workspace/.devcontainer/test-integration.sh && echo '🚀 Recoder Code development environment ready! Run: /workspace/.devcontainer/test-integration.sh to validate setup'",
|
|
92
|
-
"features": {
|
|
93
|
-
"ghcr.io/devcontainers/features/node:1": {
|
|
94
|
-
"version": "20"
|
|
95
|
-
},
|
|
96
|
-
"ghcr.io/devcontainers/features/git:1": {},
|
|
97
|
-
"ghcr.io/devcontainers/features/common-utils:2": {
|
|
98
|
-
"installZsh": true,
|
|
99
|
-
"configureZshAsDefaultShell": true,
|
|
100
|
-
"installOhMyZsh": true
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
set -euo pipefail # Exit on error, undefined vars, and pipeline failures
|
|
3
|
-
IFS=$'\n\t' # Stricter word splitting
|
|
4
|
-
|
|
5
|
-
# 1. Extract Docker DNS info BEFORE any flushing
|
|
6
|
-
DOCKER_DNS_RULES=$(iptables-save -t nat | grep "127\.0\.0\.11" || true)
|
|
7
|
-
|
|
8
|
-
# Flush existing rules and delete existing ipsets
|
|
9
|
-
iptables -F
|
|
10
|
-
iptables -X
|
|
11
|
-
iptables -t nat -F
|
|
12
|
-
iptables -t nat -X
|
|
13
|
-
iptables -t mangle -F
|
|
14
|
-
iptables -t mangle -X
|
|
15
|
-
ipset destroy allowed-domains 2>/dev/null || true
|
|
16
|
-
|
|
17
|
-
# 2. Selectively restore ONLY internal Docker DNS resolution
|
|
18
|
-
if [ -n "$DOCKER_DNS_RULES" ]; then
|
|
19
|
-
echo "Restoring Docker DNS rules..."
|
|
20
|
-
iptables -t nat -N DOCKER_OUTPUT 2>/dev/null || true
|
|
21
|
-
iptables -t nat -N DOCKER_POSTROUTING 2>/dev/null || true
|
|
22
|
-
echo "$DOCKER_DNS_RULES" | xargs -L 1 iptables -t nat
|
|
23
|
-
else
|
|
24
|
-
echo "No Docker DNS rules to restore"
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
# First allow DNS and localhost before any restrictions
|
|
28
|
-
# Allow outbound DNS
|
|
29
|
-
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
|
|
30
|
-
# Allow inbound DNS responses
|
|
31
|
-
iptables -A INPUT -p udp --sport 53 -j ACCEPT
|
|
32
|
-
# Allow outbound SSH
|
|
33
|
-
iptables -A OUTPUT -p tcp --dport 22 -j ACCEPT
|
|
34
|
-
# Allow inbound SSH responses
|
|
35
|
-
iptables -A INPUT -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
|
|
36
|
-
# Allow localhost
|
|
37
|
-
iptables -A INPUT -i lo -j ACCEPT
|
|
38
|
-
iptables -A OUTPUT -o lo -j ACCEPT
|
|
39
|
-
|
|
40
|
-
# Create ipset with CIDR support
|
|
41
|
-
ipset create allowed-domains hash:net
|
|
42
|
-
|
|
43
|
-
# Fetch GitHub meta information and aggregate + add their IP ranges
|
|
44
|
-
echo "Fetching GitHub IP ranges..."
|
|
45
|
-
gh_ranges=$(curl -s https://api.github.com/meta)
|
|
46
|
-
if [ -z "$gh_ranges" ]; then
|
|
47
|
-
echo "ERROR: Failed to fetch GitHub IP ranges"
|
|
48
|
-
exit 1
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
if ! echo "$gh_ranges" | jq -e '.web and .api and .git' >/dev/null; then
|
|
52
|
-
echo "ERROR: GitHub API response missing required fields"
|
|
53
|
-
exit 1
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
echo "Processing GitHub IPs..."
|
|
57
|
-
while read -r cidr; do
|
|
58
|
-
if [[ ! "$cidr" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/[0-9]{1,2}$ ]]; then
|
|
59
|
-
echo "ERROR: Invalid CIDR range from GitHub meta: $cidr"
|
|
60
|
-
exit 1
|
|
61
|
-
fi
|
|
62
|
-
echo "Adding GitHub range $cidr"
|
|
63
|
-
ipset add allowed-domains "$cidr"
|
|
64
|
-
done < <(echo "$gh_ranges" | jq -r '(.web + .api + .git)[]' | aggregate -q)
|
|
65
|
-
|
|
66
|
-
# Resolve and add other allowed domains
|
|
67
|
-
for domain in \
|
|
68
|
-
"registry.npmjs.org" \
|
|
69
|
-
"api.anthropic.com" \
|
|
70
|
-
"sentry.io" \
|
|
71
|
-
"statsig.anthropic.com" \
|
|
72
|
-
"statsig.com" \
|
|
73
|
-
"marketplace.visualstudio.com" \
|
|
74
|
-
"vscode.blob.core.windows.net" \
|
|
75
|
-
"update.code.visualstudio.com" \
|
|
76
|
-
"api.openrouter.com"; do # Add Open Router API domain
|
|
77
|
-
echo "Resolving $domain..."
|
|
78
|
-
ips=$(dig +noall +answer A "$domain" | awk '$4 == "A" {print $5}')
|
|
79
|
-
if [ -z "$ips" ]; then
|
|
80
|
-
echo "ERROR: Failed to resolve $domain"
|
|
81
|
-
exit 1
|
|
82
|
-
fi
|
|
83
|
-
|
|
84
|
-
while read -r ip; do
|
|
85
|
-
if [[ ! "$ip" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
|
86
|
-
echo "ERROR: Invalid IP from DNS for $domain: $ip"
|
|
87
|
-
exit 1
|
|
88
|
-
fi
|
|
89
|
-
echo "Adding $ip for $domain"
|
|
90
|
-
ipset add allowed-domains "$ip"
|
|
91
|
-
done < <(echo "$ips")
|
|
92
|
-
done
|
|
93
|
-
|
|
94
|
-
# Get host IP from default route
|
|
95
|
-
HOST_IP=$(ip route | grep default | cut -d" " -f3)
|
|
96
|
-
if [ -z "$HOST_IP" ]; then
|
|
97
|
-
echo "ERROR: Failed to detect host IP"
|
|
98
|
-
exit 1
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
HOST_NETWORK=$(echo "$HOST_IP" | sed "s/\.[0-9]*$/.0\/24/")
|
|
102
|
-
echo "Host network detected as: $HOST_NETWORK"
|
|
103
|
-
|
|
104
|
-
# Set up remaining iptables rules
|
|
105
|
-
iptables -A INPUT -s "$HOST_NETWORK" -j ACCEPT
|
|
106
|
-
iptables -A OUTPUT -d "$HOST_NETWORK" -j ACCEPT
|
|
107
|
-
|
|
108
|
-
# Set default policies to DROP first
|
|
109
|
-
iptables -P INPUT DROP
|
|
110
|
-
iptables -P FORWARD DROP
|
|
111
|
-
iptables -P OUTPUT DROP
|
|
112
|
-
|
|
113
|
-
# First allow established connections for already approved traffic
|
|
114
|
-
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
|
115
|
-
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
|
116
|
-
|
|
117
|
-
# Then allow only specific outbound traffic to allowed domains
|
|
118
|
-
iptables -A OUTPUT -m set --match-set allowed-domains dst -j ACCEPT
|
|
119
|
-
|
|
120
|
-
# Explicitly REJECT all other outbound traffic for immediate feedback
|
|
121
|
-
iptables -A OUTPUT -j REJECT --reject-with icmp-admin-prohibited
|
|
122
|
-
|
|
123
|
-
echo "Firewall configuration complete"
|
|
124
|
-
echo "Verifying firewall rules..."
|
|
125
|
-
if curl --connect-timeout 5 https://example.com >/dev/null 2>&1; then
|
|
126
|
-
echo "ERROR: Firewall verification failed - was able to reach https://example.com"
|
|
127
|
-
exit 1
|
|
128
|
-
else
|
|
129
|
-
echo "Firewall verification passed - unable to reach https://example.com as expected"
|
|
130
|
-
fi
|
|
131
|
-
|
|
132
|
-
# Verify GitHub API access
|
|
133
|
-
if ! curl --connect-timeout 5 https://api.github.com/zen >/dev/null 2>&1; then
|
|
134
|
-
echo "ERROR: Firewall verification failed - unable to reach https://api.github.com"
|
|
135
|
-
exit 1
|
|
136
|
-
else
|
|
137
|
-
echo "Firewall verification passed - able to reach https://api.github.com as expected"
|
|
138
|
-
fi
|
|
139
|
-
|
|
140
|
-
# Verify Open Router API access
|
|
141
|
-
if ! curl --connect-timeout 5 https://api.openrouter.com/health >/dev/null 2>&1; then
|
|
142
|
-
echo "ERROR: Firewall verification failed - unable to reach https://api.openrouter.com"
|
|
143
|
-
exit 1
|
|
144
|
-
else
|
|
145
|
-
echo "Firewall verification passed - able to reach https://api.openrouter.com as expected"
|
|
146
|
-
fi
|
|
147
|
-
|
|
148
|
-
#!/bin/bash
|
|
149
|
-
|
|
150
|
-
# Allow traffic to Open Router API
|
|
151
|
-
iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT
|