@alanbem/dclaude 0.0.0-dev
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/LICENSE +21 -0
- package/README.md +319 -0
- package/dclaude +2031 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 alanbem
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# dclaude
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://hub.docker.com/r/alanbem/dclaude)
|
|
5
|
+
[](https://www.npmjs.com/package/@alanbem/dclaude)
|
|
6
|
+
|
|
7
|
+
Run Claude Code CLI in Docker - no local installation needed. Full MCP support, persistent sessions, and seamless host integration.
|
|
8
|
+
|
|
9
|
+
## Why dclaude?
|
|
10
|
+
|
|
11
|
+
**Claude Code CLI is powerful, but installing it locally means:**
|
|
12
|
+
- Node.js version conflicts
|
|
13
|
+
- Global npm packages cluttering your system
|
|
14
|
+
- MCP servers needing specific Python/Node setups
|
|
15
|
+
- Different behavior across machines
|
|
16
|
+
|
|
17
|
+
**dclaude solves this by running Claude in a container that feels native:**
|
|
18
|
+
- Your files appear at the same paths (no `/app` or `/workspace` confusion)
|
|
19
|
+
- Docker commands work (socket is mounted)
|
|
20
|
+
- SSH keys and git config just work
|
|
21
|
+
- Homebrew included - easy migration from local macOS setup
|
|
22
|
+
- Works on Linux, macOS, and Windows
|
|
23
|
+
- **Safer `--dangerously-skip-permissions`** - container isolation means Claude can only access your project, not your whole system
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### Install via NPM (Recommended)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g @alanbem/dclaude
|
|
31
|
+
dclaude
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Install from source
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Clone and install
|
|
38
|
+
git clone https://github.com/alanbem/dclaude.git ~/tools/dclaude
|
|
39
|
+
sudo ln -s ~/tools/dclaude/dclaude /usr/local/bin/dclaude
|
|
40
|
+
|
|
41
|
+
# Run (pulls image from Docker Hub automatically)
|
|
42
|
+
dclaude
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Basic Usage
|
|
46
|
+
|
|
47
|
+
**dclaude passes all arguments directly to Claude CLI** - use it exactly as you would use `claude`:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Start Claude interactively
|
|
51
|
+
dclaude
|
|
52
|
+
|
|
53
|
+
# Run with a prompt
|
|
54
|
+
dclaude "fix the bug in main.js"
|
|
55
|
+
|
|
56
|
+
# All Claude CLI flags work
|
|
57
|
+
dclaude --version
|
|
58
|
+
dclaude -p "explain this code"
|
|
59
|
+
dclaude --model sonnet
|
|
60
|
+
dclaude --resume
|
|
61
|
+
|
|
62
|
+
# Execute commands in the container
|
|
63
|
+
dclaude exec npm install
|
|
64
|
+
dclaude exec brew install ripgrep
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## How It Works
|
|
68
|
+
|
|
69
|
+
dclaude creates a container that mirrors your host environment:
|
|
70
|
+
|
|
71
|
+
1. **Path Mirroring**: Your current directory is mounted at the *same path*
|
|
72
|
+
- On host: `/Users/alice/projects/myapp`
|
|
73
|
+
- In container: `/Users/alice/projects/myapp`
|
|
74
|
+
- All your file paths just work
|
|
75
|
+
|
|
76
|
+
2. **Docker Access**: The Docker socket is mounted, so Claude can build images, run containers, and manage compose stacks
|
|
77
|
+
|
|
78
|
+
3. **Persistent Sessions**: Containers persist by default - installed tools and configuration survive across sessions
|
|
79
|
+
|
|
80
|
+
4. **Smart Networking**: Auto-detects whether host networking is available for localhost access
|
|
81
|
+
|
|
82
|
+
## Persistent vs Ephemeral Containers
|
|
83
|
+
|
|
84
|
+
**Persistent (default)** - Container survives between sessions:
|
|
85
|
+
```bash
|
|
86
|
+
dclaude # Uses existing container or creates new one
|
|
87
|
+
dclaude exec brew install fd # Install tools - they persist
|
|
88
|
+
dclaude exec # Open a shell in the container
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Ephemeral** - Fresh container each time:
|
|
92
|
+
```bash
|
|
93
|
+
DCLAUDE_RM=true dclaude # Container removed after exit
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Use persistent for development (faster startup, tools persist). Use ephemeral for CI/CD or when you want a clean slate.
|
|
97
|
+
|
|
98
|
+
## Features
|
|
99
|
+
|
|
100
|
+
### SSH Authentication
|
|
101
|
+
|
|
102
|
+
dclaude automatically handles SSH for git operations:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Auto-detect best method (default)
|
|
106
|
+
dclaude
|
|
107
|
+
|
|
108
|
+
# Force SSH agent forwarding (most secure)
|
|
109
|
+
DCLAUDE_GIT_AUTH=agent-forwarding dclaude
|
|
110
|
+
|
|
111
|
+
# Mount ~/.ssh directory (most compatible)
|
|
112
|
+
DCLAUDE_GIT_AUTH=key-mount dclaude
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Make sure your SSH key is loaded: `ssh-add -l`
|
|
116
|
+
|
|
117
|
+
### Homebrew Support
|
|
118
|
+
|
|
119
|
+
Install tools that persist across sessions:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
dclaude exec brew install ripgrep fd bat jq
|
|
123
|
+
dclaude exec brew install node@20 python@3.12
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### GitHub CLI
|
|
127
|
+
|
|
128
|
+
Authenticate once, use everywhere:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
dclaude gh # Interactive GitHub login
|
|
132
|
+
dclaude exec gh pr list # Use gh commands
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### SSH Server for IDEs
|
|
136
|
+
|
|
137
|
+
Connect JetBrains Gateway, VS Code Remote, or any SSH client:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
dclaude ssh # Start SSH server, shows port
|
|
141
|
+
# Connect: ssh claude@localhost -p <port>
|
|
142
|
+
# Password: claude
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Chrome DevTools Integration
|
|
146
|
+
|
|
147
|
+
Control Chrome via MCP for browser automation:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
dclaude chrome # Launch Chrome with DevTools
|
|
151
|
+
dclaude # Claude can now interact with the browser
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Config Mounting
|
|
155
|
+
|
|
156
|
+
Mount your host configs for seamless tool integration:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
DCLAUDE_MOUNT_CONFIGS=true dclaude
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
This mounts (read-only): `.docker/`, `.gitconfig`, `.config/gh/`, `.npmrc`
|
|
163
|
+
|
|
164
|
+
### System Context
|
|
165
|
+
|
|
166
|
+
dclaude automatically tells Claude about its container environment so it can give better suggestions:
|
|
167
|
+
|
|
168
|
+
- **Network mode** - Whether `localhost` works or needs `host.docker.internal`
|
|
169
|
+
- **Docker access** - Whether Docker commands are available
|
|
170
|
+
- **SSH auth method** - How git authentication is configured
|
|
171
|
+
- **Path mirroring** - That file paths match the host
|
|
172
|
+
|
|
173
|
+
This helps Claude understand its environment without you explaining it. Disable if needed:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
DCLAUDE_SYSTEM_CONTEXT=false dclaude
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Environment Variables
|
|
180
|
+
|
|
181
|
+
| Variable | Default | Description |
|
|
182
|
+
|----------|---------|-------------|
|
|
183
|
+
| `DCLAUDE_RM` | `false` | Remove container on exit (ephemeral mode) |
|
|
184
|
+
| `DCLAUDE_TAG` | `latest` | Docker image tag |
|
|
185
|
+
| `DCLAUDE_NETWORK` | `auto` | Network mode: `auto`, `host`, `bridge` |
|
|
186
|
+
| `DCLAUDE_GIT_AUTH` | `auto` | SSH auth: `auto`, `agent-forwarding`, `key-mount`, `none` |
|
|
187
|
+
| `DCLAUDE_MOUNT_CONFIGS` | `false` | Mount host config files |
|
|
188
|
+
| `DCLAUDE_DEBUG` | `false` | Enable debug output |
|
|
189
|
+
| `DCLAUDE_QUIET` | `false` | Suppress info messages |
|
|
190
|
+
| `DCLAUDE_NO_UPDATE` | `false` | Skip image update check |
|
|
191
|
+
| `DCLAUDE_SYSTEM_CONTEXT` | `true` | Inform Claude about container environment |
|
|
192
|
+
|
|
193
|
+
## Networking
|
|
194
|
+
|
|
195
|
+
dclaude auto-detects the best networking mode:
|
|
196
|
+
|
|
197
|
+
**Host mode** (when available):
|
|
198
|
+
- Direct `localhost` access to host services
|
|
199
|
+
- Works on: Linux, macOS with OrbStack/Docker Desktop beta, Windows with Docker Desktop beta
|
|
200
|
+
|
|
201
|
+
**Bridge mode** (fallback):
|
|
202
|
+
- Use `host.docker.internal` instead of `localhost`
|
|
203
|
+
- Standard Docker networking
|
|
204
|
+
|
|
205
|
+
Force a specific mode:
|
|
206
|
+
```bash
|
|
207
|
+
DCLAUDE_NETWORK=host dclaude
|
|
208
|
+
DCLAUDE_NETWORK=bridge dclaude
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Platform Support
|
|
212
|
+
|
|
213
|
+
| Platform | Status | Notes |
|
|
214
|
+
|----------|--------|-------|
|
|
215
|
+
| Linux | Full support | Host networking available |
|
|
216
|
+
| macOS | Full support | Host networking with OrbStack or Docker Desktop beta |
|
|
217
|
+
| Windows | Full support | WSL2/Docker Desktop, host networking with beta features |
|
|
218
|
+
|
|
219
|
+
## What's Included
|
|
220
|
+
|
|
221
|
+
The container includes:
|
|
222
|
+
- **Ubuntu 24.04 LTS** base
|
|
223
|
+
- **Claude Code CLI** (latest)
|
|
224
|
+
- **Node.js 20+**, **Python 3** with pip
|
|
225
|
+
- **Homebrew/Linuxbrew** for package management
|
|
226
|
+
- **Docker CLI** and **Docker Compose**
|
|
227
|
+
- **Git**, **GitHub CLI** (`gh`), common dev tools
|
|
228
|
+
- **tmux** for session management
|
|
229
|
+
- **SSH server** for IDE integration
|
|
230
|
+
|
|
231
|
+
## Troubleshooting
|
|
232
|
+
|
|
233
|
+
**Docker not running?**
|
|
234
|
+
```bash
|
|
235
|
+
# Make sure Docker Desktop is running, or on Linux:
|
|
236
|
+
sudo systemctl start docker
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Permission denied on Docker socket?**
|
|
240
|
+
```bash
|
|
241
|
+
# Linux: Add yourself to the docker group
|
|
242
|
+
sudo usermod -aG docker $USER
|
|
243
|
+
# Then logout and login
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Can't access localhost services?**
|
|
247
|
+
```bash
|
|
248
|
+
# Check what network mode is being used
|
|
249
|
+
DCLAUDE_DEBUG=true dclaude
|
|
250
|
+
|
|
251
|
+
# Try forcing host mode
|
|
252
|
+
DCLAUDE_NETWORK=host dclaude
|
|
253
|
+
|
|
254
|
+
# Or use host.docker.internal in bridge mode
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**SSH keys not working?**
|
|
258
|
+
```bash
|
|
259
|
+
# Make sure your key is loaded
|
|
260
|
+
ssh-add -l
|
|
261
|
+
|
|
262
|
+
# If empty, load your key
|
|
263
|
+
ssh-add ~/.ssh/id_ed25519
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Installed tools disappearing?**
|
|
267
|
+
```bash
|
|
268
|
+
# Make sure you're using persistent mode (default)
|
|
269
|
+
# If you set DCLAUDE_RM=true, tools won't persist
|
|
270
|
+
dclaude exec brew install <tool> # This persists
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Project Structure
|
|
274
|
+
|
|
275
|
+
```text
|
|
276
|
+
.
|
|
277
|
+
├── dclaude # Launcher script (runs on host)
|
|
278
|
+
├── docker/
|
|
279
|
+
│ ├── Dockerfile # Container image definition
|
|
280
|
+
│ ├── README.md # Docker Hub documentation
|
|
281
|
+
│ ├── usr/local/bin/
|
|
282
|
+
│ │ └── docker-entrypoint.sh
|
|
283
|
+
│ └── home/claude/
|
|
284
|
+
│ └── .tmux.conf
|
|
285
|
+
├── .github/workflows/ # CI/CD (lint, scan, publish)
|
|
286
|
+
├── completions/ # Shell completions (bash, zsh)
|
|
287
|
+
├── Makefile # Development commands
|
|
288
|
+
└── package.json # NPM package config
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Development
|
|
292
|
+
|
|
293
|
+
Want to modify dclaude? Build and test locally:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
# Build local image
|
|
297
|
+
make build # Creates alanbem/dclaude:local
|
|
298
|
+
|
|
299
|
+
# Test
|
|
300
|
+
make test
|
|
301
|
+
|
|
302
|
+
# Use your local image
|
|
303
|
+
DCLAUDE_TAG=local dclaude
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Contributing
|
|
307
|
+
|
|
308
|
+
Contributions welcome! Submit a Pull Request.
|
|
309
|
+
|
|
310
|
+
## License
|
|
311
|
+
|
|
312
|
+
MIT - see [LICENSE](LICENSE)
|
|
313
|
+
|
|
314
|
+
## Links
|
|
315
|
+
|
|
316
|
+
- [Docker Hub](https://hub.docker.com/r/alanbem/dclaude)
|
|
317
|
+
- [npm](https://www.npmjs.com/package/@alanbem/dclaude)
|
|
318
|
+
- [Issues](https://github.com/alanbem/dclaude/issues)
|
|
319
|
+
- [Discussions](https://github.com/alanbem/dclaude/discussions)
|