浏览文件
main.go
27 行 · 816 B历史下载| 1 | // Command agent-vm runs AI coding agents in a disposable Linux VM per |
| 2 | // project, with Lima built in. |
| 3 | package main |
| 4 | |
| 5 | import ( |
| 6 | "os" |
| 7 | "strings" |
| 8 | |
| 9 | "github.com/sylvinus/agent-vm/internal/cli" |
| 10 | "github.com/sylvinus/agent-vm/internal/limaembed" |
| 11 | ) |
| 12 | |
| 13 | // extraPath goes first on PATH, for this process and what it starts (the |
| 14 | // hostagent, QEMU): set at build time (-ldflags -X) by a build that ships |
| 15 | // QEMU with agent-vm (flake.nix). Empty otherwise. |
| 16 | var extraPath string |
| 17 | |
| 18 | func main() { |
| 19 | if p := os.Getenv("PATH"); extraPath != "" && !strings.HasPrefix(p, extraPath+string(os.PathListSeparator)) { |
| 20 | os.Setenv("PATH", extraPath+string(os.PathListSeparator)+p) |
| 21 | } |
| 22 | // Lima's libraries start this executable again for its hostagent. |
| 23 | if limaembed.Run(os.Args[1:]) { |
| 24 | return |
| 25 | } |
| 26 | os.Exit(cli.Main(os.Args[1:], cli.Stdio())) |
| 27 | } |

