浏览文件
runtime.example.sh
96 行 · 3.8 KB历史下载| 1 | |
| 2 | # ============================================================================= |
| 3 | # runtime.example.sh: template for ~/.agent-vm/runtime.sh |
| 4 | # ============================================================================= |
| 5 | # |
| 6 | # This file runs inside the VM on every agent-vm command that enters one, |
| 7 | # before the per-project .agent-vm.runtime.sh script, so keep it safe to run |
| 8 | # again. Copy it to ~/.agent-vm/runtime.sh and uncomment the sections you |
| 9 | # need. |
| 10 | # |
| 11 | # To get started: |
| 12 | # cp runtime.example.sh ~/.agent-vm/runtime.sh |
| 13 | # # Edit the file with your own values |
| 14 | # |
| 15 | # It is piped into the interpreter its first line names (bash, sh or zsh), so |
| 16 | # it needs no execute bit. It runs in the project directory. |
| 17 | # |
| 18 | # Keep private keys out of this file: it runs in every VM, where the agent can |
| 19 | # read whatever it sets up. For GitHub, a fine-grained GH_TOKEN in |
| 20 | # ~/.agent-vm/env is revocable in one click; an SSH key is not. |
| 21 | |
| 22 | |
| 23 | # ============================================================================= |
| 24 | # 1. Git configuration |
| 25 | # ============================================================================= |
| 26 | # |
| 27 | # The identity can also come from GIT_AUTHOR_* / GIT_COMMITTER_* in |
| 28 | # ~/.agent-vm/env: https://www.agent-vm.org/#letting-the-agent-commit |
| 29 | |
| 30 | # git config --global user.name "Your Name" |
| 31 | # git config --global user.email "[email protected]" |
| 32 | |
| 33 | |
| 34 | # ============================================================================= |
| 35 | # 2. Pushing over HTTPS with GH_TOKEN |
| 36 | # ============================================================================= |
| 37 | # |
| 38 | # `gh` reads GH_TOKEN from ~/.agent-vm/env on its own. Plain `git push` over |
| 39 | # HTTPS needs a credential helper, which `gh` knows how to install. |
| 40 | # |
| 41 | # gh auth setup-git |
| 42 | |
| 43 | |
| 44 | # ============================================================================= |
| 45 | # 3. Claude Code skills |
| 46 | # ============================================================================= |
| 47 | # |
| 48 | # Clone shared skills into the global skills directory, once per VM (this |
| 49 | # script runs again on every command), and update them after that. |
| 50 | # These will be available in all projects. |
| 51 | |
| 52 | # mkdir -p ~/.claude/skills |
| 53 | # if [ -d ~/.claude/skills/your-org-skills ]; then |
| 54 | # git -C ~/.claude/skills/your-org-skills pull --ff-only --quiet |
| 55 | # else |
| 56 | # git clone https://github.com/your-org/claude-skills.git ~/.claude/skills/your-org-skills |
| 57 | # fi |
| 58 | |
| 59 | # Skills for the current project only belong in that project's |
| 60 | # .agent-vm.runtime.sh: this file runs in every project. There, the same |
| 61 | # pattern, in "$PWD/.claude/skills/project-skills" (which fails under |
| 62 | # --readonly, where the project cannot be written). |
| 63 | |
| 64 | |
| 65 | # ============================================================================= |
| 66 | # 4. MCP servers |
| 67 | # ============================================================================= |
| 68 | # |
| 69 | # Add MCP servers available to Claude Code in all projects (--scope user). |
| 70 | # `add` fails on a name that exists, so only when it is not there yet. |
| 71 | # |
| 72 | # claude mcp get my-mcp-server >/dev/null 2>&1 \ |
| 73 | # || claude mcp add --scope user my-mcp-server npx -y my-mcp-server@latest |
| 74 | |
| 75 | |
| 76 | # ============================================================================= |
| 77 | # 5. Claude Code status line |
| 78 | # ============================================================================= |
| 79 | # |
| 80 | # Install a custom status line command in ~/.claude/settings.json. |
| 81 | # The command output is displayed at the bottom of the Claude Code interface. |
| 82 | # |
| 83 | # For example, to show the current git branch: |
| 84 | # |
| 85 | # cat > /tmp/statusline-patch.json << 'PATCH' |
| 86 | # {"statusLine": {"type": "command", "command": "git branch --show-current 2>/dev/null || echo ''"}} |
| 87 | # PATCH |
| 88 | # |
| 89 | # if [ -f ~/.claude/settings.json ]; then |
| 90 | # jq -s '.[0] * .[1]' ~/.claude/settings.json /tmp/statusline-patch.json > /tmp/settings-merged.json \ |
| 91 | # && mv /tmp/settings-merged.json ~/.claude/settings.json |
| 92 | # else |
| 93 | # mkdir -p ~/.claude |
| 94 | # cp /tmp/statusline-patch.json ~/.claude/settings.json |
| 95 | # fi |
| 96 | # rm -f /tmp/statusline-patch.json |

