跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

提交记录
修改README.md+38 −3看文件
@@ -141,11 +141,46 @@ pip install pandas numpy
141141
142142### Per-user runtime: `~/.agent-vm/runtime.sh`
143143
144删除:Create this file to run commands inside every VM on each start. Runs before the per-project runtime script:
144新增:Create this file to run commands inside every VM on each start. It runs **before** the per-project `.agent-vm.runtime.sh` script.
145新增:
146新增:Use it for anything that should be available in all your VMs: SSH keys, git config, GitHub CLI auth, Claude Code skills, MCP servers, etc.
147新增:
148新增:**Getting started:**
149新增:
150新增:```bash
151新增:cp runtime.example.sh ~/.agent-vm/runtime.sh
152新增:# Edit with your own values
153新增:```
154新增:
155新增:See [`runtime.example.sh`](runtime.example.sh) for a fully commented template covering:
156新增:- SSH key injection for GitHub (base64-encoded private key)
157新增:- Git identity and SSH-forced remotes (`url.insteadOf`)
158新增:- GitHub CLI authentication (`gh auth login --with-token`)
159新增:- Claude Code skills installation (global and per-project)
160新增:- MCP server registration (`claude mcp add --scope user`)
161新增:- Status line configuration in `~/.claude/settings.json`
162新增:
163新增:**Encoding your SSH key:**
164新增:
165新增:```bash
166新增:cat ~/.ssh/id_ed25519 | base64
167新增:```
168新增:
169新增:Paste the output into your `runtime.sh` — the script decodes it at boot and sets up `~/.ssh` with proper permissions.
170新增:
171新增:**Global vs per-project runtime:**
172新增:
173新增:| File | Scope | Runs when |
174新增:|------|-------|-----------|
175新增:| `~/.agent-vm/runtime.sh` | All VMs | Every VM start, first |
176新增:| `.agent-vm.runtime.sh` | Current project only | Every VM start, after global |
177新增:
178新增:**Important:** Always launch `agent-vm` from a path without spaces. macOS iCloud paths contain spaces (`~/Library/Mobile Documents/...`), which can break mounts. Create a symlink instead:
145179
146180```bash
147删除:# ~/.agent-vm/runtime.sh
148删除:export MY_API_KEY="..."
181新增:ln -s ~/Library/Mobile\ Documents/com~apple~CloudDocs/Dev ~/Dev
182新增:cd ~/Dev/your-project
183新增:agent-vm claude
149184```
150185
151186### Per-project: `.agent-vm.runtime.sh`
新增runtime.example.sh+104 −0看文件
@@ -0,0 +1,104 @@
1新增:#!/bin/bash
2新增:# =============================================================================
3新增:# runtime.example.sh — Template for ~/.agent-vm/runtime.sh
4新增:# =============================================================================
5新增:#
6新增:# This file runs inside every agent-vm on each start, before the per-project
7新增:# .agent-vm.runtime.sh script. Copy it to ~/.agent-vm/runtime.sh and uncomment
8新增:# the sections you need.
9新增:#
10新增:# To get started:
11新增:# cp runtime.example.sh ~/.agent-vm/runtime.sh
12新增:# # Edit the file with your own values
13新增:# chmod +x ~/.agent-vm/runtime.sh
14新增:
15新增:
16新增:# =============================================================================
17新增:# 1. SSH authentication for GitHub
18新增:# =============================================================================
19新增:#
20新增:# Embed your SSH private key (base64-encoded) so the VM can push/pull over SSH.
21新增:#
22新增:# To encode your key:
23新增:# cat ~/.ssh/id_ed25519 | base64
24新增:#
25新增:# Paste the output below:
26新增:
27新增:# SSH_KEY_B64="<your-base64-encoded-private-key>"
28新增:# mkdir -p ~/.ssh && chmod 700 ~/.ssh
29新增:# echo "$SSH_KEY_B64" | base64 -d > ~/.ssh/id_ed25519
30新增:# chmod 600 ~/.ssh/id_ed25519
31新增:# ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null
32新增:
33新增:
34新增:# =============================================================================
35新增:# 2. Git configuration
36新增:# =============================================================================
37新增:
38新增:# git config --global user.name "Your Name"
39新增:# git config --global user.email "[email protected]"
40新增:
41新增:# Force SSH for all GitHub remotes (avoids HTTPS credential prompts)
42新增:# git config --global url."[email protected]:".insteadOf "https://github.com/"
43新增:
44新增:
45新增:# =============================================================================
46新增:# 3. GitHub CLI authentication
47新增:# =============================================================================
48新增:#
49新增:# Required for creating PRs, commenting on issues, etc. from inside the VM.
50新增:#
51新增:# To create a token: https://github.com/settings/tokens
52新增:# Scopes needed: repo, read:org
53新增:#
54新增:# echo "<your-github-pat>" | gh auth login --with-token
55新增:
56新增:
57新增:# =============================================================================
58新增:# 4. Claude Code skills
59新增:# =============================================================================
60新增:#
61新增:# Clone shared skills into the global skills directory.
62新增:# These will be available in all projects.
63新增:
64新增:# mkdir -p ~/.claude/skills
65新增:# git clone [email protected]:your-org/claude-skills.git ~/.claude/skills/your-org-skills
66新增:
67新增:# You can also install skills into the current project's directory.
68新增:# These will only be available when working in that project.
69新增:
70新增:# PROJECT_DIR="$(pwd)"
71新增:# mkdir -p "$PROJECT_DIR/.claude/skills"
72新增:# git clone [email protected]:your-org/project-skills.git "$PROJECT_DIR/.claude/skills/project-skills"
73新增:
74新增:
75新增:# =============================================================================
76新增:# 5. MCP servers
77新增:# =============================================================================
78新增:#
79新增:# Add MCP servers available to Claude Code in all projects (--scope user).
80新增:#
81新增:# claude mcp add --scope user my-mcp-server npx -y my-mcp-server@latest
82新增:
83新增:
84新增:# =============================================================================
85新增:# 6. Claude Code status line
86新增:# =============================================================================
87新增:#
88新增:# Install a custom status line command in ~/.claude/settings.json.
89新增:# The command output is displayed at the bottom of the Claude Code interface.
90新增:#
91新增:# For example, to show the current git branch:
92新增:#
93新增:# cat > /tmp/statusline-patch.json << 'PATCH'
94新增:# {"statusLine": {"command": "git branch --show-current 2>/dev/null || echo ''"}}
95新增:# PATCH
96新增:#
97新增:# if [ -f ~/.claude/settings.json ]; then
98新增:# jq -s '.[0] * .[1]' ~/.claude/settings.json /tmp/statusline-patch.json > /tmp/settings-merged.json
99新增:# mv /tmp/settings-merged.json ~/.claude/settings.json
100新增:# else
101新增:# mkdir -p ~/.claude
102新增:# cp /tmp/statusline-patch.json ~/.claude/settings.json
103新增:# fi
104新增:# rm -f /tmp/statusline-patch.json