vagrant-claude-sandbox 0.1.0
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.
- checksums.yaml +7 -0
- data/LICENSE +19 -0
- data/README.md +87 -0
- data/lib/vagrant-claude-sandbox/config.rb +174 -0
- data/lib/vagrant-claude-sandbox/plugin.rb +13 -0
- data/lib/vagrant-claude-sandbox/version.rb +5 -0
- data/lib/vagrant-claude-sandbox.rb +11 -0
- metadata +79 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 0b41524c843f1c62cda68ca45015a524bfbdade5bd81d5fba9ca1b9d700cae84
|
|
4
|
+
data.tar.gz: dea52ec2514c2f0fdafa87374b5ff25b4b82381d2673d96968c72c6ee0e0b5ef
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5df48ce7440d827876072a884ae460e4b4fdf25e88b0455799fa3ce1ab7272c30a1b2ad6f2055b36dee52acbc328c74e4dc73a822b2e2af0066b9dec453c0265
|
|
7
|
+
data.tar.gz: b6af4d17d0f8260223250ebbbf8ee5bd38dcf6f84bd929cbbdf3e0a72f6275d09fb97619a0ca9dfa94cf0c99ef38c822917fc9d17b51f86cf27425d6d78b1875
|
data/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Vagrant Claude Sandbox
|
|
2
|
+
|
|
3
|
+
A Vagrant plugin for running Claude Code in an isolated VM sandbox.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Ubuntu 24.04 LTS with Docker, Node.js, git pre-installed
|
|
8
|
+
- Automatic Claude Code CLI installation
|
|
9
|
+
- Synced workspace folder and Claude config
|
|
10
|
+
- **Full Claude plugins and skills support** - automatically loads your installed plugins and skills with fixed paths
|
|
11
|
+
- `claude-yolo` wrapper (runs Claude with `--dangerously-skip-permissions`)
|
|
12
|
+
- Customizable VM resources
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- [Vagrant](https://www.vagrantup.com/downloads) >= 2.2.0
|
|
17
|
+
- [VirtualBox](https://www.virtualbox.org/wiki/Downloads) >= 6.1
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
vagrant plugin install vagrant-claude-sandbox
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Create a `Vagrantfile`:
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
Vagrant.configure("2") do |config|
|
|
31
|
+
config.claude_sandbox.apply_to!(config)
|
|
32
|
+
end
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Start the VM:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
vagrant up
|
|
39
|
+
vagrant ssh
|
|
40
|
+
claude-yolo # Inside VM
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Custom Configuration
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
Vagrant.configure("2") do |config|
|
|
47
|
+
config.claude_sandbox.apply_to!(config) do |sandbox|
|
|
48
|
+
sandbox.memory = 8192
|
|
49
|
+
sandbox.cpus = 4
|
|
50
|
+
sandbox.additional_packages = ["vim", "htop"]
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Options
|
|
56
|
+
|
|
57
|
+
| Option | Default | Description |
|
|
58
|
+
|--------|---------|-------------|
|
|
59
|
+
| `memory` | `4096` | RAM in MB |
|
|
60
|
+
| `cpus` | `2` | Number of CPUs |
|
|
61
|
+
| `box` | `"bento/ubuntu-24.04"` | Vagrant box |
|
|
62
|
+
| `workspace_path` | `"/agent-workspace"` | Workspace path in VM |
|
|
63
|
+
| `claude_config_path` | `"~/.claude/"` | Host Claude config path |
|
|
64
|
+
| `skip_claude_cli_install` | `false` | Skip Claude CLI installation |
|
|
65
|
+
| `additional_packages` | `[]` | Extra apt packages |
|
|
66
|
+
|
|
67
|
+
## Plugin and Skills Support
|
|
68
|
+
|
|
69
|
+
This plugin automatically copies your `~/.claude/` directory to the VM and fixes absolute paths in plugin configuration files. This means:
|
|
70
|
+
|
|
71
|
+
- All your installed Claude plugins will work in the VM
|
|
72
|
+
- All your custom skills will be available
|
|
73
|
+
- Plugin paths are automatically updated from host paths to VM paths
|
|
74
|
+
|
|
75
|
+
The plugin configuration files that are updated:
|
|
76
|
+
- `~/.claude/plugins/installed_plugins.json`
|
|
77
|
+
- `~/.claude/plugins/known_marketplaces.json`
|
|
78
|
+
|
|
79
|
+
This ensures that plugins and skills that reference local file paths will work correctly inside the VM environment.
|
|
80
|
+
|
|
81
|
+
## Credits
|
|
82
|
+
|
|
83
|
+
Original idea by [@emilburzo](https://github.com/emilburzo) - [blog post](https://blog.emilburzo.com/2026/01/running-claude-code-dangerously-safely/)
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT License - see [LICENSE](LICENSE)
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module ClaudeSandbox
|
|
3
|
+
class Config < Vagrant.plugin("2", :config)
|
|
4
|
+
attr_accessor :memory
|
|
5
|
+
attr_accessor :cpus
|
|
6
|
+
attr_accessor :box
|
|
7
|
+
attr_accessor :workspace_path
|
|
8
|
+
attr_accessor :claude_config_path
|
|
9
|
+
attr_accessor :skip_claude_cli_install
|
|
10
|
+
attr_accessor :additional_packages
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@memory = UNSET_VALUE
|
|
14
|
+
@cpus = UNSET_VALUE
|
|
15
|
+
@box = UNSET_VALUE
|
|
16
|
+
@workspace_path = UNSET_VALUE
|
|
17
|
+
@claude_config_path = UNSET_VALUE
|
|
18
|
+
@skip_claude_cli_install = UNSET_VALUE
|
|
19
|
+
@additional_packages = UNSET_VALUE
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def finalize!
|
|
23
|
+
@memory = 4096 if @memory == UNSET_VALUE
|
|
24
|
+
@cpus = 2 if @cpus == UNSET_VALUE
|
|
25
|
+
@box = "bento/ubuntu-24.04" if @box == UNSET_VALUE
|
|
26
|
+
@workspace_path = "/agent-workspace" if @workspace_path == UNSET_VALUE
|
|
27
|
+
@claude_config_path = File.expand_path("~/.claude/") if @claude_config_path == UNSET_VALUE
|
|
28
|
+
@skip_claude_cli_install = false if @skip_claude_cli_install == UNSET_VALUE
|
|
29
|
+
@additional_packages = [] if @additional_packages == UNSET_VALUE
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def validate(machine)
|
|
33
|
+
errors = _detected_errors
|
|
34
|
+
|
|
35
|
+
if @memory && !@memory.is_a?(Integer)
|
|
36
|
+
errors << "memory must be an integer"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
if @cpus && !@cpus.is_a?(Integer)
|
|
40
|
+
errors << "cpus must be an integer"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if @additional_packages && !@additional_packages.is_a?(Array)
|
|
44
|
+
errors << "additional_packages must be an array"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
{ "Claude Sandbox" => errors }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Apply all Claude Sandbox configuration to the Vagrant config
|
|
51
|
+
def apply_to!(root_config)
|
|
52
|
+
# Ensure values are finalized before use
|
|
53
|
+
finalize!
|
|
54
|
+
|
|
55
|
+
# Set the box
|
|
56
|
+
root_config.vm.box = @box
|
|
57
|
+
|
|
58
|
+
# Configure synced folder for workspace
|
|
59
|
+
root_config.vm.synced_folder ".", @workspace_path,
|
|
60
|
+
create: true,
|
|
61
|
+
owner: "vagrant",
|
|
62
|
+
group: "vagrant"
|
|
63
|
+
|
|
64
|
+
# Copy Claude config if it exists (using file provisioner to fix plugin paths)
|
|
65
|
+
if File.directory?(@claude_config_path)
|
|
66
|
+
root_config.vm.provision "file",
|
|
67
|
+
source: @claude_config_path,
|
|
68
|
+
destination: "/tmp/claude-config"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Configure provider (VirtualBox)
|
|
72
|
+
root_config.vm.provider "virtualbox" do |vb|
|
|
73
|
+
vb.memory = @memory
|
|
74
|
+
vb.cpus = @cpus
|
|
75
|
+
vb.customize ["modifyvm", :id, "--audio", "none"]
|
|
76
|
+
vb.customize ["modifyvm", :id, "--usb", "off"]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Provision the VM
|
|
80
|
+
unless @skip_claude_cli_install
|
|
81
|
+
root_config.vm.provision "shell",
|
|
82
|
+
inline: generate_provision_script,
|
|
83
|
+
env: {"HOST_CLAUDE_PATH" => @claude_config_path}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Configure SSH to auto-cd to workspace
|
|
87
|
+
root_config.ssh.extra_args = ["-t", "cd #{@workspace_path}; bash --login"]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
private
|
|
91
|
+
|
|
92
|
+
def generate_provision_script
|
|
93
|
+
additional_packages = @additional_packages.join(" ")
|
|
94
|
+
|
|
95
|
+
script = <<-SHELL
|
|
96
|
+
set -e
|
|
97
|
+
|
|
98
|
+
echo "Updating package lists..."
|
|
99
|
+
apt-get update
|
|
100
|
+
|
|
101
|
+
echo "Installing base packages..."
|
|
102
|
+
apt-get install -y \
|
|
103
|
+
apt-transport-https \
|
|
104
|
+
ca-certificates \
|
|
105
|
+
curl \
|
|
106
|
+
gnupg \
|
|
107
|
+
lsb-release \
|
|
108
|
+
git \
|
|
109
|
+
unzip \
|
|
110
|
+
#{additional_packages}
|
|
111
|
+
|
|
112
|
+
# Install Docker
|
|
113
|
+
if ! command -v docker &> /dev/null; then
|
|
114
|
+
echo "Installing Docker..."
|
|
115
|
+
curl -fsSL https://get.docker.com -o get-docker.sh
|
|
116
|
+
sh get-docker.sh
|
|
117
|
+
usermod -aG docker vagrant
|
|
118
|
+
rm get-docker.sh
|
|
119
|
+
else
|
|
120
|
+
echo "Docker already installed"
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# Install Node.js and npm
|
|
124
|
+
if ! command -v node &> /dev/null; then
|
|
125
|
+
echo "Installing Node.js..."
|
|
126
|
+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
|
127
|
+
apt-get install -y nodejs
|
|
128
|
+
else
|
|
129
|
+
echo "Node.js already installed"
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Install Claude Code CLI
|
|
133
|
+
if ! command -v claude &> /dev/null; then
|
|
134
|
+
echo "Installing Claude Code CLI..."
|
|
135
|
+
npm install -g @anthropic-ai/claude-code --no-audit
|
|
136
|
+
else
|
|
137
|
+
echo "Claude Code CLI already installed"
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
# Move Claude configuration from /tmp and fix plugin paths
|
|
141
|
+
if [ -d "/tmp/claude-config" ]; then
|
|
142
|
+
echo "Setting up Claude configuration with plugins and skills..."
|
|
143
|
+
rm -rf /home/vagrant/.claude
|
|
144
|
+
mv /tmp/claude-config /home/vagrant/.claude
|
|
145
|
+
|
|
146
|
+
# Fix absolute paths in plugin configuration files to point to VM paths
|
|
147
|
+
if [ -f "/home/vagrant/.claude/plugins/installed_plugins.json" ]; then
|
|
148
|
+
sed -i "s|${HOST_CLAUDE_PATH}|/home/vagrant/.claude|g" /home/vagrant/.claude/plugins/installed_plugins.json
|
|
149
|
+
fi
|
|
150
|
+
if [ -f "/home/vagrant/.claude/plugins/known_marketplaces.json" ]; then
|
|
151
|
+
sed -i "s|${HOST_CLAUDE_PATH}|/home/vagrant/.claude|g" /home/vagrant/.claude/plugins/known_marketplaces.json
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
chown -R vagrant:vagrant /home/vagrant/.claude
|
|
155
|
+
echo "Claude plugins and skills loaded successfully!"
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
# Create claude-yolo wrapper
|
|
159
|
+
echo "Creating claude-yolo command..."
|
|
160
|
+
cat > /usr/local/bin/claude-yolo << 'EOF'
|
|
161
|
+
#!/bin/bash
|
|
162
|
+
claude --dangerously-skip-permissions "$@"
|
|
163
|
+
EOF
|
|
164
|
+
chmod +x /usr/local/bin/claude-yolo
|
|
165
|
+
|
|
166
|
+
echo "Claude sandbox environment setup complete!"
|
|
167
|
+
echo "You can now run 'claude-yolo' to start Claude Code with permissions disabled"
|
|
168
|
+
SHELL
|
|
169
|
+
|
|
170
|
+
script
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module ClaudeSandbox
|
|
3
|
+
class Plugin < Vagrant.plugin("2")
|
|
4
|
+
name "Claude Sandbox"
|
|
5
|
+
description "Provides a pre-configured sandbox environment for running Claude Code in an isolated VM"
|
|
6
|
+
|
|
7
|
+
config "claude_sandbox" do
|
|
8
|
+
require_relative "config"
|
|
9
|
+
Config
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "vagrant-claude-sandbox/version"
|
|
2
|
+
require "vagrant-claude-sandbox/plugin"
|
|
3
|
+
|
|
4
|
+
module VagrantPlugins
|
|
5
|
+
module ClaudeSandbox
|
|
6
|
+
# This returns the path to the source of this plugin.
|
|
7
|
+
def self.source_root
|
|
8
|
+
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: vagrant-claude-sandbox
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Bero
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-01-22 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '13.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '13.0'
|
|
41
|
+
description: Provides a pre-configured sandbox environment for running Claude Code
|
|
42
|
+
in an isolated VM with full plugin and skills support
|
|
43
|
+
email:
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- LICENSE
|
|
49
|
+
- README.md
|
|
50
|
+
- lib/vagrant-claude-sandbox.rb
|
|
51
|
+
- lib/vagrant-claude-sandbox/config.rb
|
|
52
|
+
- lib/vagrant-claude-sandbox/plugin.rb
|
|
53
|
+
- lib/vagrant-claude-sandbox/version.rb
|
|
54
|
+
homepage: https://github.com/bgrgicak/vagrant-claude-sandbox
|
|
55
|
+
licenses:
|
|
56
|
+
- MIT
|
|
57
|
+
metadata:
|
|
58
|
+
source_code_uri: https://github.com/bgrgicak/vagrant-claude-sandbox
|
|
59
|
+
bug_tracker_uri: https://github.com/bgrgicak/vagrant-claude-sandbox/issues
|
|
60
|
+
post_install_message:
|
|
61
|
+
rdoc_options: []
|
|
62
|
+
require_paths:
|
|
63
|
+
- lib
|
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 2.6.0
|
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
- - ">="
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '0'
|
|
74
|
+
requirements: []
|
|
75
|
+
rubygems_version: 3.0.3.1
|
|
76
|
+
signing_key:
|
|
77
|
+
specification_version: 4
|
|
78
|
+
summary: Vagrant plugin for Claude Code sandbox environment
|
|
79
|
+
test_files: []
|