提交记录修改CHANGELOG.md+4 −2看文件
修改agent-vm.setup.sh+8 −0看文件
修改internal/cli/cli_test.go+2 −0看文件
修改internal/cli/help.txt+1 −1看文件
修改internal/cli/setup.go+10 −10看文件
修改internal/cli/setup_test.go+3 −5看文件
修改tests/setup-script.sh+20 −1看文件
修改www/src/i18n/en.ts+1 −1看文件
修改www/src/i18n/fr.ts+1 −1看文件
| @@ -10,6 +10,10 @@ | ||
| 10 | 10 | or `dnf install ./agent-vm-X.Y.Z-1.aarch64.rpm`. |
| 11 | 11 | - A Nix flake (Linux): `nix run github:sylvinus/agent-vm`. QEMU comes with it, |
| 12 | 12 | ssh is the system's. |
| 13 | 新增:- `agent-vm setup --preinstall=code-opencode`: the OpenCode extension | |
| 14 | 新增: (`sst-dev.opencode`) in code-server (#37). Unlike the other extensions it | |
| 15 | 新增: runs the `opencode` command, so `opencode` is installed with it, and its | |
| 16 | 新增: config allows every tool, as `agent-vm opencode` does with `--auto`. | |
| 13 | 17 | |
| 14 | 18 | ### Fixed |
| 15 | 19 | |
| @@ -35,8 +39,6 @@ | ||
| 35 | 39 | backend (QEMU 7.2 or later): no stream, nothing to lose. An older QEMU keeps |
| 36 | 40 | the former backend, and so does Windows (it has no unix datagram sockets). |
| 37 | 41 | |
| 38 | 删除:- `agent-vm setup`: Added `code-opencode` preinstall option to install the OpenCode VS Code extension (`sst-dev.opencode`) into code-server (#37). | |
| 39 | 删除: | |
| 40 | 42 | ## 0.3.0 |
| 41 | 43 | |
| 42 | 44 | agent-vm 0.3 is one Go binary with Lima built in. The |
| @@ -496,6 +496,14 @@ if [[ "$INSTALL_CODE_SERVER" == "1" ]]; then | ||
| 496 | 496 | if [[ "$INSTALL_CODE_VIBE" == "1" ]]; then |
| 497 | 497 | toml_prepend "$HOME/.vibe/config.toml" default_agent '"auto-approve"' |
| 498 | 498 | fi |
| 499 | 新增: # OpenCode's extension runs `opencode` in a terminal, without the --auto of | |
| 500 | 新增: # `agent-vm opencode`: its config allows everything instead. | |
| 501 | 新增: if [[ "$INSTALL_CODE_OPENCODE" == "1" ]]; then | |
| 502 | 新增: mkdir -p "$HOME/.config/opencode" | |
| 503 | 新增: oc_config="$HOME/.config/opencode/opencode.json" | |
| 504 | 新增: [ -f "$oc_config" ] || echo '{"$schema": "https://opencode.ai/config.json"}' > "$oc_config" | |
| 505 | 新增: jq '.permission = "allow"' "$oc_config" > "$oc_config.tmp" && mv "$oc_config.tmp" "$oc_config" | |
| 506 | 新增: fi | |
| 499 | 507 | # Written by code-server on its first run, with a password of its own. |
| 500 | 508 | rm -rf "$HOME/.config/code-server" |
| 501 | 509 | fi |
| @@ -88,6 +88,8 @@ func TestHelp(t *testing.T) { | ||
| 88 | 88 | } |
| 89 | 89 | strip := func(s string) string { |
| 90 | 90 | s = strings.Replace(s, "agent-vm rm agent-vm-old-name-1a2b3c4d ", "agent-vm rm old-name-1a2b3c4d ", 1) |
| 91 | 新增: // code-opencode is new. | |
| 92 | 新增: s = strings.Replace(s, "(or code-opencode, code-codex", "(or code-codex", 1) | |
| 91 | 93 | for _, cut := range []string{ |
| 92 | 94 | "AGENT_VM_BIN_DIR). Run it from the clone:\n ./agent-vm.sh install\n", |
| 93 | 95 | "AGENT_VM_BIN_DIR)\n", |
| @@ -21,7 +21,7 @@ Commands: | ||
| 21 | 21 | address and the password, made in each VM, are |
| 22 | 22 | printed: open it in your browser. Opt-in at setup, with the agents' |
| 23 | 23 | extensions or without: --preinstall=default,code-claude |
| 24 | 删除: (or code-codex, code-vibe, code-server) | |
| 24 | 新增: (or code-opencode, code-codex, code-vibe, code-server) | |
| 25 | 25 | stop [vm-name] Stop the VM for the current directory, or the named one |
| 26 | 26 | rm [vm-name] Stop and delete the VM for the current directory, or the |
| 27 | 27 | named one. Pass a name from 'agent-vm list' to reach a VM |
| @@ -52,12 +52,13 @@ Options: | ||
| 52 | 52 | code-opencode, code-codex, code-vibe |
| 53 | 53 | 'code-server' is VS Code in the browser, for |
| 54 | 54 | 'agent-vm code', with GitHub Copilot turned off. |
| 55 | 删除: 'code-claude', 'code-opencode', 'code-codex' and 'code-vibe' add that | |
| 56 | 删除: agent's extension, and code-server with it. Each | |
| 57 | 删除: extension brings its own copy of the agent: 'claude', | |
| 58 | 删除: 'codex' and 'vibe' are the command-line ones, for | |
| 59 | 删除: 'agent-vm claude' and the others (OpenCode's extension | |
| 60 | 删除: requires its command-line tool, which is installed with it). | |
| 55 | 新增: 'code-claude', 'code-opencode', 'code-codex' and | |
| 56 | 新增: 'code-vibe' add that agent's extension, and code-server | |
| 57 | 新增: with it. The Claude, Codex and Vibe extensions bring | |
| 58 | 新增: their own copy of the agent: 'claude', 'codex' and | |
| 59 | 新增: 'vibe' are the command-line ones, for 'agent-vm claude' | |
| 60 | 新增: and the others. OpenCode's does not: 'code-opencode' | |
| 61 | 新增: also installs 'opencode'. | |
| 61 | 62 | Selecting codex or pi also installs node (npm). So does |
| 62 | 63 | mcp-chrome when chromium and an agent are selected |
| 63 | 64 | (npx). mcp-playwright does not: list node yourself. |
| @@ -109,7 +110,7 @@ func (in install) nodeNeededBy() string { | ||
| 109 | 110 | return "Codex CLI requires npm" |
| 110 | 111 | case in["pi"]: |
| 111 | 112 | return "Pi requires npm" |
| 112 | 删除: case in["chromium"] && in["mcp-chrome"] && (in["claude"] || in["opencode"] || in["vibe"] || in["code-claude"] || in["code-opencode"] || in["code-codex"] || in["code-vibe"]): | |
| 113 | 新增: case in["chromium"] && in["mcp-chrome"] && (in["claude"] || in["opencode"] || in["vibe"] || in["code-claude"] || in["code-codex"] || in["code-vibe"]): | |
| 113 | 114 | return "Chrome DevTools MCP uses npx" |
| 114 | 115 | } |
| 115 | 116 | return "" |
| @@ -361,11 +362,10 @@ func (e *app) askCodeExtensions(in install) { | ||
| 361 | 362 | return |
| 362 | 363 | } |
| 363 | 364 | fmt.Fprintf(e.io.Stderr, " %s in the editor:\n", strings.Join(names, ", ")) |
| 364 | 删除: promptExtOnly := "Extension only" | |
| 365 | 365 | if in["opencode"] { |
| 366 | 删除: promptExtOnly = "Extension only (OpenCode keeps the CLI, required by its extension)" | |
| 366 | 新增: fmt.Fprintln(e.io.Stderr, " (OpenCode's extension needs its command line: it stays installed.)") | |
| 367 | 367 | } |
| 368 | 删除: choice := e.ui.AskChoice("Pick one", 1, "Extension and command line (agent-vm claude...)", promptExtOnly, "Command line only") | |
| 368 | 新增: choice := e.ui.AskChoice("Pick one", 1, "Extension and command line (agent-vm claude...)", "Extension only", "Command line only") | |
| 369 | 369 | if choice == 3 { |
| 370 | 370 | return |
| 371 | 371 | } |
| @@ -70,7 +70,6 @@ func on(m map[string]string) string { | ||
| 70 | 70 | return strings.Join(out, ",") |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 删除:// TestSetupPreinstall verifies --preinstall flag combinations. | |
| 74 | 73 | func TestSetupPreinstall(t *testing.T) { |
| 75 | 74 | for _, c := range []struct { |
| 76 | 75 | args []string |
| @@ -134,7 +133,6 @@ func wizardRun(t *testing.T, answers ...string) (*testEnv, []string) { | ||
| 134 | 133 | return te, stdin |
| 135 | 134 | } |
| 136 | 135 | |
| 137 | 删除:// TestSetupWizard verifies interactive setup wizard choices and defaults. | |
| 138 | 136 | func TestSetupWizard(t *testing.T) { |
| 139 | 137 | // Enter everywhere: the default set and resources. |
| 140 | 138 | te, stdin := wizardRun(t) |
| @@ -170,7 +168,7 @@ func TestSetupWizard(t *testing.T) { | ||
| 170 | 168 | |
| 171 | 169 | // OpenCode as extension only (keeps the required OpenCode CLI) |
| 172 | 170 | te, stdin = wizardRun(t, |
| 173 | 删除: "n", // the default set | |
| 171 | 新增: "n", // the default set | |
| 174 | 172 | "n", "y", "n", "n", "", // Claude, OpenCode, Codex, Vibe, Pi |
| 175 | 173 | "y", "2", // code-server, extension only |
| 176 | 174 | "n", "n", "n", // Docker, Chromium, gh |
| @@ -180,8 +178,8 @@ func TestSetupWizard(t *testing.T) { | ||
| 180 | 178 | if got := on(exportsOf(t, stdin)); got != "opencode,code-server,code-opencode" { |
| 181 | 179 | t.Errorf("opencode extension: %s", got) |
| 182 | 180 | } |
| 183 | 删除: if !strings.Contains(te.out(), "Extension only (OpenCode keeps the CLI, required by its extension)") { | |
| 184 | 删除: t.Errorf("prompt not shown: %s", te.out()) | |
| 181 | 新增: if !strings.Contains(te.out(), "OpenCode's extension needs its command line: it stays installed.") { | |
| 182 | 新增: t.Errorf("note not shown: %s", te.out()) | |
| 185 | 183 | } |
| 186 | 184 | } |
| 187 | 185 | |
| @@ -110,7 +110,6 @@ check "sshfs wrapper: an older sshfs gets the arguments unchanged" \ | ||
| 110 | 110 | # config (managed settings, MCP servers) is written. The lines setup derives |
| 111 | 111 | # it with, run as setup does. |
| 112 | 112 | has_block="$(awk '/^HAS_CLAUDE=0 HAS_OPENCODE=0 HAS_CODEX=0 HAS_VIBE=0$/,/HAS_VIBE=1$/' "$SETUP_SH")" |
| 113 | 删除:# has derives the HAS_* flags for the given set of agent install flags. | |
| 114 | 113 | # shellcheck disable=SC2034 # read by the eval'd block |
| 115 | 114 | has() { ( INSTALL_CLAUDE="$1" INSTALL_CODE_CLAUDE="$2" INSTALL_OPENCODE="$3" INSTALL_CODE_OPENCODE="$4" INSTALL_CODEX="$5" INSTALL_CODE_CODEX="$6" INSTALL_VIBE="$7" INSTALL_CODE_VIBE="$8" |
| 116 | 115 | eval "$has_block"; echo "$HAS_CLAUDE$HAS_OPENCODE$HAS_CODEX$HAS_VIBE" ); } |
| @@ -179,6 +178,23 @@ else | ||
| 179 | 178 | check "pi: skipped without node" "$( [ -e "$PIH0/sudo.log" ] || [ -e "$PIH0/.pi" ]; echo $?)" "1" |
| 180 | 179 | fi |
| 181 | 180 | |
| 181 | 新增:# ============================================================================= | |
| 182 | 新增:section "OpenCode install block" | |
| 183 | 新增:# ============================================================================= | |
| 184 | 新增:# The extension needs the command line: either flag installs it. | |
| 185 | 新增:oc_block="$(awk '/^if \[\[ "\$INSTALL_OPENCODE" == "1" \|\| "\$INSTALL_CODE_OPENCODE" == "1" \]\]; then/,/^fi$/' "$SETUP_SH")" | |
| 186 | 新增:# shellcheck disable=SC2034 # read by the eval'd block | |
| 187 | 新增:run_oc_block() { | |
| 188 | 新增: ( HOME="$SB/oc-home"; mkdir -p "$HOME"; rm -f "$HOME/curl.log" | |
| 189 | 新增: INSTALL_OPENCODE="$1" INSTALL_CODE_OPENCODE="$2" | |
| 190 | 新增: curl() { echo "curl $*" >> "$HOME/curl.log"; } | |
| 191 | 新增: eval "$oc_block" ) >/dev/null 2>&1 | |
| 192 | 新增: cat "$SB/oc-home/curl.log" 2>/dev/null | |
| 193 | 新增:} | |
| 194 | 新增:check "opencode: installed for the command line" "$(run_oc_block 1 0)" "curl -fsSL https://opencode.ai/install" | |
| 195 | 新增:check "opencode: installed for the extension alone" "$(run_oc_block 0 1)" "curl -fsSL https://opencode.ai/install" | |
| 196 | 新增:check "opencode: not installed for neither" "$(run_oc_block 0 0)" "" | |
| 197 | 新增: | |
| 182 | 198 | # ============================================================================= |
| 183 | 199 | section "code-server JSON schemas" |
| 184 | 200 | # ============================================================================= |
| @@ -322,6 +338,9 @@ $(awk '/^configure_mcp\(\) \{/,/^\}/' "$SETUP_SH")" | ||
| 322 | 338 | check "vibe: auto-approve, once, before any table" \ |
| 323 | 339 | "$(head -n 1 "$CSA/.vibe/config.toml"; grep -c '^default_agent' "$CSA/.vibe/config.toml")" \ |
| 324 | 340 | "$(printf 'default_agent = "auto-approve"\n1')" |
| 341 | 新增: check "opencode: everything allowed, next to the MCP server, written twice" \ | |
| 342 | 新增: "$(jq -r '[.permission, (.mcp | keys | join(","))] | join(" ")' "$CSA/.config/opencode/opencode.json")" "allow chrome-devtools" | |
| 343 | 新增: check "code-server alone: no OpenCode config" "$([ -e "$CSB/.config/opencode" ]; echo $?)" "1" | |
| 325 | 344 | if python3 -c 'import tomllib' 2>/dev/null; then |
| 326 | 345 | check "codex: the file parses, keys at the top level" \ |
| 327 | 346 | "$(python3 -c 'import sys,tomllib; d=tomllib.load(open(sys.argv[1],"rb")); print(d["approval_policy"], "chrome-devtools" in d["mcp_servers"])' "$CSA/.codex/config.toml")" \ |
| @@ -686,7 +686,7 @@ export const en = { | ||
| 686 | 686 | contentsCode: |
| 687 | 687 | 'agent-vm setup --preinstall=default # no prompts\nagent-vm setup --preinstall=default,rust # plus Rust\nagent-vm setup --preinstall=python,docker,claude # minimal Claude setup\nagent-vm setup --preinstall=default,code-claude # plus the editor\nagent-vm setup --disk 50 --memory 16 --cpus 8 # a bigger template', |
| 688 | 688 | contentsNote: |
| 689 | 删除: '`codex` and `pi` pull in `node`, and so does `mcp-chrome` with `chromium` and an agent. Both MCP servers are skipped without `node` and `chromium`. Each editor extension ships its own copy of its agent (200 to 600 MB): the wizard asks whether to keep the command-line one too (OpenCode’s extension requires the CLI, which is always installed with it). Without it, `agent-vm claude` says it is not installed. This is only what the template ships: the agent is root in the VM and reaches the internet, so it installs whatever else it needs.', | |
| 689 | 新增: '`codex` and `pi` pull in `node`, and so does `mcp-chrome` with `chromium` and an agent. Both MCP servers are skipped without `node` and `chromium`. The Claude, Codex and Mistral Vibe extensions ship their own copy of their agent (200 to 600 MB): the wizard asks whether to keep the command-line one too. Without it, `agent-vm claude` says it is not installed. OpenCode’s extension does not: it runs the `opencode` command, so `code-opencode` always installs it. This is only what the template ships: the agent is root in the VM and reaches the internet, so it installs whatever else it needs.', | |
| 690 | 690 | dockerTitle: 'Why not Docker', |
| 691 | 691 | dockerLede: |
| 692 | 692 | 'On Linux, containers share the host kernel, so a compromised dependency that finds a kernel bug is on your host. On macOS, Docker Desktop already runs a VM, which narrows the gap, but it is one VM shared by every container rather than one per project. A VM brings its own kernel, and root inside it still has the hypervisor between it and your machine. The practical differences matter as much as the security one.', |
| @@ -688,7 +688,7 @@ export const fr: Dictionary = { | ||
| 688 | 688 | contentsCode: |
| 689 | 689 | 'agent-vm setup --preinstall=default # sans question\nagent-vm setup --preinstall=default,rust # avec Rust en plus\nagent-vm setup --preinstall=python,docker,claude # Claude seul, minimal\nagent-vm setup --preinstall=default,code-claude # avec l\'éditeur\nagent-vm setup --disk 50 --memory 16 --cpus 8 # une image plus grosse', |
| 690 | 690 | contentsNote: |
| 691 | 删除: '`codex` et `pi` entraînent `node`, tout comme `mcp-chrome` avec `chromium` et un agent. Les deux serveurs MCP sont ignorés sans `node` et `chromium`. Chaque extension de l\'éditeur apporte sa propre copie de son agent (200 à 600 Mo) : l\'assistant demande s\'il faut garder aussi celle en ligne de commande (l\'extension d\'OpenCode nécessite l\'outil en ligne de commande, qui est toujours installé avec elle). Sans elle, `agent-vm claude` dit qu\'il n\'est pas installé. Ce n\'est que ce que l\'image contient au départ : l\'agent est root dans la VM et atteint Internet, il installe lui-même ce qui lui manque.', | |
| 691 | 新增: '`codex` et `pi` entraînent `node`, tout comme `mcp-chrome` avec `chromium` et un agent. Les deux serveurs MCP sont ignorés sans `node` et `chromium`. Les extensions Claude, Codex et Mistral Vibe apportent leur propre copie de leur agent (200 à 600 Mo) : l\'assistant demande s\'il faut garder aussi celle en ligne de commande. Sans elle, `agent-vm claude` dit qu\'il n\'est pas installé. Celle d\'OpenCode non : elle lance la commande `opencode`, donc `code-opencode` l\'installe toujours. Ce n\'est que ce que l\'image contient au départ : l\'agent est root dans la VM et atteint Internet, il installe lui-même ce qui lui manque.', | |
| 692 | 692 | dockerTitle: 'Pourquoi pas Docker', |
| 693 | 693 | dockerLede: |
| 694 | 694 | 'Sous Linux, les conteneurs partagent le noyau de l\'hôte : une dépendance compromise qui trouve une faille dans le noyau se retrouve sur ta machine. Sous macOS, Docker Desktop fait déjà tourner une VM, ce qui réduit l\'écart, mais c\'est une seule VM partagée par tous tes conteneurs, pas une par projet. Une VM a son propre noyau, et root dans la VM a encore l\'hyperviseur entre lui et ton poste. Les différences pratiques comptent autant que celle-ci.', |

