提交记录修改README.md+12 −3看文件
修改agent-vm.sh+10 −3看文件
| @@ -108,16 +108,25 @@ agent-vm --reset claude # Destroy and re-clone VM, then run Cl | ||
| 108 | 108 | |
| 109 | 109 | ## Customization |
| 110 | 110 | |
| 111 | 删除:### Per-user: `~/.agent-vm.setup.sh` | |
| 111 | 新增:### Per-user setup: `~/.agent-vm/setup.sh` | |
| 112 | 112 | |
| 113 | 删除:Create this file in your home directory to install extra tools into the base VM template. It runs once during `agent-vm setup`, as the default VM user (with sudo available): | |
| 113 | 新增:Create this file to install extra tools into the base VM template. It runs once during `agent-vm setup`, as the default VM user (with sudo available): | |
| 114 | 114 | |
| 115 | 115 | ```bash |
| 116 | 删除:# ~/.agent-vm.setup.sh | |
| 116 | 新增:# ~/.agent-vm/setup.sh | |
| 117 | 117 | sudo apt-get install -y postgresql-client |
| 118 | 118 | pip install pandas numpy |
| 119 | 119 | ``` |
| 120 | 120 | |
| 121 | 新增:### Per-user runtime: `~/.agent-vm/runtime.sh` | |
| 122 | 新增: | |
| 123 | 新增:Create this file to run commands inside every VM on each start. Runs before the per-project runtime script: | |
| 124 | 新增: | |
| 125 | 新增:```bash | |
| 126 | 新增:# ~/.agent-vm/runtime.sh | |
| 127 | 新增:export MY_API_KEY="..." | |
| 128 | 新增:``` | |
| 129 | 新增: | |
| 121 | 130 | ### Per-project: `.agent-vm.runtime.sh` |
| 122 | 131 | |
| 123 | 132 | Create this file at the root of any project. It runs inside the VM each time a new VM is created for the project, just before you get access. Use it for project-specific setup like installing dependencies or starting services: |
| @@ -122,6 +122,12 @@ _agent_vm_ensure_running() { | ||
| 122 | 122 | limactl start "$vm_name" &>/dev/null |
| 123 | 123 | fi |
| 124 | 124 | |
| 125 | 新增: # Run per-user runtime script if it exists | |
| 126 | 新增: if [ -f "$AGENT_VM_STATE_DIR/runtime.sh" ]; then | |
| 127 | 新增: echo "Running user runtime setup..." | |
| 128 | 新增: limactl shell --workdir "$host_dir" "$vm_name" zsh -l < "$AGENT_VM_STATE_DIR/runtime.sh" | |
| 129 | 新增: fi | |
| 130 | 新增: | |
| 125 | 131 | # Run project-specific runtime script if it exists |
| 126 | 132 | if [ -f "${host_dir}/.agent-vm.runtime.sh" ]; then |
| 127 | 133 | echo "Running project runtime setup..." |
| @@ -226,8 +232,9 @@ VMs are persistent and unique per directory. Running "agent-vm shell" or | ||
| 226 | 232 | "agent-vm claude" in the same directory will reuse the same VM. |
| 227 | 233 | |
| 228 | 234 | Customization: |
| 229 | 删除: ~/.agent-vm.setup.sh Per-user setup (runs during "agent-vm setup") | |
| 230 | 删除: <project>/.agent-vm.runtime.sh Per-project setup (runs on each VM start) | |
| 235 | 新增: ~/.agent-vm/setup.sh Per-user setup (runs during "agent-vm setup") | |
| 236 | 新增: ~/.agent-vm/runtime.sh Per-user runtime (runs on each VM start) | |
| 237 | 新增: <project>/.agent-vm.runtime.sh Per-project runtime (runs on each VM start) | |
| 231 | 238 | |
| 232 | 239 | More info: https://github.com/sylvinus/agent-vm |
| 233 | 240 | EOF |
| @@ -300,7 +307,7 @@ _agent_vm_setup() { | ||
| 300 | 307 | limactl shell "$AGENT_VM_TEMPLATE" bash -l < "${AGENT_VM_SCRIPT_DIR}/agent-vm.setup.sh" || { echo "Error: Setup script failed." >&2; return 1; } |
| 301 | 308 | |
| 302 | 309 | # Run user's custom setup script if it exists |
| 303 | 删除: local user_setup="$HOME/.agent-vm.setup.sh" | |
| 310 | 新增: local user_setup="$AGENT_VM_STATE_DIR/setup.sh" | |
| 304 | 311 | if [ -f "$user_setup" ]; then |
| 305 | 312 | echo "Running custom setup from $user_setup..." |
| 306 | 313 | limactl shell "$AGENT_VM_TEMPLATE" zsh -l < "$user_setup" || { echo "Error: Custom setup script failed." >&2; return 1; } |

