mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
Compare commits
80
Commits
v0.1.0
...
v0.1.1-rc.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a47397c26e | ||
|
|
7c286973b9 | ||
|
|
d187f3cca1 | ||
|
|
7b876d7285 | ||
|
|
ab125b1af6 | ||
|
|
cd37a12b1b | ||
|
|
db26def35b | ||
|
|
7c261ed15c | ||
|
|
b67ae25b31 | ||
|
|
2406b498d8 | ||
|
|
e3f2635806 | ||
|
|
17d082e4d9 | ||
|
|
6343f7e578 | ||
|
|
65b2805f41 | ||
|
|
4d4c728f38 | ||
|
|
ffcaa20c1c | ||
|
|
665f27dcb5 | ||
|
|
4f97f23fe2 | ||
|
|
ab5d607d0e | ||
|
|
eb45ad4e18 | ||
|
|
79fc8dab63 | ||
|
|
1bc77c9fbd | ||
|
|
f1d8f86a43 | ||
|
|
e7a62d3677 | ||
|
|
cb36951de2 | ||
|
|
647ad4bf2a | ||
|
|
6fd1d846d6 | ||
|
|
cf1f195490 | ||
|
|
01e5d2488a | ||
|
|
20d2fe1db7 | ||
|
|
62d54923ec | ||
|
|
776a1edb49 | ||
|
|
b2b12ee55d | ||
|
|
8f6b30a887 | ||
|
|
f8f29e7acb | ||
|
|
017cc90a4a | ||
|
|
423d3da279 | ||
|
|
2b68a2347c | ||
|
|
d89f3501a2 | ||
|
|
2865158e02 | ||
|
|
9b40a133ed | ||
|
|
785fb4c1d4 | ||
|
|
33ec9eb0dc | ||
|
|
f5e6eebc55 | ||
|
|
3e81767482 | ||
|
|
fb19879aaa | ||
|
|
ae5c9b7221 | ||
|
|
425a655ef6 | ||
|
|
ffd0d3bcf8 | ||
|
|
0f31804cad | ||
|
|
eaa1706966 | ||
|
|
26a7aca55c | ||
|
|
77d2b202ab | ||
|
|
9f51e79421 | ||
|
|
84f1190b04 | ||
|
|
cda2d09f42 | ||
|
|
365e562cbc | ||
|
|
bd00db91d4 | ||
|
|
cbe2947438 | ||
|
|
81f3feeecf | ||
|
|
72f6284eb9 | ||
|
|
72b648df31 | ||
|
|
c27b913b17 | ||
|
|
8d8da01037 | ||
|
|
da804f0568 | ||
|
|
b3a188712f | ||
|
|
63e41118c6 | ||
|
|
3c4e90da0c | ||
|
|
062c89c913 | ||
|
|
a965e68651 | ||
|
|
770cb99329 | ||
|
|
588ba6f9a1 | ||
|
|
1276474123 | ||
|
|
22387c5b78 | ||
|
|
c3a262bec9 | ||
|
|
5fb0732580 | ||
|
|
1a6d653431 | ||
|
|
57cf548b31 | ||
|
|
b24da31e41 | ||
|
|
f3e4753445 |
No files matched your search
@@ -9,22 +9,22 @@ devvm's command line should be easy to learn: once you know a few commands, you
|
||||
|
||||
The reasoning behind most rules is in the [Command Line Interface Guidelines](https://clig.dev/), and the mechanics of commands, flags and groups are in [Cobra's docs](https://cobra.dev/docs/). Read them there, because this skill doesn't restate them. It says only what devvm decided and how devvm's code does it.
|
||||
|
||||
[judgment.md](judgment.md) explains, with examples, the rules that no test can check: where a command goes, rm or unX, which commands are settings, what an argument is, what a destructive command does, and how help and usage errors are worded. [Contributing](../../../docs/content/docs/contributing/_index.md) covers the code: [Command arguments](../../../docs/content/docs/contributing/_index.md#command-arguments) for the checks in `internal/cli/args.go`, [JSON output](../../../docs/content/docs/contributing/_index.md#json-output) for `--json`, [A command's help](../../../docs/content/docs/contributing/_index.md#a-commands-help) for help and groups, and [The CLI rule tests](../../../docs/content/docs/contributing/_index.md#the-cli-rule-tests) for what each test checks.
|
||||
[judgment.md](judgment.md) explains, with examples, the rules that no test can check: where a command goes, rm or unX, which commands are settings, what an argument is, what a destructive command does, and how help and usage errors are worded. [Contributing](../../../docs/content/docs/contributing/_index.md) covers the code: [Command arguments](../../../docs/content/docs/contributing/cli.md#command-arguments) for the checks in `internal/cli/args.go`, [JSON output](../../../docs/content/docs/contributing/cli.md#json-output) for `--json`, [A command's help](../../../docs/content/docs/contributing/docs.md#a-commands-help) for help and groups, and [The CLI rule tests](../../../docs/content/docs/contributing/cli.md#the-cli-rule-tests) for what each test checks.
|
||||
|
||||
## The tree
|
||||
|
||||
devvm has 33 commands at the top, plus help. Each one is in a group of the root's help, in this order. The table shows each command with its subcommands and the values a setting takes, and each command's help lists its flags.
|
||||
devvm has 34 commands at the top, plus help. Each one is in a group of the root's help, in this order. The table shows each command with its subcommands and the values a setting takes, and each command's help lists its flags.
|
||||
|
||||
| Group | Commands |
|
||||
| --- | --- |
|
||||
| Your VM | devvm, with --tools, --agents and --layers; restart, stop, update, rm [VM], adopt [VM], ls, code, desktop, host, history, history export [FILE], history import [FILE] |
|
||||
| Change your VM | tools (a picker in a terminal), tools add\|rm TOOL..., tools update; size, with --cpus, --memory and --disk; ports [all\|none\|LIST], ports add\|rm LIST; network [open\|internet\|allowlist\|none], network allow\|deny\|rm RULE..., network log; ssh-agent [on\|devvm\|off], ssh-agent add\|rm KEY_FILE; git-protect [on\|strict\|off]; clone [on\|off]; secret, secret set\|rm\|use\|unuse NAME; layer add\|rm LAYER... |
|
||||
| Change your VM | tools (a picker in a terminal), tools add\|rm TOOL..., tools update; size, with --cpus, --memory and --disk; mount-cache [none]; ports [all\|none\|LIST], ports add\|rm LIST; network [open\|internet\|learn\|allowlist\|none], network allow\|deny\|rm RULE..., network log, network lock, network transparent [on\|off]; ssh-agent [on\|devvm\|off], ssh-agent add\|rm KEY_FILE; git-protect [on\|off]; clone [on\|off], clone fetch, clone add PATH; secret, secret set\|rm\|use\|unuse NAME; layer add\|rm LAYER... |
|
||||
| Links between VMs | group, group join NAME, with --as NAME, group leave; link, link add\|rm TARGET PORT, with --as NAME on add; link publish [PORTS], link unpublish PORTS |
|
||||
| Images | images, images rm IMAGE\|KEY..., build IMAGE, rebuild IMAGE, layer new NAME |
|
||||
| Disk space | space, gc, retention [KEY=VALUE...] |
|
||||
| This machine | setup, agent, agent import [AGENT...], agent login AGENT, agent save [AGENT...], doctor, upgrade, completion SHELL, limactl [ARGS...] |
|
||||
|
||||
size, ports and network take `-g` for what new VMs get. Every command takes `-h`/`--help`, `--no-input` and `-v`/`--verbose`, and the root takes `--version`. `devvm --help` prints the tree as it is, and `commandGroups` in `internal/cli/help.go` holds the groups. A subcommand can sit in a group other than its parent's, as layer add and layer rm do, and `devvm --help` then lists it by both names in that group.
|
||||
size, ports and network take `-g` for what new VMs get. Every command takes `-h`/`--help`, `--no-input` and `-v`/`--verbose`, and the root takes `--version`. `devvm --help` prints the tree as it is. `helpGroups` in `internal/cli/help.go` holds the groups, in order, and each command names its own group in its `about`. A subcommand can sit in a group other than its parent's, as layer add and layer rm do, and `devvm --help` then lists it by both names in that group.
|
||||
|
||||
## The rules
|
||||
|
||||
@@ -54,12 +54,12 @@ Work through this list for each new command, in order, then run [the review](#re
|
||||
4. **Add its flags** in the command's own `Flags()`, reusing an adder from `internal/cli/flags.go` or a flag name that already means the same thing. A new flag name means one thing, and its help text is lower case without a full stop, with its value as a backticked placeholder, such as ``the `N` CPUs the VM gets``. Check a flag's value in `checkFlagValue` and flags that can't go together with `exclusive`.
|
||||
5. **Settings:** when the command shows a setting bare and changes it with a value, wrap its `Args` in `showsOnly`, and give it `-g` (`--global`) when new VMs have a default for it ([settings](judgment.md#settings)).
|
||||
6. **Questions:** every question the command asks needs a flag or a command that answers it beforehand, declared where it's asked: `u.Ask(msg.X(...).AnsweredBy("--flag"))`, so its refusal names it. A command that deletes takes `addForceFlag`, asks only without `--force`, with `AnsweredBy("--force")`, and returns the question's error ([destructive commands](judgment.md#destructive-commands)).
|
||||
7. **Output:** when it shows or lists something, give it `jsonFlag`, a struct of its own with snake_case `json` tags, `printJSON`, a row in `TestJSONShapes` and a section with an example on its docs page. Otherwise add it to `withoutJSON` in `internal/cli/json_test.go` with why.
|
||||
8. **Help:** write a `Short`, a `Long` of one to three sentences and an `Example` from `examples()`, with the docs-voice skill ([help](judgment.md#help)). Add its path to `commandDocs` in `internal/msg/docs.go`, pointing at the user page that covers it, and add a root command to its group in `commandGroups`.
|
||||
7. **Output:** when it shows or lists something, give it `jsonFlag`, a struct of its own with snake_case `json` tags, `printJSON`, a row in `TestJSONShapes` and a section with an example on its docs page. Otherwise say why it has none in its `about`'s `noJSON`, such as `noJSON: "it deletes"`.
|
||||
8. **Help:** write a `Short`, a `Long` of one to three sentences and an `Example` from `examples()`, with the docs-voice skill ([help](judgment.md#help)). Set its `Annotations` from an `about` (`internal/cli/help.go`): `docs`, the user page that covers it as `page#anchor`, and for a root command its `group`, one of `helpGroups`, such as `Annotations: about{docs: "using/vms#listing-vms", group: groupVM}.annotations()`.
|
||||
9. **Messages:** every message goes in `locales/en.toml`, with the docs-voice skill's Messages rules, and then `go generate ./internal/msg`. A usage error names what the command expected ([usage errors](judgment.md#usage-errors)). The command fails by returning its error from `RunE`, as `failed(err, msg.XFailed)` when the error may not be a message, or through `a.env`, which does the same, and never prints the failure itself, because `execute` shows it (`TestExecuteShowsEachFailure`).
|
||||
10. **Register it** with `AddCommand` in `NewRoot` (`internal/cli/root.go`) or under its noun, and write it in its own file, `internal/cli/<command>.go`, named in AGENTS.md's Layout row for `internal/cli`.
|
||||
11. **Tests:** add a CLI test in `testdata/script/` for what it does and for each refusal, with `DEVVM_MESSAGES=names`. Add the command's arguments to `argSamples` in `internal/cli/args_test.go` when `TestUseMatchesArgs` asks for them.
|
||||
12. **Docs:** add the command to its group's table on the Commands page (`docs/content/docs/getting-started/commands.md`), and to the page that `commandDocs` names, with the docs-voice skill. Then run `mise run cli-docs` and commit the pages it writes.
|
||||
10. **Register it** with `AddCommand` in `NewRoot` (`internal/cli/root.go`) or under its noun, and write it in its own file, `internal/cli/<command>.go`, with what completes its arguments and flags (`ValidArgsFunction`, `RegisterFlagCompletionFunc`) set there too.
|
||||
11. **Tests:** add a CLI test in `testdata/script/` for what it does and for each refusal, with `DEVVM_MESSAGES=names`. Add a sample value to `argSamples` in `internal/cli/args_test.go` when `TestUseMatchesArgs` asks for one, for a placeholder no command had, and a command on this folder's VM to `folderCommands` in `internal/cli/flags_test.go`.
|
||||
12. **Docs:** add the command to its group's table on the Commands page (`docs/content/docs/getting-started/commands.md`), and to the page its `about` names, with the docs-voice skill. Then run `mise run cli-docs` and commit the pages it writes.
|
||||
13. **The gate:** `mise run fmt && mise run lint && mise run test`.
|
||||
|
||||
## Changing a command
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# The rules a reviewer checks
|
||||
|
||||
The tests in [The CLI rule tests](../../../docs/content/docs/contributing/_index.md#the-cli-rule-tests) check a command's shape: its names, its flags, its help's parts and its `--json`. They can't tell whether a command is in the right place, whether its arguments are the right ones, or whether its words help the user. Those choices are yours, and this page explains each one with examples from devvm's own commands. Each section ends with the question to ask in a review.
|
||||
The tests in [The CLI rule tests](../../../docs/content/docs/contributing/cli.md#the-cli-rule-tests) check a command's shape: its names, its flags, its help's parts and its `--json`. They can't tell whether a command is in the right place, whether its arguments are the right ones, or whether its words help the user. Those choices are yours, and this page explains each one with examples from devvm's own commands. Each section ends with the question to ask in a review.
|
||||
|
||||
## Where a command goes
|
||||
|
||||
@@ -34,11 +34,11 @@ Don't name a command `delete`, `remove` or `disable`, because rm and unX cover t
|
||||
A setting is a value devvm keeps, which a user reads and changes. Each setting is one command that does both:
|
||||
|
||||
- **Bare, it shows the value.** devvm size shows the VM's CPUs, memory and disk, devvm ports shows what it forwards, and devvm git-protect shows its `.git` protection.
|
||||
- **With a value, it changes it.** devvm ports none, devvm network open, devvm ssh-agent devvm and devvm git-protect strict each set the value. devvm size takes its values as `--cpus`, `--memory` and `--disk`, because it holds three, and devvm retention takes `KEY=VALUE` words, because it holds many.
|
||||
- **With a value, it changes it.** devvm ports none, devvm network open, devvm ssh-agent devvm and devvm git-protect off each set the value. devvm size takes its values as `--cpus`, `--memory` and `--disk`, because it holds three, and devvm retention takes `KEY=VALUE` words, because it holds many.
|
||||
- **With `-g`, it shows or changes what new VMs get.** devvm size -g --memory 16, devvm ports -g none and devvm network -g none change the defaults. A setting takes `-g` only when new VMs get a default for it, so devvm git-protect, devvm ssh-agent and devvm clone have none, and devvm retention is about the whole machine.
|
||||
- **With `--json`, it only shows.** `showsOnly` refuses a value, so devvm network --json off is a usage error and changes nothing.
|
||||
|
||||
The commands that are settings are size, ports, network, ssh-agent, git-protect, clone and retention. devvm clone holds whether the VM has its own clone of the repo, the setting `--clone` gives a new VM, and setting it makes the VM again, as devvm layer add does. tools isn't one, because its value is a list that devvm tools add and devvm tools rm change, and that devvm tools shows in a terminal as a picker whose changes become add and rm. setup isn't one either: it asks the first-run questions, and its flags, `--features` and `--agents`, answer the two that no other command sets.
|
||||
The commands that are settings are size, mount-cache, ports, network, network transparent, ssh-agent, git-protect, clone and retention. devvm mount-cache holds how a Linux host's VM caches its project folder, and takes one value, none, the only mode devvm sets, as a word rather than a bare opt-in command, so it reads as what it shows and stays the same should another mode be worth setting. It has no `-g`, because every new VM gets none. devvm network transparent has no `-g` either: a VM without its own value follows config.toml's `transparent-proxy` as it is at each launch, so there's no default new VMs take. devvm clone holds whether the VM has its own clone of the repo, the setting `--clone` gives a new VM, and setting it makes the VM again, as devvm layer add does. tools isn't one, because its value is a list that devvm tools add and devvm tools rm change, and that devvm tools shows in a terminal as a picker whose changes become add and rm. setup isn't one either: it asks the first-run questions, and its flags, `--features` and `--agents`, answer the two that no other command sets.
|
||||
|
||||
A command is a setting when its bare form shows one value and the user can type the new value after its name. When the value is a list that grows and shrinks, give it add and rm, as devvm ports has besides devvm ports LIST.
|
||||
|
||||
@@ -78,7 +78,7 @@ A command that takes out only what the user named, and what one command puts bac
|
||||
A command's help is short, and its docs page holds the rest. Write it with the docs-voice skill.
|
||||
|
||||
- **`Short` is an action on a named thing.** "Delete this folder's VM", "Forward more ports from this folder's VM" and "Load a key into devvm's own SSH agent" each say what happens and to what. A noun's `Short` says what it shows: "List the secrets kept on this machine, for VMs to use". A settings command starts with "Show or change", as in "Show or change this folder's VM's size".
|
||||
- **`Long` says what the command does in one to three sentences.** devvm rm's says what it deletes, that it asks in a terminal, and that it exports the agents' history unless `--no-export` is given. Edge cases, limits and how it works go on the docs page that `commandDocs` names.
|
||||
- **`Long` says what the command does in one to three sentences.** devvm rm's says what it deletes, that it asks in a terminal, and that it exports the agents' history unless `--no-export` is given. Edge cases, limits and how it works go on the docs page that its `about` names.
|
||||
- **The examples start with the common case.** devvm rm's first example is devvm rm, then devvm rm --force, then devvm rm --no-export. Each comment says what that line does, in lower case, such as "delete it without asking, as a script must". A noun's examples can show its subcommands, as devvm secret's show devvm secret set github.
|
||||
- **A flag's help is a short phrase in lower case without a full stop,** with its value as a backticked placeholder, such as ``the `N` CPUs the VM gets``. A default goes at its end in parentheses, as in "(default: devvm ports -g, else all)".
|
||||
- **The same thing has the same words everywhere.** Say this folder's VM, new VMs, devvm's own SSH agent and shared tools, as the docs-voice skill's Terms say. A flag shared between commands has one help text, unless `manyUses` in `internal/cli/flags_test.go` says why it differs.
|
||||
|
||||
@@ -59,11 +59,11 @@ Messages use the same voice as the docs, only shorter, so the CLI reads like the
|
||||
Use these terms on every page and in every message.
|
||||
|
||||
- **Secret** is the general term for what devvm keeps on this machine for VMs to use, as in devvm secret. The Staying safe and Network policy pages define it: "A secret is a credential devvm keeps on this machine for VMs to use: your GitHub token, Claude Code's token, an agent's login or an API key."
|
||||
- **Name the secret when the specific one matters:** "GitHub token", "Claude Code token" (from claude setup-token), "API key", "Codex login" or "opencode login". Never write a bare "token" or "tokens", because agents use "tokens" for model tokens. The one exception is right after a prompt that names the token: after "GitHub token:", "You didn't paste a token" is clear.
|
||||
- **Name the secret when the specific one matters:** "GitHub token", "Claude Code token" (from claude setup-token), "API key", "Codex login", "opencode login" or "pi's API key". Never write a bare "token" or "tokens", because agents use "tokens" for model tokens. The one exception is right after a prompt that names the token: after "GitHub token:", "You didn't paste a token" is clear.
|
||||
- **Feature** on user pages means only base image features (omb, fzf, cli-tools) and devcontainer features. Backend features, which are native, emulated or none, appear only on the How it works pages. devvm doctor prints backend features as "features", so say so where a user page compares backends.
|
||||
- **Image** means devvm's images, such as base or foo+bar. Say "container image" for the images that `--from` and a `devcontainer.json` start from.
|
||||
- **Layer** means devvm's layers. Say "Docker's image layers" when you mean Docker's.
|
||||
- **Shared tool** means node, python, rust, go, claude, codex or opencode.
|
||||
- **Shared tool** means a toolchain or a coding agent that devvm shares read-only between VMs, such as node or claude: the toolchains page and the coding agents page's Supported agents table list them.
|
||||
|
||||
## Workflow
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Generated files: GitHub collapses them in diffs.
|
||||
internal/msg/messages_gen.go linguist-generated=true
|
||||
docs/content/docs/cli/** linguist-generated=true
|
||||
@@ -0,0 +1,2 @@
|
||||
# Every pull request asks the maintainer for a review.
|
||||
* @w3cj
|
||||
@@ -1,5 +1,5 @@
|
||||
name: Toolchain request
|
||||
description: A language or runtime you'd like devvm to build in, such as .NET, Java, PHP, Ruby or Elixir.
|
||||
description: A language or runtime you'd like devvm to build in, such as Java, PHP, Ruby or Elixir.
|
||||
labels: ["enhancement", "toolchain", "triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
@@ -18,7 +18,7 @@ body:
|
||||
attributes:
|
||||
label: The toolchain
|
||||
description: Its usual name, and its mise tool name if you know it (what `mise registry NAME` prints).
|
||||
placeholder: .NET (mise's dotnet)
|
||||
placeholder: Ruby (mise's ruby)
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
@@ -26,7 +26,7 @@ body:
|
||||
attributes:
|
||||
label: Files that should pick it
|
||||
description: The project files that tell devvm a folder needs this toolchain.
|
||||
placeholder: "*.csproj, *.sln, global.json"
|
||||
placeholder: "Gemfile, .ruby-version"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
@@ -41,25 +41,25 @@ body:
|
||||
attributes:
|
||||
label: Versions
|
||||
description: Whether the latest is enough or you need several major versions, and which.
|
||||
placeholder: The latest LTS, and 8 for older projects
|
||||
placeholder: The latest, and 3.3 for older projects
|
||||
- type: input
|
||||
id: source
|
||||
attributes:
|
||||
label: Official install source
|
||||
description: Where the toolchain's own builds come from.
|
||||
placeholder: https://dotnet.microsoft.com/download
|
||||
placeholder: https://www.ruby-lang.org/en/downloads/
|
||||
- type: textarea
|
||||
id: registries
|
||||
attributes:
|
||||
label: Package managers and their hosts
|
||||
description: The package managers people use with it and the hosts they download from, which the toolchain's network policy lets through.
|
||||
placeholder: "NuGet: api.nuget.org, globalcdn.nuget.org"
|
||||
placeholder: "RubyGems: rubygems.org, index.rubygems.org"
|
||||
- type: textarea
|
||||
id: writes
|
||||
attributes:
|
||||
label: What it writes into its own folder
|
||||
description: Global installs, plugins or self-updates that write into the toolchain's install folder, which devvm has to send somewhere else because shared tools are read-only in VMs.
|
||||
placeholder: "`dotnet tool install -g` writes to ~/.dotnet/tools"
|
||||
placeholder: "`gem install` writes into Ruby's own gems folder"
|
||||
- type: dropdown
|
||||
id: builds
|
||||
attributes:
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Monthly updates, each ecosystem in one grouped pull request, for devvm's Go modules and the actions its workflows pin by SHA. Their titles follow
|
||||
# Conventional Commits, as the PR title check asks. Pinned downloads in assets/, the shared tools' lock
|
||||
# and the e2e pins are bumped with scripts/bump.sh, which Dependabot doesn't know.
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: gomod
|
||||
directories: ["/", "/docs"]
|
||||
schedule:
|
||||
interval: monthly
|
||||
# A release has a week to be found bad before an update proposes it.
|
||||
cooldown:
|
||||
default-days: 7
|
||||
commit-message:
|
||||
prefix: build
|
||||
include: scope
|
||||
# pflag 1.1 prints every boolean flag as --flag[=true|false] in the help, with no way to turn it
|
||||
# off, so devvm stays on 1.0.x.
|
||||
ignore:
|
||||
- dependency-name: github.com/spf13/pflag
|
||||
versions: [">= 1.1.0"]
|
||||
groups:
|
||||
go:
|
||||
patterns: ["*"]
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
cooldown:
|
||||
default-days: 7
|
||||
commit-message:
|
||||
prefix: ci
|
||||
include: scope
|
||||
groups:
|
||||
actions:
|
||||
patterns: ["*"]
|
||||
@@ -0,0 +1,16 @@
|
||||
<!-- markdownlint-disable-file MD041 -- a pull request's body, under GitHub's own title -->
|
||||
## What this changes
|
||||
|
||||
<!-- What the change does and why. Link the issue it fixes, as in "Fixes #12". -->
|
||||
|
||||
## How it was tested
|
||||
|
||||
<!-- The tests you added or ran. For a change that touches VMs, the e2e sections you ran (mise run e2e -- --only SECTION) and on which OS. -->
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] The title is a Conventional Commit, `type(scope): summary`, because it becomes the squashed commit's subject.
|
||||
- [ ] `mise run fmt && mise run lint && mise run test` passes.
|
||||
- [ ] New behaviour has tests, and every behaviour change updates its page in `docs/content/docs/`.
|
||||
- [ ] A changed command follows the cli skill, and `mise run cli-docs` is rerun when its help changed.
|
||||
- [ ] Nothing here belongs in a private security advisory instead (see SECURITY.md).
|
||||
+136
-13
@@ -1,30 +1,53 @@
|
||||
name: Docs
|
||||
|
||||
# Pull requests touching the docs get their lints and a build; main deploys.
|
||||
# Two sites. devvm.dev shows the latest release's docs: a published release that isn't a
|
||||
# prerelease deploys its tag's docs to GitHub Pages, and so does a dispatch, with any release's
|
||||
# tag. next.devvm.dev shows main's: each push to main that changes the docs builds them with
|
||||
# docs/next.yaml and commits the site to devvmhq/docs-next, which Cloudflare Pages serves.
|
||||
# Pull requests touching the docs get their lints and a build, and nothing else.
|
||||
# The site is built from docs/ alone (the CLI reference included, which a help change commits
|
||||
# there), and CI's lint runs the docs checks on every code change, so other pushes skip this.
|
||||
# A release event runs this file as its tag has it.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
paths:
|
||||
paths: &docs-paths
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
- ".vale.ini"
|
||||
- ".vale/**"
|
||||
- ".markdownlint-cli2.yaml"
|
||||
- ".github/workflows/docs.yml"
|
||||
pull_request:
|
||||
paths: *docs-paths
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
site:
|
||||
description: The site to deploy
|
||||
type: choice
|
||||
options: [devvm.dev, next.devvm.dev]
|
||||
default: devvm.dev
|
||||
ref:
|
||||
description: "devvm.dev only: the release tag whose docs it shows, such as v0.1.0 (empty: the latest release)"
|
||||
type: string
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# Deploys queue one after another; a pull request's newer run replaces its last.
|
||||
concurrency:
|
||||
group: docs-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# main's docs, or a pull request's: the lints and a build.
|
||||
check:
|
||||
if: >-
|
||||
github.event_name == 'pull_request' || github.event_name == 'push' ||
|
||||
(github.event_name == 'workflow_dispatch' && inputs.site == 'next.devvm.dev')
|
||||
runs-on: ubuntu-latest
|
||||
# A pull request's newer run replaces its last.
|
||||
concurrency:
|
||||
group: docs-check-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
env:
|
||||
# Only the docs' tools, not every tool in mise.toml.
|
||||
MISE_TASK_RUN_AUTO_INSTALL: "false"
|
||||
@@ -38,18 +61,118 @@ jobs:
|
||||
with:
|
||||
version: 2026.10.18
|
||||
install_args: go hugo-extended node markdownlint-cli2 vale lychee
|
||||
# The workflow publishes, so no job in it reads a cache another run could have written.
|
||||
cache: false
|
||||
- run: mise run lint:docs
|
||||
# The site's address is baseURL in docs/hugo.yaml.
|
||||
- run: hugo -s docs --minify
|
||||
- if: github.event_name != 'pull_request'
|
||||
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
|
||||
|
||||
# next.devvm.dev: main's docs, committed to devvmhq/docs-next.
|
||||
next:
|
||||
if: >-
|
||||
github.ref == 'refs/heads/main' &&
|
||||
(github.event_name == 'push' ||
|
||||
(github.event_name == 'workflow_dispatch' && inputs.site == 'next.devvm.dev'))
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
# One push at a time; a newer run waiting replaces an older one.
|
||||
concurrency:
|
||||
group: docs-next
|
||||
cancel-in-progress: false
|
||||
# The environment holds the deploy key, and only main can use it.
|
||||
environment:
|
||||
name: docs-next
|
||||
url: https://next.devvm.dev/
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- uses: jdx/mise-action@6be3c7ed4c21d4f76b208d351d95aac273ebb76d # v5.2.4
|
||||
with:
|
||||
version: 2026.10.18
|
||||
install_args: go hugo-extended
|
||||
# What's published is built from no cache.
|
||||
cache: false
|
||||
# docs/next.yaml over docs/hugo.yaml: next.devvm.dev's address, the banner and noindex.
|
||||
- run: hugo -s docs --minify --config hugo.yaml,next.yaml -d "$RUNNER_TEMP/next"
|
||||
# The key is checked out only after the build, which never sees it.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: devvmhq/docs-next
|
||||
ref: main
|
||||
path: docs-next
|
||||
ssh-key: ${{ secrets.DOCS_NEXT_DEPLOY_KEY }}
|
||||
# The push below needs the key; this checkout is the only thing that uses it.
|
||||
persist-credentials: true # zizmor: ignore[artipacked] -- the push needs the deploy key, and nothing is uploaded
|
||||
- name: Publish
|
||||
working-directory: docs-next
|
||||
run: |
|
||||
# Everything but README.md is the site's.
|
||||
find . -mindepth 1 -maxdepth 1 ! -name .git ! -name README.md -exec rm -rf {} +
|
||||
cp -R "$RUNNER_TEMP/next/." .
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "next.devvm.dev is already this build."
|
||||
exit 0
|
||||
fi
|
||||
git -c user.name="github-actions[bot]" \
|
||||
-c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
|
||||
commit -q -m "Build from devvm ${GITHUB_SHA::7}"
|
||||
git push origin HEAD:main
|
||||
|
||||
# devvm.dev: a release's docs, built from its tag.
|
||||
release:
|
||||
if: >-
|
||||
(github.event_name == 'release' && !github.event.release.prerelease) ||
|
||||
(github.event_name == 'workflow_dispatch' && inputs.site == 'devvm.dev')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: tag
|
||||
name: The release's tag
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
EVENT: ${{ github.event_name }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
INPUT_REF: ${{ inputs.ref }}
|
||||
run: |
|
||||
if [ "$EVENT" = release ]; then
|
||||
tag=$RELEASE_TAG
|
||||
elif [ -n "$INPUT_REF" ]; then
|
||||
tag=$INPUT_REF
|
||||
else
|
||||
tag=$(gh release view --repo devvmhq/devvm --json tagName --jq .tagName)
|
||||
fi
|
||||
if ! [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "::error::A release tag is vX.Y.Z, such as v0.1.0; this is $tag."
|
||||
exit 1
|
||||
fi
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: refs/tags/${{ steps.tag.outputs.tag }}
|
||||
persist-credentials: false
|
||||
# Full history, for each page's last updated date.
|
||||
fetch-depth: 0
|
||||
- uses: jdx/mise-action@6be3c7ed4c21d4f76b208d351d95aac273ebb76d # v5.2.4
|
||||
with:
|
||||
version: 2026.10.18
|
||||
install_args: go hugo-extended
|
||||
# What's published is built from no cache.
|
||||
cache: false
|
||||
# The tag's docs/hugo.yaml, whose baseURL is devvm.dev.
|
||||
- run: hugo -s docs --minify
|
||||
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
|
||||
with:
|
||||
path: docs/public
|
||||
|
||||
deploy:
|
||||
if: github.event_name != 'pull_request'
|
||||
needs: build
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
# Deploys queue one after another.
|
||||
concurrency:
|
||||
group: docs-pages
|
||||
cancel-in-progress: false
|
||||
permissions:
|
||||
pages: write # to deploy the site
|
||||
id-token: write # to prove the deployment comes from this workflow
|
||||
|
||||
@@ -15,9 +15,10 @@ concurrency:
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
LIMA_VERSION: 2.2.1
|
||||
# lima-2.2.1-Linux-x86_64.tar.gz in the release's SHA256SUMS.
|
||||
LIMA_SHA256: b391ac7fcac2b2a5a1628107756463188ded4d18d3104a40a66a8bb6fec01bcb
|
||||
LIMA_VERSION: 2.3.0
|
||||
# lima-$LIMA_VERSION-Linux-x86_64.tar.gz in the release's SHA256SUMS
|
||||
# (scripts/bump.sh e2e-lima).
|
||||
LIMA_SHA256: cc8ba97f1c801b899f7c9eda9919dfc4ce4fa2c140c53e5add15aa2d0a1936f9
|
||||
|
||||
jobs:
|
||||
project:
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
name: Pins
|
||||
|
||||
# scripts/bump.sh --check once a week: the pins with a newer upstream go in
|
||||
# one open issue, which closes when none is left. It reports and never bumps.
|
||||
on:
|
||||
schedule:
|
||||
- cron: "47 6 * * 1"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: pins
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Check the pins
|
||||
run: |
|
||||
set -euo pipefail
|
||||
scripts/bump.sh --check | tee "$RUNNER_TEMP/check.txt"
|
||||
# bump.sh's output is upstream's text: it goes through files, never into
|
||||
# a script.
|
||||
- name: Open, update or close the issue
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
title="Pinned versions to bump"
|
||||
grep -F ' -> ' "$RUNNER_TEMP/check.txt" > "$RUNNER_TEMP/outdated.txt" || true
|
||||
number=$(gh issue list --state open --search "in:title \"$title\"" --json number,title \
|
||||
--jq "map(select(.title == \"$title\")) | .[0].number // empty")
|
||||
if [[ ! -s $RUNNER_TEMP/outdated.txt ]]; then
|
||||
if [[ -n $number ]]; then
|
||||
gh issue close "$number" --comment "Every pin is up to date: scripts/bump.sh --check lists nothing to bump."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
{
|
||||
echo "scripts/bump.sh --check found pins with a newer upstream version:"
|
||||
echo
|
||||
# Four backticks: a line from upstream can't end the block early.
|
||||
echo '````'
|
||||
cat "$RUNNER_TEMP/outdated.txt"
|
||||
echo '````'
|
||||
echo
|
||||
echo "Bump them with \`scripts/bump.sh TOOL…\` (the tools named above), or \`scripts/bump.sh\` for all."
|
||||
echo "Pin bumps change images, so run the \`--from\` tier of the end-to-end tests before merging:"
|
||||
echo "see [Updating pinned versions](https://devvm.dev/docs/contributing/maintaining/#updating-pinned-versions)."
|
||||
} > "$RUNNER_TEMP/body.md"
|
||||
if [[ -n $number ]]; then
|
||||
gh issue edit "$number" --body-file "$RUNNER_TEMP/body.md"
|
||||
else
|
||||
gh issue create --title "$title" --label enhancement --body-file "$RUNNER_TEMP/body.md"
|
||||
fi
|
||||
@@ -0,0 +1,38 @@
|
||||
name: PR title
|
||||
|
||||
# Pull requests are squash-merged with their title as the commit's subject, so the title follows
|
||||
# Conventional Commits, with the types AGENTS.md lists. pull_request, not pull_request_target: the
|
||||
# check only reads the title through the API with a read-only token and checks out no code.
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: pr-title-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
title:
|
||||
name: Conventional Commits title
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: amannn/action-semantic-pull-request@2252a14e810aa9b85c2d560bd7070c802206ecf6 # v6.1.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
types: |
|
||||
feat
|
||||
fix
|
||||
docs
|
||||
test
|
||||
refactor
|
||||
build
|
||||
ci
|
||||
chore
|
||||
requireScope: false
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
.dex/
|
||||
.claude/
|
||||
/.claude/
|
||||
dist/
|
||||
docs/public/
|
||||
docs/resources/
|
||||
|
||||
+24
-2
@@ -26,17 +26,19 @@ linters:
|
||||
settings:
|
||||
depguard:
|
||||
rules:
|
||||
# The proxy, and the background-process helper it uses: the
|
||||
# standard library alone.
|
||||
# The proxy, and the background-process helper and the file
|
||||
# reader it uses: the standard library alone.
|
||||
proxy:
|
||||
list-mode: strict
|
||||
files:
|
||||
- "**/internal/proxy/**"
|
||||
- "**/internal/daemon/**"
|
||||
- "**/internal/safefile/**"
|
||||
allow:
|
||||
- $gostd
|
||||
- github.com/devvmhq/devvm/internal/proxy
|
||||
- github.com/devvmhq/devvm/internal/daemon
|
||||
- github.com/devvmhq/devvm/internal/safefile
|
||||
main:
|
||||
list-mode: strict
|
||||
files:
|
||||
@@ -44,6 +46,7 @@ linters:
|
||||
- "!$test"
|
||||
- "!**/internal/proxy/**"
|
||||
- "!**/internal/daemon/**"
|
||||
- "!**/internal/safefile/**"
|
||||
allow:
|
||||
- $gostd
|
||||
- github.com/devvmhq/devvm
|
||||
@@ -67,6 +70,7 @@ linters:
|
||||
- $test
|
||||
- "!**/internal/proxy/**"
|
||||
- "!**/internal/daemon/**"
|
||||
- "!**/internal/safefile/**"
|
||||
allow:
|
||||
- $gostd
|
||||
- github.com/devvmhq/devvm
|
||||
@@ -104,6 +108,10 @@ linters:
|
||||
msg: write a file whole through state.WriteFile, or state.WriteFileMode for another mode, which replace it atomically; internal/proxy uses its writeAtomic; a log or a download streamed into its file says why in a nolint.
|
||||
- pattern: ^(os|syscall)\.(Setenv|Unsetenv|Clearenv)$
|
||||
msg: devvm's environment never changes, as every command and process it starts inherits it; set a command's own (exec.Cmd's Env), as a VM's SSH agent is (backend.ExecOpts.Agent). Only daemon.Ready takes its status file out.
|
||||
- pattern: ^unicode\.(IsGraphic|IsPrint|IsControl|Bidi_Control)$
|
||||
msg: ask msg.Safe which characters reach the terminal (msg.Printable and msg.OneLine drop the rest); a check that isn't about the terminal says why in a nolint.
|
||||
- pattern: ^(os\.(Open|OpenFile|ReadFile|OpenRoot|OpenInRoot|DirFS)|os\.Root\.(Open|OpenFile|ReadFile|FS))$
|
||||
msg: read a file a VM can write through internal/safefile (Read, Open, OpenRoot), which never waits on a FIFO or follows a link it wasn't asked to, and reads only a regular file within its cap; what opens a file to write, or a folder, says why in a nolint.
|
||||
nolintlint:
|
||||
require-explanation: true
|
||||
require-specific: true
|
||||
@@ -122,6 +130,10 @@ linters:
|
||||
presets:
|
||||
- std-error-handling
|
||||
rules:
|
||||
# msg.Safe is the one rule for which characters reach the terminal.
|
||||
- path: ^internal/msg/
|
||||
linters: [forbidigo]
|
||||
text: ask msg\.Safe
|
||||
- path: ^cmd/devvm/
|
||||
linters: [forbidigo]
|
||||
text: os\.Exit|context\.(Background|TODO)
|
||||
@@ -168,6 +180,16 @@ linters:
|
||||
- path: ^internal/daemon/status\.go$|_test\.go$
|
||||
linters: [forbidigo]
|
||||
text: devvm's environment never changes
|
||||
# The readers of files a VM can write, or swap, are held to
|
||||
# internal/safefile: the project folder's (devcontainer.json, its
|
||||
# default.nix, .git's), devvm agent save's store, the agents' logins and
|
||||
# the policy files. Tests make their own fixtures.
|
||||
- path-except: ^internal/(gitprotect/|vm/(devcontainer|detect|agentsave[a-z_]*)\.go$|agentlogin/|netpolicy/rules\.go$|proxy/(config|policy)\.go$)|^testdata/lint/
|
||||
linters: [forbidigo]
|
||||
text: internal/safefile
|
||||
- path: _test\.go$
|
||||
linters: [forbidigo]
|
||||
text: internal/safefile
|
||||
paths:
|
||||
- ^\.agents/
|
||||
|
||||
|
||||
@@ -4,42 +4,46 @@ devvm: one isolated VM per project folder, cloned from a base image, with toolch
|
||||
|
||||
## Layout
|
||||
|
||||
Each package's concerns and identifiers: [The packages](docs/content/docs/contributing/structure.md#the-packages).
|
||||
|
||||
| Path | What |
|
||||
| --- | --- |
|
||||
| `cmd/devvm/` | the entry point: `ui.Main` makes the run's UI and runs the root command with it; the only `os.Exit` |
|
||||
| `internal/cli/` | Cobra commands, one file each (root = up, `build`/`rebuild`, `images`, `gc`, `space`, `retention`, `layer` (its new, add and rm), `setup`, `agent` (its import and save; login in `agentlogin.go`), `restart`, `tools`, `adopt`, `rm`, `stop`, `update`, `history`, `ls`, `network` (its rules and log too), `doctor`, `secret`, `link` (its add, rm, publish and unpublish too), `group` (join, leave), `ssh-agent`, `host`, `code`, `desktop`, `limactl`, `ports`, `size`, `git-protect`, `clone`, `completion`, `upgrade`, hidden `version`, `_msg`, `_qemu`, `_proxy`, `_ports` (`forwarder.go`), `_links`, `_refresh-tools`); `app.go`: the run's services, each made once (folders, overrides, secrets, registry, tools, `vmEnv`, `builder`; `a.env` runs a command on the folder's VM); `args.go` checks arguments and flags (usage errors), `flags.go` the flags several commands share, `word.go` refuses devvm WORD and help's unknown words (a part's name points to its flag; did-you-mean over commands, `msg.Closest`); `help.go` the help's groups, `Example`s and docs links (`msg.CommandDocURL`); `json.go`: `--json` (`printJSON`, `"version": 1`), its shapes in `json_test.go`; `script_test.go` runs testscript; `docgen/` writes the CLI reference |
|
||||
| `internal/vm/` | `Env` (`env.go`: shared dependencies, and its parts, each made once by `wire`, which the commands reach, never converting one type to another); the start (`start.go`: `starter.bringUp`, every path's one start, `requirements`, `confinementFor`, `hostChecks`); the finder (`finder.go`: `target` finds the VM a command acts on, as its `need` says; `target.go`: that VM, read once, and what a command does with it; `move.go`: a VM whose folder moved, devvm adopt VM); the inventory (`inventory.go`: every VM's state, backend and list, read in one place, one failure policy); `Launch`: a new VM (`up.go`; `parts.go`: its toolchains, agents and layers, the picker, setup's agents and layers; `detect.go`: what the folder's files call for), an existing one (`existing.go`), `ssh.go`, agents' mounts from devvm's agent store (`agents.go`: `agentStore`, the one reader of `Dirs.AgentSettings`; `secrets.LoginFile` the logins'), `AgentImport` (`agentimport.go`: devvm agent import, the one reader of the home's agent files), `AgentLogin` (`agentlogin.go`: devvm agent login, the agent's login in the VM, its forward, API keys), `AgentSave` (`agentsave.go`: devvm agent save, a VM's settings into the store, after a diff (`linediff.go`) and a yes; `agentsave_read.go`: its fixed list and the checks on the VM's stream); `Lifecycle` (`lifecycle.go`; `remake.go`: the one remake, a VM made again from another image, devvm layer add, devvm layer rm, devvm update and devvm clone; `home.go`: its home folder's copy); `Housekeeping` (`housekeep.go`: images, shared tools, exports and leftovers for devvm images, gc, space and retention); `Exports` (`exports.go`: the exports of agents' history, their `.folder` files, `Newest`); `Tools` (`tools.go`: a VM's shared tools); `Settings` (`settings.go`, `size.go`, `ports.go`, `sshagent.go`); `Net` (`network.go`, `secret.go`); `Links` (`links.go`: links between VMs, published ports), `Groups` (`groups.go`: the links a group makes); `--clone` (`clone.go`: the clone, rm's check, devvm clone's switch); a devcontainer.json's mapping and commands (`devcontainer.go`); the setup it sends (`sync.go`) |
|
||||
| `internal/shell/`, `internal/vmname/` | stdlib leaves: quoting for a POSIX shell (`Quote`, `QuoteJoin`) and its variables' names (`EnvName`); a project VM's name grammar (`Prefix`, `HashLen`, `IsVM`, `HashOf`, `SlugOf`, a remake's `Aside`) |
|
||||
| `internal/project/`, `internal/gitprotect/`, `internal/hostsafety/`, `internal/hostgit/` | a project folder (VM name, link targets, unsafe folders, parents); `.git` protection; the folder's other host checks (set-id files, skipping `.git`, once stopped; an SSH origin); every host git command devvm runs (no fsmonitor, hooks or filters, ssh only, no `GIT_*` of the environment, no prompts) |
|
||||
| `internal/sshconfig/`, `internal/sshagent/` | the ssh config for running VMs by name, the `~/.ssh/config` Include line; each VM's SSH agent choice, devvm's own agent and its keys |
|
||||
| `internal/build/`, `internal/image/` | building and rebuilding images, their records; image keys and names (pure) |
|
||||
| `internal/fetch/` | every HTTP client (stdlib): `NewClient` (timeout, `HTTPSOnly`/`SameScheme`), `Retry`/`Transient`, `ReadCapped`, `Get`, `Resolve` (where a HEAD's redirects end), `Download` (checks the SHA-256, capped) |
|
||||
| `internal/upgrade/` | devvm upgrade: how this devvm was installed (`Detect`), the releases (`Source`: the newest, `Check` for a notice, `Fetch`: minisign's `ED` signature by the built-in key, then the SHA-256), the unpack, the link's switch and rollback, brew; `upgradetest/` (tests only: a TLS release server, a minisign signer) |
|
||||
| `internal/from/` | `--from`: references, registry digests (anonymous token), Docker's IDs, the recorded digests |
|
||||
| `internal/redact/` | passwords out of logs (stdlib): `String` (the run log's lines: proxy keys, URL passwords), `File` (another program's log, in place, its length kept) |
|
||||
| `internal/devcontainer/`, `internal/jsonc/` | a project's devcontainer.json (pure): finding it, mapping it to a new VM's plan, refusals, what devvm update's reading again replaces (`Reread`); JSON with comments (`jsonc.Strip`, stdlib) |
|
||||
| `cmd/devvm/` | the entry point (`ui.Main`); the only `os.Exit` |
|
||||
| `internal/cli/` | the command line: one file per Cobra command, the run's services (`app.go`), argument checks, help, `--json`, the CLI tests, `docgen/`; `doc.go` maps it |
|
||||
| `internal/vm/` | what each command does to a folder's VM, below the command line; `doc.go` maps the package and its owners |
|
||||
| `internal/shell/`, `internal/vmname/` | quoting for a POSIX shell; a project VM's name grammar |
|
||||
| `internal/project/`, `internal/gitprotect/`, `internal/hostsafety/`, `internal/hostgit/` | a project folder; `.git` protection; the folder's other host checks; every host git command devvm runs |
|
||||
| `internal/sshconfig/`, `internal/sshagent/` | the ssh config for running VMs by name; each VM's SSH agent and devvm's own |
|
||||
| `internal/build/`, `internal/image/` | building images and their records; image keys and names, and the shared tools' registry (`SharedTools`) |
|
||||
| `internal/fetch/` | every HTTP client |
|
||||
| `internal/upgrade/` | devvm upgrade; `upgradetest/` (tests only) |
|
||||
| `internal/from/` | `--from`'s references and digests |
|
||||
| `internal/redact/` | passwords out of logs |
|
||||
| `internal/safefile/` | every read of a file a VM can write or swap |
|
||||
| `internal/devcontainer/`, `internal/jsonc/` | a project's devcontainer.json; JSON with comments |
|
||||
| `internal/tools/` | the shared tools: the lock, host mise, the daily check, tool image builds, the share |
|
||||
| `internal/netpolicy/`, `internal/secrets/` | network policy (the choice, the VM's proxy, the self-check); tokens on the host and the VM's bindings |
|
||||
| `internal/trust/` | the user's CAs (`~/.config/devvm/ca`): read and checked, sent to VMs, build VMs' `Trust` scripts, the guest environment; each VM's own CA and its next (`InitCA`, in `vms/<hash>/run/ca/`) |
|
||||
| `internal/agentlogin/` | agents' login and settings files on the host: the VM's copies with placeholders, bindings, values and OAuth refresh (`File`), `Redact`, and `Restore`, which puts the store's values back for a VM's placeholders |
|
||||
| `internal/netpolicy/`, `internal/secrets/` | network policy; tokens on the host, the VM's bindings and your own secrets |
|
||||
| `internal/trust/` | your CAs, and each VM's own CA |
|
||||
| `internal/agents/` | the coding agents' registry: one `Def` each, which every list of the agents derives from |
|
||||
| `internal/agentlogin/` | agents' login and settings files on the host, and their placeholders |
|
||||
| `internal/proxy/` | the proxy, run as `devvm _proxy`; see its `README.md` |
|
||||
| `internal/daemon/` | devvm's background processes (stdlib only): detached starts, pid files checked against the process's arguments, stopping (TERM, then KILL), readiness by status file, the lifeline; the only place a process is signalled by pid (forbidigo) |
|
||||
| `internal/desktop/` | devvm desktop's relay on the host: VNC's password checked here, then an ssh channel to the VM's socket, the viewer's clipboard dropped; passwords |
|
||||
| `internal/backend/` | `Backend` and its roles, `Caps`, `Require`, `Check`, the registry and its guard (`As`); `backendtest/` (fake), `registry/` (every backend's), `lima/` |
|
||||
| `internal/vmssh/` | devvm's own over a VM's ssh, on every backend: `Checked`, the one way to a VM's ssh (the review, the backend's `SSH` checked by `FromTarget`, its host keys read or pinned; `UnusableError`, `ErrNoHostKeys`), the port forwarder and its one owner (`Forwards`: lock, stop, start, its ports from vm.json), a login's forward of this machine's loopback ports in devvm's own process (`ForwardLoopback`), links' sessions, each VM's one host-key record per start (`PinHostKeys`, `vms/<hash>/run/known_hosts`) that every ssh of devvm's checks |
|
||||
| `internal/ui/` | the only package that prints: `ui.UI` (messages, prompts, status line, run log, cleanups), `ui.Main` (signals); no package state |
|
||||
| `internal/msg/`, `locales/` | messages: `en.toml`, the generated functions, doc links (`docs.go`), the generator (`gen/`); `Reporter` (`reporter.go`: what every package prints and asks through, `*ui.UI` its one implementation, `Fake` the tests'); `Question` (`question.go`: a question and what answers it, `AnsweredBy`/`RefusedWith`; where devvm can't ask, its `Refusal` is the prompt's error) |
|
||||
| `internal/ports/` | a VM's ports section (forwards asked for, host ports chosen) and the one allocator of host ports, under the claims lock |
|
||||
| `internal/paths/`, `internal/state/` | every folder and file devvm uses, a VM's in its folder (`Dirs.VM`: `vms/<hash>/`), host paths resolved and compared (`Physical`, `PhysicalParent`, `Within`, `Below`: `resolve.go` says which for what); a VM's state, `vm.json` (core fields, one section per package, changed only in `VM.Update` under the VM's lock); the layout version (`CheckLayout`, `migrations`; `testdata/script/layout.txtar` lists every file); every file written whole (`WriteFile`, `WriteFileMode`: forbidigo bans `os.WriteFile`, `os.Create` and `O_TRUNC` elsewhere but the proxy), private folders (`PrivateDir`) |
|
||||
| `internal/settings/` | the defaults (`Defaults`, `Read`, `Save`): `config.toml` (yours, strict) over `settings.json` (devvm's), each value's check (`ParsePorts`, `ParseCPUs`, `ParseGiB`, the retention settings) |
|
||||
| `internal/platform/`, `internal/ubuntu/`, `internal/testbuild/` | build-tagged OS code; finding and verifying Ubuntu's cloud image (never downloads); whether this is a test build (ldflags: only it reads the test overrides, `cli`'s `readOverrides`) |
|
||||
| `assets/` | the files devvm ships, embedded (`assets.FS`, passed to constructors by `cli`): `base.yaml`, `prelude.sh` (`$devvm_arch`, `$devvm_libc`, `devvm_sha`: first in each build script run with bash, read through `image.OwnScript`), `layers/` (base's Lima template and scripts; the built-in layers, `desktop`, `docker` and `nix`, each with its policy), `features/` (base's optional ones), `shared-tools/` (`mise.toml`, `build.sh`, `*.policy`), `guest/` (in-VM scripts sent on every launch, and the port forwarder's `ports.sh`), `oci/` (`--from`'s conversion; see its `README.md`) |
|
||||
| `internal/structure/` | the structure test (tests only) |
|
||||
| `internal/stubtest/` | the test stubs (tests only): `stub/`, one Go binary for every host command, dispatched on `argv[0]` (each stub's comment lists its switches; `guest.go`, the VM behind limactl shell and ssh; `stub`, scripts' commands on its state), built once into `$TMPDIR/devvm-stubs-<hash>`; `stubstate/`, their typed JSON state under a lock; `stubtest` puts them on `PATH`: their folder, calls, files and state, `ExecRunner`; `msg.Fake`, `msg.Recorder`, `msg.IDOf` and `msg.NamesOf` are tests' too, `backendtest.Stored` a fake with disks |
|
||||
| `testdata/` | `script/*.txtar` (CLI tests), `golden/<os>/` (what the real tools printed, `mise run e2e -- --golden`; the stubs and devvm's parsers are checked against it), `mise.lock` (fixture), `coverage/<os>.txt` (each package's coverage baseline, per system), `lint/` (a line breaking each forbidigo rule, which `lint:code` checks) |
|
||||
| `tests/e2e/`, `tests/e2e-mise.lock` | end-to-end tests on real VMs (Go, tag `e2e`, a file per section; `TestE2E` is the run, `mise run e2e -- FLAGS`; the sandbox, slots, locks and `e2eUbuntuRelease` in `sandbox_test.go`); the shared tools' versions every section but `tools` uses (`scripts/bump.sh e2e-tools`) |
|
||||
| `scripts/`, `packaging/`, `.goreleaser.yaml`, `VERSION`, `CHANGELOG.md` | `bump.sh` (pins), `release.sh` (signed-tag checks around GoReleaser, then minisign), `publish.sh` (the release: checks, release.sh, one yes, then pushes, `gh release` and the tap), `test.sh` and `coverage.sh` (mise's test tasks); the Homebrew formula; `packaging/key.go` embeds the folder, so devvm upgrade's key is `minisign.pub`'s (none without it); `VERSION` is read by the scripts only |
|
||||
| `install.sh` | `curl \| bash`: the host's archive (the binary, README, changelog, license), checked, into `~/.local/lib/devvm/<version>`, then doctor's fixes, asking first; tests source it (`DEVVM_INSTALL_TEST`) |
|
||||
| `internal/daemon/` | devvm's background processes; the only place a process is signalled by pid |
|
||||
| `internal/desktop/` | devvm desktop's relay on the host |
|
||||
| `internal/backend/` | `Backend`, its roles, `Caps`, the registry and its guard; `backendtest/`, `registry/`, `lima/` |
|
||||
| `internal/vmssh/` | devvm's own ssh to a VM (`Checked`), the port forwarder (`Forwards`), each start's host keys |
|
||||
| `internal/ui/` | the only package that prints |
|
||||
| `internal/msg/`, `locales/` | messages, `Reporter` and `Question` |
|
||||
| `internal/ports/` | a VM's ports and the one allocator of host ports |
|
||||
| `internal/paths/`, `internal/state/` | every folder and file devvm uses; `vm.json`, the layout version, files written whole |
|
||||
| `internal/settings/` | the defaults: `config.toml` over `settings.json`, each value's check |
|
||||
| `internal/platform/`, `internal/ubuntu/`, `internal/testbuild/` | build-tagged OS code; Ubuntu's cloud image (never downloads); whether this is a test build |
|
||||
| `assets/` | the files devvm ships, embedded (`assets.FS`) |
|
||||
| `internal/structure/` | the structure test |
|
||||
| `internal/stubtest/` | the test stubs |
|
||||
| `testdata/` | CLI tests, golden fixtures, coverage baselines, each release's frozen state (`v<release>/`), `lint/` |
|
||||
| `tests/e2e/`, `tests/e2e-mise.lock` | end-to-end tests on real VMs |
|
||||
| `scripts/`, `packaging/`, `.goreleaser.yaml`, `VERSION`, `CHANGELOG.md` | pins, releases, the test tasks' scripts, the Homebrew formula, devvm upgrade's key |
|
||||
| `install.sh` | `curl \| bash`, asking before doctor's fixes |
|
||||
| `docs/` | the docs site (Hugo + Hextra); `content/docs/cli/` is generated, never edit it |
|
||||
| `mise.toml`, `.golangci.yml`, `.vale*`, `.markdownlint-cli2.yaml`, `.github/` | tools, tasks, linters, CI and Pages |
|
||||
| `.agents/skills/security-audit/` | the security-audit skill, for backend reviews |
|
||||
@@ -48,7 +52,7 @@ devvm: one isolated VM per project folder, cloned from a base image, with toolch
|
||||
|
||||
## Tasks
|
||||
|
||||
`mise run <task>`: `fmt`; `lint` (`lint:code`: Go, shellcheck, workflows with actionlint and zizmor; `lint:docs`: docs, `TestDocLinks`, `TestCommandLines`); `test` (`scripts/test.sh`: `-race`, in a throwaway `HOME`; needs a C compiler; then each package's coverage, unit and CLI tests merged, against `testdata/coverage/<os>.txt`); `coverage` (the same, then raises the baselines it beat: commit them with the change); `vuln`; `deadcode` (lists only `backendtest`, `stubtest`, `upgradetest`, `msg.IDOf`, `msg.NamesOf`, `msg.Recorder` and `msg.Fake`, which tests use; anything else gets a caller or goes); `cli-docs` (after changing any command's `Use`, `Short`, `Long` or flags; commit the pages); `docs` (serves `http://localhost:1313/`); `e2e`.
|
||||
`mise run <task>`: `fmt`, `lint` (`lint:code`, `lint:docs`), `test`, `coverage` (commit the baselines it raised with the change), `vuln`, `deadcode` (anything but the tests' helpers gets a caller or goes), `cli-docs` (after changing a command's help, flags or docs page; commit the pages), `docs`, `e2e`: [Tools and tasks](docs/content/docs/contributing/_index.md#tools-and-tasks).
|
||||
|
||||
## Rules
|
||||
|
||||
@@ -57,87 +61,78 @@ devvm: one isolated VM per project folder, cloned from a base image, with toolch
|
||||
- **devvm's own files never get a shared copy on disk:** the proxy reads them from the binary, base.yaml and scripts go on stdin, `--from`'s build writes its scripts into its own temp folder.
|
||||
- **Credentials never go into images.** Host agent history never goes into VMs.
|
||||
- **Never auto-delete project VMs:** they may hold unsaved work. Warn instead.
|
||||
- **Every release's state keeps working** until 1.0: a change to state runs its new commands on every frozen `testdata/v<release>/` fixture (never edited or regenerated) in the same commit, and a change for existing state gets a Breaking changelog entry ([Released state](docs/content/docs/contributing/structure.md#released-state)).
|
||||
- **The startup check only reports.** Never install host software without asking.
|
||||
- **Image keys hash everything that goes into an image**, the backend included. A tool image's key is its lock entry, `assets/shared-tools/build.sh` after the prelude, `shared-tools/mise.toml`'s `[settings]`, the mise `layers/base.sh` pins (not rust's), the libc and the base it builds in: devvm's own Ubuntu base for gnu, the only one gnu ones build in, and for musl its `--from` base's digest (`Share.Build` checks the base's record).
|
||||
- **Image keys hash everything that goes into an image**, the backend included; a tool image's key is in [Building tools](docs/content/docs/internals/images.md#building-tools).
|
||||
- **Pin every download** in `assets/`'s `layers/`, `features/`, `shared-tools/build.sh`, `oci/build.sh`: `<tool>_version` and `<tool>_sha256_arm64`/`_amd64` at the top, picked with the prelude's `devvm_sha`, fetched with `devvm-fetch` (`oci/build.sh`: `sha256sum`). No `curl | sh`, no "latest". Upstream-checked exceptions: shared tools (`MISE_LOCKED=1`), Ubuntu's signed `SHA256SUMS`, Lima in `install.sh`. Go checks a download's SHA-256 before use.
|
||||
- **Shared tools are read-only in VMs:** whatever writes into a tool's folder (global installs, self-updates, `corepack enable`, `rustup component add`) is redirected (`~/.npm-global`, `go_set_gobin = false`), done in `assets/shared-tools/build.sh`, or off.
|
||||
- **In-VM scripts are bash 3.2-safe and shellcheck-clean** (`assets/`, `install.sh`): guard empty arrays (`${a[@]+"${a[@]}"}`), no associative arrays. Everything else is Go.
|
||||
- **Docs:** an easy-to-follow guide in full, joined sentences, every fact kept; write and edit prose with the docs-voice skill (Vale's `devvm.AIWords` fails on chatbot vocabulary). Every behavior change updates its page in `docs/content/docs/` in the same task. The README stays high level.
|
||||
- **Docs:** an easy-to-follow guide in full, joined sentences, every fact kept, written with the docs-voice skill; every behavior change updates its page in the same task, and the README stays high level ([Writing docs](docs/content/docs/contributing/docs.md#writing-docs)).
|
||||
- **Adding or changing a command** follows the cli skill (`.agents/skills/cli/`): its checklist, then its review.
|
||||
- **Adding or changing a shared tool** updates its page: `using/toolchains.md` for a toolchain, `using/coding-agents.md`'s Supported agents for an agent.
|
||||
- **Docs by reader:** user pages (`getting-started/`, `using/`, `safety/`, `backends/`) say what devvm does and what you type, without repo paths, Go identifiers or message names; How it works (`internals/`) explains mechanisms; Contributing (`contributing/`) has repo paths and Go identifiers.
|
||||
- **Extend the owner, don't copy it:** before adding a helper, parser, path, file reader, message or table, find its owner and extend it; a new owner gets a forbidigo rule or a structure-test check only when a second copy would be a bug ([Contributing](docs/content/docs/contributing/_index.md#one-owner-for-each-concern)).
|
||||
- **Adding or changing a shared tool** updates its page and follows Contributing's checklist: `using/toolchains.md` for a toolchain ([Adding a toolchain](docs/content/docs/contributing/extending.md#adding-a-toolchain)), `using/coding-agents.md`'s Supported agents for an agent ([Adding a coding agent](docs/content/docs/contributing/extending.md#adding-a-coding-agent)).
|
||||
- **Docs by reader:** user pages name no repo paths, Go identifiers or message names; How it works explains mechanisms; Contributing has the paths and identifiers ([Writing docs](docs/content/docs/contributing/docs.md#writing-docs)).
|
||||
- **Extend the owner, don't copy it:** before adding a helper, parser, path, file reader, message or table, find its owner and extend it; a new owner gets a forbidigo rule or a structure-test check only when a second copy would be a bug ([Contributing](docs/content/docs/contributing/structure.md#one-owner-for-each-concern)).
|
||||
- **Edit files with the editor tools,** not `sed`, `awk`, `python`, heredocs or `cat >`.
|
||||
- **Ask first** before anything outward-facing (publishing, releases, repos, pushing) and before deleting anything you didn't create.
|
||||
- **A task that turns out wrong or incomplete** gets a proposed change (`dex edit`), not quietly something else.
|
||||
- **A task that turns out wrong or incomplete:** say so and propose the change; don't quietly do something else.
|
||||
|
||||
## Go conventions
|
||||
|
||||
- **Only `internal/ui` prints.** forbidigo bans `fmt.Print*`, `os.Stdout`/`os.Stderr` elsewhere and `os.Exit` outside `cmd/devvm`. Data goes to the UI's `Stdout()`, non-message log lines to its `Stderr()`.
|
||||
- **Functions take their caller's `ctx`:** forbidigo bans `context.Background`/`TODO` outside `internal/ui` and `cmd/devvm`; one that must outlive its caller's gets `//nolint:forbidigo // why`.
|
||||
- **Every `//nolint` names its linters and says why** (nolintlint). Functions stay within revive's `function-length` and `cognitive-complexity` limits: split one that grows past them.
|
||||
- **Fail by returning:** `RunE` returns the error, as `failed(err, msg.XFailed)` when it may not be a message; `execute` alone prints it (`showFailure`: a `LoggedError` with the log's end via `ErrorLogged`, a message as it is, else `what`) and returns 1, then `ui.Main` runs the cleanups. Only the UI ends a run itself (`die`: no run log). INT/TERM/HUP cancel the root context, wait for the logged command, then, with cleanups to run, up to 2 s for the command to return (`returnGrace`; not while it waits at a question, whose answer after a signal is refused), run the cleanups and return 130; a second signal is ignored; after one, failures print nothing. A logged command a signal ended (or 128+) waits up to 1 s for devvm's own interrupt, as Ctrl+C can end it first.
|
||||
- **Only `cmd/devvm` and `internal/cli` import `internal/ui`** (the structure test's layers): cli passes the run's `app` (its `*ui.UI` and services) to each command; other packages embed the one `msg.Reporter` (messages, prompts, status line, run log, cleanups), which their constructors take and cli gives them, or cli asks first and passes the answer in; a package's own `Warn` that says where the run log is too (Lima's, the shared tools') is a method over it.
|
||||
- **Arguments and flag values are checked before anything runs**, in `Args` (`noArgs`, `exactArgs`… from `args.go`, never Cobra's; values with `cobra.MatchAll`), `checkFlagValue` and `exclusive`: a usage error exits 2 and names the command's --help. Exit codes: 0, 1, 2, 130.
|
||||
- **Only `internal/ui` prints, functions take their caller's `ctx`, and every `//nolint` names its linters and says why;** functions stay within revive's limits ([Go lint rules](docs/content/docs/contributing/_index.md#go-lint-rules)).
|
||||
- **Fail by returning:** `RunE` returns the error and `execute` alone prints it; signals, exit codes and the run log: [CLI conventions](docs/content/docs/contributing/cli.md#cli-conventions).
|
||||
- **Only `cmd/devvm` and `internal/cli` import `internal/ui`;** other packages print and ask through the one `msg.Reporter` their constructors take ([Messages](docs/content/docs/contributing/cli.md#messages)).
|
||||
- **Arguments and flag values are checked before anything runs**, with `args.go`'s checks, never Cobra's; a usage error exits 2 ([Command arguments](docs/content/docs/contributing/cli.md#command-arguments)).
|
||||
- **Cleanups:** whatever a failure would leave (a build VM, a temp file) registers with the UI's `AddCleanup` and is removed once done; one only for interrupts checks `Interrupted()` and stays once interrupted, as the cleanups run after the command returns. Cleanups get a fresh context.
|
||||
- **External commands run with the UI's `LoggedCmd(ctx, step, cmd)`** (a backend's `Runner`): output to the run log, a failure after one returned as `backend.Logged(m)`. `WithSteps(ctx, n)` numbers steps.
|
||||
- **External commands run with the UI's `LoggedCmd(ctx, step, cmd)`**, a failure after one returned as `backend.Logged(m)` ([CLI conventions](docs/content/docs/contributing/cli.md#cli-conventions)).
|
||||
- **OS-specific code goes behind build tags** in `internal/platform` (`*_darwin.go`, `*_linux.go`, `*_other.go`).
|
||||
- **Dependencies:** the depguard allowlist (cobra, pflag, cobra/doc, go-i18n, BurntSushi/toml, x/text, x/term, x/sys, x/crypto's `blake2b` only (minisign's prehash); go-internal in tests; cobra/doc's own deps never imported directly). `internal/proxy` and `internal/daemon` are stdlib only. Adding one: ask.
|
||||
- **Dependencies:** the depguard allowlist (cobra, pflag, cobra/doc, go-i18n, BurntSushi/toml, x/text, x/term, x/sys, x/crypto's `blake2b` only (minisign's prehash); go-internal in tests; cobra/doc's own deps never imported directly). `internal/proxy`, `internal/daemon` and `internal/safefile` are stdlib only. Adding one: ask.
|
||||
- **External tools are commands, never linked** (`limactl`, `docker`, `security`, `git`, `chflags`…); prefer the standard library to shelling out. Strings into a shell are quoted with `shell.Quote`.
|
||||
- **Test seams are fields** tests set (`Host`, `Exec`, `Runner`, `OS`, `Reporter`…), never package vars (reassign: no package sets another's); `internal/proxy`'s are its `server`'s, which each test makes.
|
||||
- **The structure test** (`internal/structure`, in `mise run test`) holds types to 24 methods, bans `func init`, allows only constants' kin as package vars, checks the package layers and the owners (host git only in `internal/hostgit`; `DEVVM_` variables only in `readOverrides` and the listed settings; `HOME` only in `internal/paths`, as `Dirs.Home`; shell quoting only in `internal/shell`, the VM-name grammar only in `internal/vmname`, `state.ReadHash` and `project.Parents` only in the finder, `state.ReadAll` only in the inventory, `Dirs.AgentSettings` only in `vm/agents.go` and `Dirs.AgentLogins` only in `secrets/secrets.go`): see [Contributing](docs/content/docs/contributing/_index.md#the-structure-test) before raising a limit or listing an exception.
|
||||
- **The structure test** holds types to 24 methods, bans `func init`, limits package vars, checks the layers and keeps each concern in its owner (its failure names the owner: extend that); read [The structure test](docs/content/docs/contributing/structure.md#the-structure-test) before raising a limit or listing an exception, and regenerate [the checks on owners](docs/content/docs/contributing/structure.md#the-checks-on-owners) after changing its tables (`go test ./internal/structure -run TestOwnersDoc -update`).
|
||||
- **The CLI reference is generated:** `TestReferenceIsCurrent` fails on a stale one (`mise run cli-docs`).
|
||||
- `CGO_ENABLED=0`. `internal/proxy` and `internal/daemon` are unix-only for now (`syscall.Kill`, `Setsid`, `Flock`).
|
||||
|
||||
## Backends
|
||||
|
||||
- Every backend implements `backend.Backend` and declares `Caps` per feature: native, emulated (reviewed) or none. A new `Feature` goes in `backend.Features` and the table in `docs/content/docs/internals/backends.md`.
|
||||
- **`backend.Backend` is `Name`, `Caps` and four roles**, `Host`, `Images`, `Machines`, `Housekeeping`, all required; a backend's type splits the same way (Lima's `host`, `images`, `machines`, `housekeeping`). The one optional role, `Forgetter`, is found with `backend.As`.
|
||||
- **A missing feature fails** in one line naming the VM and what to do; never fall back silently. Callers check the registry's `Review.Require(b, vm, spec.Features()...)` first, and its guard refuses the rest (it has every role's methods); backends don't decide what a VM needs.
|
||||
- **A backend implements `backend.Backend`'s four roles, declares `Caps` for every feature and returns errors, never ending the run:** [How a backend plugs in](docs/content/docs/contributing/extending.md#how-a-backend-plugs-in); a new `Feature` goes in `backend.Features` and [the feature table](docs/content/docs/internals/backends.md#the-feature-table).
|
||||
- **A missing feature fails, naming the VM and what to do; never fall back silently** ([Missing and unreviewed features](docs/content/docs/internals/backends.md#missing-and-unreviewed-features)).
|
||||
- **Every emulation is refused until reviewed:** a design note in `docs/content/docs/internals/design.md`, a threat check with the security-audit skill, and e2e checks proving the guarantee; then it's marked reviewed in `Caps`.
|
||||
- Backend-specific code stays in its package; what isn't (`.git` protection, the proxy) stays out.
|
||||
- **Backends return errors, they don't die:** a `msg.M`, or `backend.Logged(m)` after a logged command failed. A stopped VM changes only at `Start`, which applies what its `Want` asks where it differs (`backend.Validate` first); a running one is left as it is; restart warnings are the callers'. Ports are never the backend's: `vmssh.Forwards` forwards over its `SSH`, which `vmssh.FromTarget` checks.
|
||||
- **Lima edits only what differs:** any `limactl edit` gives the VM new ssh host keys at its next boot, so `Start` compares first and makes one edit. `Start` owns `env:`, `propagateProxyEnv`, `dns` and `hostResolver`, and a project VM's size, agent mounts and `forwardAgent`.
|
||||
- **Lima edits only what differs:** any `limactl edit` gives the VM new ssh host keys at its next boot, so `Start` compares first and makes one edit ([What devvm sets on a VM](docs/content/docs/internals/lima.md#what-devvm-sets-on-a-vm)).
|
||||
|
||||
## Messages
|
||||
|
||||
- **Messages use the docs voice**, only shorter: the docs-voice skill's Messages and Terms rules.
|
||||
- **Every message lives in `locales/en.toml`**, called through its generated function (`msg.NoVM(dir)`); `go generate ./internal/msg` after editing. Only go-i18n's fields (`other`, `one`, `description`); snake_case plain template fields (`{{.vm_name}}`); `one` makes it plural (`count int`). Doc links go in `internal/msg/docs.go`. A message without a caller fails the tests. `msg.M` is an `error`. Never build prose with `fmt`. Message values render on one line without control or bidi characters (`msg.OneLine`, at render); a VM's text shown as data goes through `msg.Printable`. A message made from an error carries it (`.Because(err)`), not only `err.Error()`.
|
||||
- **Every question declares what answers it** (`msg.X().AnsweredBy("--force")` or `.RefusedWith(msg.Y())`); `Ask`/`Confirm`/`Answer`/`Secret` return its refusal where devvm can't ask (no terminal, `--no-input`, end of input), which callers return or fall back on, never checking for a terminal. The CLI tests answer with `ttyin` or `DEVVM_PIPED_ANSWERS=1`.
|
||||
- An error or warning is at most two sentences; a prompt gets at most two lines of context.
|
||||
- **The mechanism goes in the doc link**, not the message: every warning or error the user can act on has one.
|
||||
- Status steps stay a few words, lowercase. Commands are written as devvm x, not quoted. No "please", "note that" or "simply". `[y/N]`/`[Y/n]` stay literal.
|
||||
- Not messages: data output and text in scripts that run elsewhere.
|
||||
- **Tests check which message and with what, never its wording:** `DEVVM_MESSAGES=names` prints `no_vm dir=/x`; `devvm _msg NAME k=v…` gives e2e the text.
|
||||
- **Every message lives in `locales/en.toml`**, called through its generated function (`go generate ./internal/msg` after editing), with its doc link in `internal/msg/docs.go`; prose is never built with `fmt` ([Messages](docs/content/docs/contributing/cli.md#messages)).
|
||||
- **Every question declares what answers it** (`AnsweredBy`, `RefusedWith`), and callers never check for a terminal ([Questions](docs/content/docs/contributing/cli.md#questions)).
|
||||
- **Messages use the docs voice, only shorter:** the docs-voice skill's [Messages](.agents/skills/docs-voice/SKILL.md#messages) and Terms rules; the mechanism goes in the doc link.
|
||||
- **Tests check which message and with what, never its wording** ([Names mode](docs/content/docs/contributing/cli.md#names-mode)).
|
||||
|
||||
## Testing
|
||||
|
||||
- **Unit tests** are Go table tests next to the code; **CLI tests** are testscript against the built binary in a `/tmp` sandbox in names mode, stubs first on `PATH` (`stub_calls`, `stub_reset`), with `project`, `vm_name`, `catg`, `vm_state`, `json_set` and `$DATA`/`$VMS`/`$RUN`/`$CFG`; the binary has `assets/` embedded (no override: scripts read `$DEVVM_REPO/assets/`; rebuild before a manual run after editing them). New logic needs a test. Neither touches the Keychain, real VMs or the user's folders; state-writing tests point the XDG folders at `t.TempDir()`. Go tests never run up: scripts do.
|
||||
- **New logic needs a test:** Go table tests next to the code, and CLI tests (testscript against the built binary and the stubs); neither touches the Keychain, real VMs or your folders ([Tests](docs/content/docs/contributing/tests.md)).
|
||||
- **Never touch VMs, images or containers devvm's tests didn't make:** your own stay as they are. Manual runs: `DEVVM_LIMA_HOME=~/.lt LIMA_HOME=~/.lt XDG_DATA_HOME=/tmp/x/data XDG_CONFIG_HOME=/tmp/x/config DEVVM_SECRET_SERVICE=devvm-sandbox-test` (devvm's Lima home is `$XDG_DATA_HOME/devvm/lima` unless `DEVVM_LIMA_HOME`; `LIMA_HOME` is for your `limactl`). Add a `config.toml` with `features = []` and pass `--network TIER` so nothing prompts. Delete test Keychain items. Never use your own tokens or logins: a network-policy VM reads its agent's login file from `HOME`, so give it its own (the Keychain needs the real `HOME`: test it apart).
|
||||
- **End-to-end:** `mise run e2e -- FLAGS` (`--only`, `--from`, `--clean`, `--slots`, `--golden`…) builds devvm from the checkout and drives real VMs in its sandbox (`~/.lt-e2e-go`, `/tmp/devvm-go-e2e`, service `devvm-go-e2e`), deleting only what it made; images stay cached (`--clean`). `--slots N` spreads the sections over N sandboxes at once (slot K's paths end `-K`, its ports +100·K, its images cloned from slot 0's). Only `tools` resolves the newest tool versions; the rest use the pinned lock, and `--from` images go by pinned digest but one tag (`scripts/bump.sh e2e-tools e2e-from`). Run it in the background. Sections: `images`, `project`, `clone` (a throwaway repo, its own `HOME`), `gc` (an `img-*` folder's VM, a stale fixture), `tools` (a node VM), `network` (a VM with Claude Code, Codex and opencode), `desktop` (a base VM refused, then the desktop layer, devvm desktop), `nix` (a node VM with the nix layer and a flake), `from` (Debian 12, Alpine and Ubuntu bases, a docker that isn't running), `link` (two targets and a client, then the three in a group, the design note's threat check). Tiers: none (all but `desktop` and `from`, no features); `--from` (everything, every feature; before merging `assets/` or `--from` changes); `--only a,b` (with `from`: every feature). Hosted CI can't run it on macOS.
|
||||
- **Linux hosts:** `LIMA_HOME=~/.lt-linux-go`, VM `linuxhost` (nested virtualization, the repo read-only, copied to `~/devvm`), set up as [testing.md](docs/content/docs/contributing/testing.md) says, apart from any Lima home of your own.
|
||||
- **Unreviewed emulations** are checked through `DEVVM_UNREVIEWED=backend:feature`, which only test builds (e2e's, the CLI tests', by ldflags) read.
|
||||
- **End-to-end:** `mise run e2e -- --only SECTIONS` in the background for what changed, `--from` before merging `assets/` or `--from` changes ([End-to-end tests](docs/content/docs/contributing/tests.md#end-to-end-tests)).
|
||||
- **Linux hosts:** `LIMA_HOME=~/.lt-linux-go`, VM `linuxhost`, set up as [Linux hosts](docs/content/docs/contributing/testing.md#linux-hosts) says, apart from any Lima home of your own.
|
||||
- **Unreviewed emulations** are checked through `DEVVM_UNREVIEWED=backend:feature`, in test builds only ([Unreviewed emulations](docs/content/docs/contributing/testing.md#unreviewed-emulations)).
|
||||
- **Delete test VMs and temp files afterwards.** Long builds run in the background. Tests that `chflags` real files unlock them (`chflags -R nouchg`), only in their own temp folders.
|
||||
- **The testscript runner stops the sandbox's proxies** (`pkill -f` on `_proxy -config` in the sandbox): the stub hostagent is gone before they look, so they'd wait 15 minutes.
|
||||
- **The testscript runner stops the sandbox's proxies** (`pkill -f` on `_proxy -config` in the sandbox): the stub hostagent is gone before they look, so they'd wait 15 minutes. It also stops the sandbox's port forwarders, link sessions and stub ssh masters.
|
||||
- **`limactl shell` reads stdin:** give it none unless the input is meant for it.
|
||||
- **Boot problems:** read `<devvm's Lima home>/<vm>/serialv.log` before restarting; every start overwrites it.
|
||||
|
||||
## Gotchas learned
|
||||
|
||||
- **Lima `vz`:** raw disks only; clones are APFS copy-on-write (`du` overcounts). Direct kernel boot needs an uncompressed arm64 `Image`. Stopping sends a GPIO power key, so guests need `gpio_keys`, or Lima hard-kills them after 30 s. Lima can't shrink disks. virtiofs tags are `lima-<hash>`. The project mount is `/.vol/<dev>/<ino>` at its path; vz serves a share by the path it had at the start, so a rename while it runs gives "Operation not permitted". After root touches a directory on a virtiofs mount, the guest sees it as root's for a few seconds (git: "dubious ownership"). `mounts: []` doesn't remove the home mount from `base: template:…`: pass `--mount-none` (or `--mount-only`) to `limactl create`/`clone`.
|
||||
- **Lima can report a failed start for a VM that is running but degraded.** Starting tolerates it.
|
||||
- **`limactl list --json` fills in the config:** mounts get `mountPoint`, port forwards a `guestIP` (`127.0.0.1`) and host side; compare only what devvm set. `--set` applies after `--mount-none`. `limactl create` downloads the image at once (no dry run).
|
||||
- **`limactl shell` quotes each argument for the guest's shell**, so `Exec` passes `sh -c` and one `shell.QuoteJoin` string. QEMU's guestfwd command goes through `/bin/sh -c` too, commas doubled.
|
||||
- **The ssh socket path limit (104 characters)** bounds VM names (`NameMax`).
|
||||
- **The ssh socket path limit (103 characters at most: macOS's 104 include the NUL)** bounds VM names (`NameMax`).
|
||||
- **Linux hosts (QEMU):** mounts are 9p, and a 9p share mounts once per guest. Debian's tmpfs `/tmp` hides anything mounted below it during boot. Project VMs' qcow2 disks are overlays of their image's, so never start an image VM or write its disk after it's built.
|
||||
- **Shared tools:** mise rewrites `latest`/`24`/`lts` links in a tool's folder after any install, so those folders are local in the VM; only version folders are mounted.
|
||||
- **Lima can report a failed start for a VM that is running but degraded;** starting tolerates it.
|
||||
- **Linux's `pgrep -f` matches the shell running it** (procps), so e2e's patterns are written `[_]proxy`. mise skips minisign on linux/arm64 (no build).
|
||||
- **Lima writes `lima.REJECTED.yaml` into the current folder** on an invalid config: run `limactl` outside the repo (devvm runs it from its data folder).
|
||||
|
||||
## Commits and tasks
|
||||
|
||||
- Tasks are in dex (`.dex/`, git-ignored).
|
||||
- **One commit when each task is complete**, its Docs and Review subtasks included. Conventional Commits: `type(scope): summary`, types `feat`, `fix`, `docs`, `test`, `refactor`, `build`, `ci`, `chore`. Then `dex complete <id> --commit <sha>`.
|
||||
- **Don't commit or `dex complete` until the gate passes**, with whatever `mise run fmt` changed in the commit.
|
||||
- **Dex task IDs never go in commit messages, code comments or docs.**
|
||||
- **AGENTS.md stays short:** one line per path or rule. Inventories (functions, messages, test names) go in the commit message and the `dex complete` result, not here.
|
||||
- **One commit when each task is complete**, its docs and review included. Conventional Commits: `type(scope): summary`, types `feat`, `fix`, `docs`, `test`, `refactor`, `build`, `ci`, `chore`.
|
||||
- **Don't commit until the gate passes**, with whatever `mise run fmt` changed in the commit.
|
||||
- **Task IDs from any tracker never go in commit messages, code comments or docs.**
|
||||
- **AGENTS.md stays short:** one line per path or rule. Inventories (functions, messages, test names) go in the commit message, not here.
|
||||
@@ -1,5 +1,55 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.1-rc.2
|
||||
|
||||
A release candidate for 0.1.1, adding to 0.1.1-rc.1. Install it with `devvm upgrade --to 0.1.1-rc.2`, the install script's `--version 0.1.1-rc.2`, or `brew install devvmhq/tap/devvm-rc`. Homebrew's `devvm` stays on 0.1.0.
|
||||
|
||||
### After you upgrade
|
||||
|
||||
- Base and every image built on it are built again once, for transparent mode's programs.
|
||||
- Run `devvm update` in an existing VM's folder to give it transparent mode, which new VMs get by default: its image predates the programs it needs.
|
||||
- On a Linux host, run `devvm mount-cache none` for each existing VM, to stop the 9p cache bug below. Each launch reminds you until you do.
|
||||
- If you used `devvm git-protect strict`, use `devvm clone on` for code you don't trust: strict is gone.
|
||||
- Make new API keys for any VM you don't trust that had keys passed to it as they were.
|
||||
|
||||
### New
|
||||
|
||||
- **Transparent mode (#35), on by default:** on every tier but open, tools that ignore the proxy settings, such as `wrangler dev`, static Go binaries and containers, reach the VM's proxy and its allowlist anyway. A VM made before needs `devvm update` first, and `devvm network transparent off` turns it off for a VM ([what it covers](https://next.devvm.dev/docs/safety/network/#tools-that-ignore-the-proxy)).
|
||||
- **Folders of repos with `--clone` (#3):** one VM gets a clone of each repo you pick, at the same paths. `devvm clone fetch` brings back every repo's work, and `devvm clone add PATH` adds one ([folders of repos](https://next.devvm.dev/docs/using/clone/#folders-of-repos)).
|
||||
- **Rules by HTTP method and path:** `devvm network allow|deny HOST --method … --path …`, such as `devvm network deny api.github.com --method POST,PUT,PATCH,DELETE`.
|
||||
- **Your own secrets:** `devvm secret set NAME --host HOST --env VARIABLE`, then `devvm secret use NAME`. The VM only ever sees a placeholder, and `--method` and `--path` limit where the real value goes.
|
||||
- **Learning a VM's hosts (#17):** `--network learn`, then `devvm network lock` to keep the hosts you choose.
|
||||
- **`.git` protection on Linux (#4, #20):** `.git` is locked read-only around QEMU, without root. Where a host can't, such as Ubuntu with AppArmor, devvm watches `.git`, warns at each launch, and names what changed.
|
||||
- **Nested repos (#3):** a VM protects the `.git` of each repo up to 4 folders down. `devvm doctor` suggests `safe.bareRepository explicit`.
|
||||
- **pi and more providers (#23, #31, #32):** pi is a fourth agent, and Gemini, Groq, Mistral, xAI and DeepSeek keys stay on this machine.
|
||||
- **Prereleases on Homebrew (#19):** `brew install devvmhq/tap/devvm-rc`.
|
||||
|
||||
### Changed
|
||||
|
||||
- **The 9p cache on Linux (#36):** Lima's default cache could write files to this machine empty or cut short, and made SQLite and Gradle fail. New Linux VMs use `none`, and `devvm mount-cache none` switches existing ones. Under `none`, keep SQLite WAL databases and other files that programs map for writing on the VM's own disk, or use `--clone`. macOS doesn't change.
|
||||
- **A `--clone` VM in a folder another VM mounts** is refused, and `devvm rm` asks before deleting one made earlier.
|
||||
- **Logins:** a VM's copy of Codex's and Claude Code's login files keeps only the fields devvm knows. opencode, like pi, gets no key devvm doesn't bind, unless you list the provider in `config.toml`'s `[pass-keys]` (#30).
|
||||
- **Warnings** print once per command.
|
||||
- **Nix** is 2.35.5.
|
||||
|
||||
### Removed
|
||||
|
||||
- **`devvm git-protect strict` (#37):** it couldn't keep git on this machine out of submodules the VM adds, so it's a usage error now. Strict VMs become `on`, and devvm takes out the `diff.ignoreSubmodules = all` it set, keeping a value of your own ([VMs that were strict](https://next.devvm.dev/docs/safety/git-protection/#vms-that-were-strict)).
|
||||
|
||||
### Fixed
|
||||
|
||||
- opencode's history copy with SQLite 3.54 (#26), a NUL byte in an ssh socket's path (#25), a build VM reusing its clone's ssh port, a login saved for an agent the VM lacks (#27), and `.git` protection locking a folder that only looks like a git folder (#28).
|
||||
|
||||
## 0.1.1-rc.1
|
||||
|
||||
A release candidate for 0.1.1, for trying the changes below before the release. Install it with `devvm upgrade --to 0.1.1-rc.1`, or with the install script's `--version 0.1.1-rc.1`. Homebrew stays on 0.1.0.
|
||||
|
||||
- **A dotnet toolchain:** the .NET SDK is a shared toolchain, chosen by a folder's `*.sln`, `*.slnx`, `*.csproj`, `*.fsproj` or `global.json`, and a `global.json`'s `sdk.version` picks the SDK. devvm downloads Microsoft's archive for each platform and checks its SHA-512, global tools and workloads go to the VM's home folder, and the .NET CLI's telemetry is off ([toolchains](https://next.devvm.dev/docs/using/toolchains/)).
|
||||
- **A network that inspects TLS:** devvm's own mise, which looks up the shared tools' versions on this machine, now trusts the CAs in `~/.config/devvm/ca` as well as the system's, so resolving works behind a proxy that re-signs HTTPS. When a certificate isn't trusted, devvm says so and points to the docs instead of saying to check the connection. On macOS, the CA also has to be trusted in the Keychain.
|
||||
- **Release candidates:** devvm can ship prereleases, such as this one. `devvm upgrade --to` installs one, and devvm upgrade, the release check and the install script's default never pick one on their own.
|
||||
- **Lima 2.2 or newer:** devvm needs Lima 2.2 at least, and it's tested with Lima 2.3. `devvm doctor` says when Lima is older.
|
||||
- **Updated pins:** base's docker is 29.9.3, mise 2026.11.3, rustup 1.29.3, and tealdeer 1.9.1, with a newer oh-my-bash. The shared tools' backends are named, so mise's registry can't switch opencode to a source with no downloads. base installs ICU, which .NET needs, so base and every image built on it are built again once.
|
||||
|
||||
## 0.1.0
|
||||
|
||||
Released 2026-11-06.
|
||||
|
||||
@@ -9,3 +9,5 @@ Before sending a change, run:
|
||||
```sh
|
||||
mise run fmt && mise run lint && mise run test
|
||||
```
|
||||
|
||||
Pull requests are squash-merged, and the pull request's title becomes the commit's subject, so write it as a [Conventional Commit](https://www.conventionalcommits.org/), `type(scope): summary`, with a type of `feat`, `fix`, `docs`, `test`, `refactor`, `build`, `ci` or `chore`. A check fails a title that doesn't follow it.
|
||||
@@ -30,7 +30,7 @@ Then run `devvm doctor`, which checks what devvm needs on your machine and says
|
||||
|
||||
Each release is signed with devvm's minisign key, `RWSjzFsn7ETaijKJ2y7F4DtZobXmyv+LmdclJwZP/KmAkLUwOCzWF/2b`, and [Checking the install script](https://devvm.dev/docs/internals/install/#checking-the-install-script) shows how to check the script with it before you run it.
|
||||
|
||||
- **Requirements:** macOS 13 or newer, or Linux, on arm64 or x86_64, with Lima 2.0 or newer ([Lima's requirements](https://devvm.dev/docs/backends/lima/#requirements)).
|
||||
- **Requirements:** macOS 13 or newer, or Linux, on arm64 or x86_64, with Lima 2.2 or newer ([Lima's requirements](https://devvm.dev/docs/backends/lima/#requirements)).
|
||||
- **Tested on** Apple silicon Macs and on Linux on arm64 and x86_64, but not yet on Intel Macs.
|
||||
- [Installing](https://devvm.dev/docs/getting-started/install/) has the full list of requirements and the install script's options, and [Upgrading and uninstalling](https://devvm.dev/docs/using/upgrading/) covers what comes later.
|
||||
|
||||
@@ -58,8 +58,8 @@ devvm
|
||||
|
||||
## What's supported
|
||||
|
||||
- **Toolchains:** devvm detects them from the project's files, so a folder with `package.json` gets node ([toolchains](https://devvm.dev/docs/using/toolchains/)).
|
||||
- **Coding agents:** Claude Code, Codex and opencode run in the VM, with your settings, skills and MCP servers. devvm keeps their settings and logins in a store of its own, and `devvm agent import` copies them in from an agent you already use on your machine ([coding agents](https://devvm.dev/docs/using/coding-agents/)).
|
||||
- **Toolchains:** devvm detects them from the project's files, so a folder with `package.json` gets node, and the [toolchains](https://devvm.dev/docs/using/toolchains/) page lists them all.
|
||||
- **Coding agents:** Claude Code, Codex, opencode and pi run in the VM, with your settings, skills and MCP servers. devvm keeps their settings and logins in a store of its own, and `devvm agent import` copies them in from an agent you already use on your machine ([coding agents](https://devvm.dev/docs/using/coding-agents/)).
|
||||
- **Layers:** the built-in `docker`, `nix` and `desktop` layers, and your own from `devvm layer new` ([layers](https://devvm.dev/docs/using/images/#layers)).
|
||||
- **Backend:** devvm runs its VMs on [Lima](https://lima-vm.io) ([backends](https://devvm.dev/docs/backends/)).
|
||||
|
||||
@@ -92,6 +92,7 @@ The docs are at [devvm.dev](https://devvm.dev/), and their source is in `docs/`.
|
||||
- [Using devvm](https://devvm.dev/docs/using/): images and tools, clones, links between VMs, ports and size, coding agents, SSH and editors, and troubleshooting.
|
||||
- [Staying safe](https://devvm.dev/docs/safety/): the habits that keep you safe, network tiers, `.git` protection and attack vectors.
|
||||
- [Backends](https://devvm.dev/docs/backends/): Lima, which runs the VMs, and what it gives them.
|
||||
- [Compared to other tools](https://devvm.dev/docs/compared/): how devvm differs from Docker Sandboxes and other sandboxes.
|
||||
- [CLI reference](https://devvm.dev/docs/cli/): every command, with its arguments and flags.
|
||||
- [How it works](https://devvm.dev/docs/internals/): how devvm does what it does, for checking a claim or reviewing its security.
|
||||
- [Contributing](https://devvm.dev/docs/contributing/): building, testing and writing docs.
|
||||
|
||||
+78
-9
@@ -1,28 +1,97 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"crypto/sha512"
|
||||
"encoding/hex"
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Every VM's shells get the tools' environment from base's
|
||||
// /etc/profile.d/devvm-tools.sh, which turns off the agents'
|
||||
// self-updates: their installs are read-only shared tools, and mise pins
|
||||
// their versions.
|
||||
func TestToolsEnvironment(t *testing.T) {
|
||||
// heredoc is the body of the heredoc that base.sh starts with this line,
|
||||
// up to its end marker.
|
||||
func heredoc(t *testing.T, start, end string) string {
|
||||
t.Helper()
|
||||
b, err := fs.ReadFile(FS, "layers/base.sh")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, rest, ok := strings.Cut(string(b), "/etc/profile.d/devvm-tools.sh >/dev/null <<'SH'\n")
|
||||
block, _, closed := strings.Cut(rest, "\nSH\n")
|
||||
_, rest, ok := strings.Cut(string(b), start+"\n")
|
||||
block, _, closed := strings.Cut(rest, "\n"+end+"\n")
|
||||
if !ok || !closed {
|
||||
t.Fatal("base.sh writes no /etc/profile.d/devvm-tools.sh")
|
||||
t.Fatalf("base.sh has no %q", start)
|
||||
}
|
||||
for _, line := range []string{"export DISABLE_AUTOUPDATER=1", "export OPENCODE_DISABLE_AUTOUPDATE=1"} {
|
||||
return block
|
||||
}
|
||||
|
||||
// Every VM's shells get the tools' environment from base's
|
||||
// /etc/profile.d/devvm-tools.sh, which reads the toolchains' environment
|
||||
// (their telemetry off, their global installs into the VM's home) and
|
||||
// their folders for the PATH from /etc/devvm/toolchains.sh, and the
|
||||
// agents' (their self-updates, version checks and telemetry off) from
|
||||
// /etc/devvm/agents.sh, which every launch's setup writes, so base holds
|
||||
// none of it (internal/vm's TestToolchainsOwnTheirEnvironment): their
|
||||
// installs are read-only shared tools, and mise pins their versions.
|
||||
// Non-login shells read it too (BASH_ENV), but not devvm-telemetry.sh, so
|
||||
// no agent's switch is there.
|
||||
func TestToolsEnvironment(t *testing.T) {
|
||||
block := heredoc(t, "sudo tee /etc/profile.d/devvm-tools.sh >/dev/null <<'SH'", "SH")
|
||||
for _, line := range []string{
|
||||
"if [ -r /etc/devvm/toolchains.sh ]; then . /etc/devvm/toolchains.sh; fi",
|
||||
` export PATH="$devvm_path$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH" ;;`,
|
||||
"if [ -r /etc/devvm/agents.sh ]; then . /etc/devvm/agents.sh; fi",
|
||||
} {
|
||||
if !strings.Contains("\n"+block+"\n", "\n"+line+"\n") {
|
||||
t.Errorf("devvm-tools.sh lacks %q", line)
|
||||
}
|
||||
}
|
||||
telemetry := heredoc(t, "sudo tee /etc/profile.d/devvm-telemetry.sh >/dev/null <<'SH'", "SH")
|
||||
for _, v := range []string{"DISABLE_AUTOUPDATER=", "DISABLE_TELEMETRY=", "DISABLE_ERROR_REPORTING=", "OPENCODE_", "PI_"} {
|
||||
if strings.Contains(block, "export "+v) || strings.Contains(telemetry, "export "+v) {
|
||||
t.Errorf("base sets %s, an agent's, which the setup's agents.sh sets", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// base.sh's devvm-fetch keeps a download only when its checksum is the
|
||||
// one given: a SHA-256, or a SHA-512 by its length.
|
||||
func TestDevvmFetch(t *testing.T) {
|
||||
for _, c := range []string{"sh", "curl", "sha256sum", "sha512sum", "cut"} {
|
||||
if _, err := exec.LookPath(c); err != nil {
|
||||
t.Skip("no " + c)
|
||||
}
|
||||
}
|
||||
dir := t.TempDir()
|
||||
script := filepath.Join(dir, "devvm-fetch")
|
||||
if err := os.WriteFile(script, []byte(heredoc(t, "sudo tee /usr/local/bin/devvm-fetch >/dev/null <<'SH'", "SH")+"\n"), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
src := filepath.Join(dir, "src")
|
||||
body := []byte("an archive\n")
|
||||
if err := os.WriteFile(src, body, 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s256, s512 := sha256.Sum256(body), sha512.Sum512(body)
|
||||
for _, tc := range []struct {
|
||||
name, sum string
|
||||
ok bool
|
||||
}{
|
||||
{"its SHA-256", hex.EncodeToString(s256[:]), true},
|
||||
{"its SHA-512", hex.EncodeToString(s512[:]), true},
|
||||
{"another SHA-256", strings.Repeat("0", 64), false},
|
||||
{"another SHA-512", strings.Repeat("0", 128), false},
|
||||
{"its SHA-256 twice", strings.Repeat(hex.EncodeToString(s256[:]), 2), false},
|
||||
} {
|
||||
out := filepath.Join(dir, "out")
|
||||
err := exec.CommandContext(t.Context(), "sh", script, "file://"+src, tc.sum, out).Run() //nolint:gosec // base.sh's devvm-fetch, on the test's own files
|
||||
_, kept := os.Stat(out)
|
||||
if (err == nil) != tc.ok || (kept == nil) != tc.ok {
|
||||
t.Errorf("%s: %v, kept %v", tc.name, err, kept == nil)
|
||||
}
|
||||
_ = os.Remove(out)
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,9 @@ set -euxo pipefail
|
||||
eza_version=0.23.5
|
||||
eza_sha256_arm64=40b87ae8628aa2ff0f0d2dc24ab52f689631366385c3da630bae745671fd71ec
|
||||
eza_sha256_amd64=e06eebab74b73d6b7d51a796a353824b001bea82df077706382e100815d28904
|
||||
tealdeer_version=1.9.0
|
||||
tealdeer_sha256_arm64=a748f181c00933980cb850f4a24199c45900fc523787f6c524232a6bfc66b895
|
||||
tealdeer_sha256_amd64=dc7263b550e90c0689ea2cb434e3144469805d5dddecbb1f7fc534e1185b7408
|
||||
tealdeer_version=1.9.1
|
||||
tealdeer_sha256_arm64=247746dd2d18f0135da79b849bb6b49e45262e2fe4318adfc3082dc6ce3ee968
|
||||
tealdeer_sha256_amd64=5a9c3f0691b9cf375ee5c99de802885f3d50498cf686a539e2ddda028eb6b4f6
|
||||
|
||||
if [[ $devvm_libc == musl ]]; then
|
||||
# Alpine packages eza too (its arm64 release build below is glibc).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# oh-my-bash: themed prompt, completions, aliases
|
||||
set -euxo pipefail
|
||||
# Pinned commit (scripts/bump.sh updates it); git checks the content against it.
|
||||
omb_commit=abf846186ab0a8a41ec5888e827ece6277dfe446
|
||||
omb_commit=94c2977eda06f230aafa9628fcd869123f01896b
|
||||
|
||||
# Its own installer, from the pinned commit and cloning from it (OSH_REPOSITORY), so nothing comes
|
||||
# from master. Replaces ~/.bashrc (backed up first); re-add the ~/.bashrc.d loader afterwards.
|
||||
|
||||
@@ -20,17 +20,17 @@ Every request goes through a proxy that devvm runs on the host, and the VM's net
|
||||
| `allowlist` | only the hosts on the VM's allowlist (the default) |
|
||||
| `none` | only its agents' hosts, its secrets' hosts and its links |
|
||||
|
||||
The VM doesn't record its tier, and the user sees it with devvm network on the host. A request that the tier refuses fails with a 403 from the proxy, which names the host and the rule that would allow it, and on every tier but open a direct connection or a DNS lookup that skips the proxy fails at once.
|
||||
The VM doesn't record its tier, and the user sees it with devvm network on the host. A VM can also learn the hosts it needs: it's on the internet tier while it learns, and once the user runs devvm network lock on the host, it's on the allowlist tier with the hosts the user kept, so a host that works while it learns may be blocked after. A request that the tier refuses fails with a 403 from the proxy, which names the host and the rule that would allow it, and on every tier but open a direct connection to an address fails at once.
|
||||
|
||||
- Run `devvm-why` to see what the proxy blocked lately. A note before each shell prompt says when something new was blocked.
|
||||
- The proxy settings are in the environment (`HTTP_PROXY`, `HTTPS_PROXY` and their lowercase forms). A tool that ignores them, such as Java, needs the proxy's address in its own settings. A DNS or connection error for a host the tier allows means the tool skipped the proxy, and devvm-why doesn't show it.
|
||||
- The proxy settings are in the environment (`HTTP_PROXY`, `HTTPS_PROXY` and their lowercase forms). On every tier but open, a tool that ignores them still reaches the proxy by the names it looks up, over HTTPS and HTTP and on the ports the rules name, unless the user turned transparent mode off: every name resolves to 198.18.0.1, and the proxy reads the real host from the connection and judges it the same way, so a blocked HTTPS host shows the proxy's 403. Another port of such a name is refused at once, and so is a protocol that names no host, such as a database's, so a tool like that needs the proxy's address in its own settings. `devvm-why` lists both what the proxy blocked and what the VM refused.
|
||||
- No secret is in the VM. `GH_TOKEN`, `CLAUDE_CODE_OAUTH_TOKEN` and the agents' logins hold placeholders, and the proxy puts the real value into each request for that secret's hosts. Use them as they are, and don't copy them anywhere else, because they work nowhere but through this VM's proxy.
|
||||
- git over ssh goes through the proxy too, with `devvm-ssh-proxy` as its ProxyCommand, so the host must be one the tier allows.
|
||||
- Browsers ask for a proxy's password, so they use `devvm-local-proxy`, which the desktop starts on the VM's loopback.
|
||||
|
||||
## Tools and installs
|
||||
|
||||
- The toolchains (node, python, rust, go) and the coding agents are shared tools, mounted read-only from images that every VM shares. They can't update themselves, and global installs go into your home: `npm i -g` installs into `~/.npm-global`, and Python's packages go into a virtual environment or `~/.local/bin`.
|
||||
- The toolchains, such as node ([the list](https://devvm.dev/docs/using/toolchains/)), and the coding agents are shared tools, mounted read-only from images that every VM shares. They can't update themselves, and global installs go into your home: `npm i -g` installs into `~/.npm-global`, Python's packages go into a virtual environment or `~/.local/bin`, and `dotnet tool install -g` installs into `~/.dotnet/tools`.
|
||||
- mise runs the shared tools. A project that asks for another version, in `.tool-versions`, `mise.toml` or its own toolchain file, gets it from mise, which installs it in your home on first use.
|
||||
- `sudo` needs no password, and `apt install` (`apk add` on Alpine) goes through the proxy, whose allowlist for every VM has Ubuntu's, Debian's and Alpine's package hosts. What it installs is lost when the VM is made again.
|
||||
- `devvm-fetch URL SHA256 OUT` downloads a file and fails when its checksum doesn't match.
|
||||
|
||||
+63
-10
@@ -14,9 +14,21 @@
|
||||
# vm DEVVM_* host settings applied to every VM: hostname, timezone, locale, git identity,
|
||||
# DEVVM_PROXY (the proxy URL, empty when the guest has none),
|
||||
# DEVVM_NO_PROXY (what reaches the VM itself without the proxy; its links go through it),
|
||||
# and DEVVM_LOCAL_PROXY (ADDRESS:PORT on the VM's loopback, where devvm-local-proxy
|
||||
# listens; empty without a proxy)
|
||||
# DEVVM_LOCAL_PROXY (ADDRESS:PORT on the VM's loopback, where devvm-local-proxy
|
||||
# listens; empty without a proxy), and DEVVM_TRANSPARENT_ADDR and
|
||||
# DEVVM_TRANSPARENT_HOST (transparent mode's stand-in address, empty for off, and the
|
||||
# proxy's reserved target; transparent.sh)
|
||||
# transparent.sh devvm-transparent: transparent mode, for tools that ignore the proxy settings
|
||||
# tools the VM's shared tool images, "FILE TOOL VERSION" lines; tools.sh mounts them
|
||||
# tool-alias.toml the [tool_alias] table of devvm's shared-tools/mise.toml: the backend each
|
||||
# tool's image was built from, which mise's registry might not give its name
|
||||
# agent-env export lines of every coding agent's guest environment (its self-update, version
|
||||
# check and telemetry off), installed as /etc/devvm/agents.sh, which devvm-tools.sh reads
|
||||
# toolchain-env export lines of every toolchain's guest environment (its telemetry off, its global
|
||||
# installs into ~), then devvm_path, their folders of ~ for the PATH, each followed by a
|
||||
# colon; installed as /etc/devvm/toolchains.sh, which devvm-tools.sh reads
|
||||
# version-files.toml the VM's mise's idiomatic_version_file_enable_tools setting: the toolchains'
|
||||
# tools whose version files (.nvmrc, global.json) a project chooses versions with
|
||||
# opencode-import.json the store's opencode logins as opencode auth import reads them, with
|
||||
# placeholders (none: no opencode login in the store); opencode.sh imports them
|
||||
# hosts the VM's links (devvm checked them): a line per target, "ADDRESS NAME
|
||||
@@ -72,12 +84,21 @@ if [[ -n "$DEVVM_LANG" ]] && command -v locale-gen >/dev/null && ! locale -a | g
|
||||
fi
|
||||
|
||||
# Shared tools: mount this VM's images (at boot too, by devvm-tools.service), then tell mise which
|
||||
# versions to use. /etc/mise is mise's system config: the user's own (~/.config/mise) comes first.
|
||||
# versions to use, and each one's backend. /etc/mise is mise's system config: the user's own
|
||||
# (~/.config/mise) comes first.
|
||||
cmp -s "$s/tools.sh" /usr/local/sbin/devvm-tools 2>/dev/null || sudo install -D -m 755 "$s/tools.sh" /usr/local/sbin/devvm-tools
|
||||
cmp -s "$s/tools" /etc/devvm/tools 2>/dev/null || sudo install -D -m 644 "$s/tools" /etc/devvm/tools
|
||||
# The toolchains' and the agents' environment (their telemetry and self-updates off, the toolchains'
|
||||
# folders for the PATH), which base's devvm-tools.sh reads in every shell, before anything here runs
|
||||
# one.
|
||||
cmp -s "$s/toolchain-env" /etc/devvm/toolchains.sh 2>/dev/null ||
|
||||
sudo install -D -m 644 "$s/toolchain-env" /etc/devvm/toolchains.sh
|
||||
cmp -s "$s/agent-env" /etc/devvm/agents.sh 2>/dev/null || sudo install -D -m 644 "$s/agent-env" /etc/devvm/agents.sh
|
||||
# A tool it can't mount fails the setup, and devvm names it from /run/devvm/tools-unmounted.
|
||||
sudo /usr/local/sbin/devvm-tools
|
||||
{
|
||||
cat "$s/tool-alias.toml"
|
||||
echo
|
||||
echo '[tools]'
|
||||
while read -r _ tool version; do [[ -z $tool || $tool == rust ]] || echo "$tool = \"$version\""; done < "$s/tools"
|
||||
cat <<'T'
|
||||
@@ -85,18 +106,22 @@ sudo /usr/local/sbin/devvm-tools
|
||||
[settings]
|
||||
experimental = true
|
||||
shared_install_dirs = ["/opt/devvm/tools"]
|
||||
# A project's version files choose versions, as their own tools would; a version that isn't shared
|
||||
# installs into the VM on first use. Not go: go.mod's go line is a minimum, and Go's own GOTOOLCHAIN
|
||||
# reads its toolchain line.
|
||||
idiomatic_version_file_enable_tools = ["node", "python", "bun", "pnpm"]
|
||||
# A version that a project's version files choose and that isn't shared installs into the VM on first
|
||||
# use.
|
||||
auto_install = true
|
||||
not_found_auto_install = true
|
||||
python.compile = false
|
||||
# mise points GOBIN into Go's install, which is read-only: go install goes to ~/go/bin.
|
||||
go_set_gobin = false
|
||||
# Each .NET SDK in a folder of its own, the shared one's its image: mise would otherwise run every SDK
|
||||
# from one folder of the VM's, which the shared one isn't in.
|
||||
dotnet.isolated = true
|
||||
# The project folder is the user's own: trust its mise.toml without asking.
|
||||
trusted_config_paths = ["/"]
|
||||
T
|
||||
# A project's version files choose versions, as their own tools would: the toolchains' tools that
|
||||
# devvm's registry names, in [settings] still.
|
||||
cat "$s/version-files.toml"
|
||||
} > "$s/mise.toml"
|
||||
cmp -s "$s/mise.toml" /etc/mise/config.toml 2>/dev/null || sudo install -D -m 644 "$s/mise.toml" /etc/mise/config.toml
|
||||
# Links into tools this VM doesn't have any more (devvm tools rm, devvm tools update).
|
||||
@@ -119,6 +144,17 @@ go=$(awk '$2 == "go" { print $3 }' "$s/tools")
|
||||
if [[ -n $go && "$(cat ~/.config/go/telemetry/mode 2>/dev/null)" != off* ]]; then
|
||||
/opt/devvm/tools/go/"$go"/bin/go telemetry off
|
||||
fi
|
||||
# .NET's global tools (~/.dotnet/tools) find the shared runtime in every shell through
|
||||
# /etc/dotnet/install_location, where .NET's programs look for an installed one: mise sets
|
||||
# DOTNET_ROOT only in the shells it activates.
|
||||
dotnet=$(awk '$2 == "dotnet" { print $3 }' "$s/tools")
|
||||
loc=$(cat /etc/dotnet/install_location 2>/dev/null || true)
|
||||
if [[ -n $dotnet && $loc != "/opt/devvm/tools/dotnet/$dotnet" ]]; then
|
||||
sudo mkdir -p /etc/dotnet
|
||||
echo "/opt/devvm/tools/dotnet/$dotnet" | sudo tee /etc/dotnet/install_location >/dev/null
|
||||
elif [[ -z $dotnet && $loc == /opt/devvm/tools/* ]]; then
|
||||
sudo rm -f /etc/dotnet/install_location
|
||||
fi
|
||||
# Claude Code checks for itself at ~/.local/bin/claude.
|
||||
claude=$(awk '$2 == "claude" { print $3 }' "$s/tools")
|
||||
if [[ -n $claude ]]; then mkdir -p ~/.local/bin; ln -sfn /opt/devvm/tools/claude/"$claude"/claude ~/.local/bin/claude; fi
|
||||
@@ -418,11 +454,13 @@ SH
|
||||
mkdir -p ~/.ssh
|
||||
proxy_block ~/.ssh/config "Host *
|
||||
ProxyCommand /usr/local/bin/devvm-ssh-proxy %h %p"
|
||||
# devvm-why: what the proxy blocked lately, and how to allow it.
|
||||
# devvm-why: what the proxy blocked lately, and how to allow it; then, with transparent mode, what
|
||||
# it refused in the VM and the names tools looked up.
|
||||
sudo tee /usr/local/bin/devvm-why >/dev/null <<'SH'
|
||||
#!/bin/sh
|
||||
# What this VM's proxy blocked recently, and the host command that allows it.
|
||||
exec curl -sS --proxy "$HTTP_PROXY" http://devvm.proxy/blocked
|
||||
curl -sS --proxy "$HTTP_PROXY" http://devvm.proxy/blocked
|
||||
if [ -x /usr/local/sbin/devvm-transparent ]; then sudo -n /usr/local/sbin/devvm-transparent status; fi
|
||||
SH
|
||||
sudo chmod 755 /usr/local/bin/devvm-why
|
||||
# Before each prompt: what was blocked since the last one (HTTPS clients don't show the proxy's
|
||||
@@ -451,6 +489,21 @@ else
|
||||
if $systemd; then sudo rm -f "$dropin"; else conf_block "$dropin"; fi
|
||||
[[ ! -f ~/.ssh/config ]] || proxy_block ~/.ssh/config
|
||||
fi
|
||||
# Transparent mode (transparent.sh, devvm-transparent) on a confined VM: every name resolves to the
|
||||
# stand-in address, whose ports 80, 443 and those the rules name go to the proxy, which reads the host
|
||||
# from the connection. The proxy URL, which holds the password, goes on stdin, never in arguments.
|
||||
# Off on an open VM. An image from before transparent mode lacks its programs, so names don't resolve.
|
||||
if [[ -n ${DEVVM_TRANSPARENT_ADDR:-} && -n ${DEVVM_PROXY:-} ]]; then
|
||||
rc=0
|
||||
printf '%s\n' "$DEVVM_PROXY" | sudo bash "$s/transparent.sh" setup "$DEVVM_TRANSPARENT_ADDR" "$DEVVM_TRANSPARENT_HOST" || rc=$?
|
||||
if [[ $rc == 3 ]]; then
|
||||
echo "devvm: this VM's image has no dnsmasq, socat or nft, so tools that skip the proxy can't resolve names in it; devvm update makes it again from a newer image" >&2
|
||||
elif [[ $rc != 0 ]]; then
|
||||
echo "devvm: transparent mode didn't start in this VM, so tools that skip the proxy can't resolve names in it; the next launch tries again" >&2
|
||||
fi
|
||||
else
|
||||
sudo bash "$s/transparent.sh" teardown || true
|
||||
fi
|
||||
if command -v dockerd >/dev/null; then
|
||||
docker_proxies ~/.docker/config.json
|
||||
docker_proxies /root/.docker/config.json sudo
|
||||
@@ -485,7 +538,7 @@ if [[ "$(cat /usr/local/bin/devvm-help 2>/dev/null)" != "$(printf '#!/bin/sh\nex
|
||||
fi
|
||||
|
||||
# Tell agents why the network may fail, and what to do about it.
|
||||
note="Network access in this VM goes through devvm's proxy, which allows what the VM's network tier allows. If a download or request fails with a connection error or a 403 from the proxy, run \`devvm-why\` to see what was blocked; the user can allow it on the host with \`devvm network allow <host>\`. A DNS or connection error for an allowed host while \`devvm-why\` shows nothing means the tool skipped the proxy: turn on its own proxy setting, or give it \`\$HTTPS_PROXY\`."
|
||||
note="Network access in this VM goes through devvm's proxy, which allows what the VM's network tier allows. If a download or request fails with a connection error or a 403 from the proxy, run \`devvm-why\` to see what was blocked; the user can allow it on the host with \`devvm network allow <host>\`. A tool that ignores the proxy settings still reaches the proxy over HTTPS and HTTP, and on the ports the rules name, by the names it looks up (transparent mode). A connection refused on another port, or a DNS error where transparent mode is off, while \`devvm-why\` shows nothing blocked means the tool skipped the proxy: turn on its own proxy setting, or give it \`\$HTTPS_PROXY\`."
|
||||
for f in ~/.claude/CLAUDE.md ~/.codex/AGENTS.md; do
|
||||
[[ -d "$(dirname "$f")" ]] || continue
|
||||
[[ -f "$f" ]] && sed -i '/^<!-- devvm-proxy -->/,/^<!-- \/devvm-proxy -->/d' "$f"
|
||||
|
||||
@@ -0,0 +1,493 @@
|
||||
#!/bin/bash
|
||||
# devvm-transparent: transparent mode, for tools that ignore the proxy settings on a confined VM.
|
||||
# dnsmasq answers every name with the stand-in address (proxy.SentinelAddr, on lo) and nothing else,
|
||||
# with no upstream, so no DNS query leaves the VM. nftables sends a connection to one of the
|
||||
# stand-in address's ports (80, 443 and the ports the VM's allow rules name, from the proxy's
|
||||
# /transparent/ports) to a socat listener on that address, which makes it an ordinary CONNECT to the
|
||||
# VM's proxy with the VM's password, for the reserved target (proxy.TransparentHost) at that port.
|
||||
# The proxy reads the host from the connection's first bytes and judges it as any CONNECT. Every
|
||||
# other port of the address is refused at once, and DNS to a public server goes to dnsmasq too.
|
||||
# None of it is a boundary: the host confines the VM to its proxy, whatever root here changes.
|
||||
# devvm-transparent setup ADDR HOST < PROXY_URL root, sync.sh: install it all, start the service
|
||||
# devvm-transparent teardown root, sync.sh: stop the service, remove it all
|
||||
# devvm-transparent run the service: start and watch what it runs
|
||||
# devvm-transparent down the service's stop: the table, the address, the children
|
||||
# devvm-transparent status devvm-why, as root: whether it runs, refusals, names
|
||||
# devvm-transparent render PORT=LISTEN... the ruleset for those ports and their listeners, and
|
||||
# DEVVM_TRANSPARENT_RESOLVERS's name servers
|
||||
# devvm-transparent slots PORT... each port's listener, keeping the ports that stay
|
||||
# devvm-transparent valid FILE whether FILE is a port list the ruleset takes
|
||||
# Exit 3 from setup: dnsmasq, socat or nft is missing (an image from before transparent mode).
|
||||
set -u
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
tp=${DEVVM_TRANSPARENT_DIR:-/etc/devvm/transparent}
|
||||
run_dir=/run/devvm-transparent
|
||||
self=/usr/local/sbin/devvm-transparent
|
||||
user=devvm-transparent
|
||||
table=devvm_transparent
|
||||
# The listeners' ports: 80's, 443's and 32 more, above Linux's ephemeral range (32768-60999), so no
|
||||
# connection out or bind(0) is given one; dead has no listener, so what goes there is refused.
|
||||
listen80=61080 listen443=61443 first_slot=61100 last_slot=61131 dead=61079
|
||||
# The VM's own name servers the loaded ruleset sends to dnsmasq (apply).
|
||||
resolvers=''
|
||||
|
||||
# load_env: addr, host, proxy_host and proxy_port from the env file setup wrote.
|
||||
load_env() {
|
||||
addr='' host='' proxy_host='' proxy_port=''
|
||||
# shellcheck source=/dev/null
|
||||
[[ -f $tp/env ]] && . "$tp/env"
|
||||
[[ -n $addr && -n $host && -n $proxy_host && -n $proxy_port ]]
|
||||
}
|
||||
|
||||
# valid_ports FILE: 2 to 34 lines, each a port from 1 to 65535 in digits, once, never 22 or 53, with
|
||||
# 80 and 443 among them. Anything else from the proxy is kept out of the ruleset.
|
||||
valid_ports() {
|
||||
local p n=0 seen=' '
|
||||
while IFS= read -r p; do
|
||||
n=$((n + 1))
|
||||
[[ $p =~ ^[1-9][0-9]{0,4}$ ]] && ((p <= 65535)) && [[ $p != 22 && $p != 53 && $seen != *" $p "* ]] || return 1
|
||||
seen+="$p "
|
||||
done <"$1"
|
||||
((n >= 2 && n <= 34)) && [[ $seen == *' 80 '* && $seen == *' 443 '* ]]
|
||||
}
|
||||
|
||||
# slots PORT...: "PORT LISTEN" for each port, 80 and 443 on their own listeners, the others each on
|
||||
# the one the slots file gave it, while they stay, else on the lowest that's free.
|
||||
slots() {
|
||||
local p l used=' ' pending='' out=''
|
||||
for p in "$@"; do
|
||||
case $p in
|
||||
80) out+="80 $listen80"$'\n' ;;
|
||||
443) out+="443 $listen443"$'\n' ;;
|
||||
*)
|
||||
l=$(awk -v p="$p" '$1 == p { print $2; exit }' "$tp/slots" 2>/dev/null)
|
||||
if [[ $l =~ ^[0-9]+$ ]] && ((l >= first_slot && l <= last_slot)) && [[ $used != *" $l "* ]]; then
|
||||
used+="$l " out+="$p $l"$'\n'
|
||||
else
|
||||
pending+="$p "
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
for p in $pending; do
|
||||
for ((l = first_slot; l <= last_slot; l++)); do
|
||||
[[ $used == *" $l "* ]] && continue
|
||||
used+="$l " out+="$p $l"$'\n'
|
||||
break
|
||||
done
|
||||
done
|
||||
printf '%s' "$out"
|
||||
}
|
||||
|
||||
# render PORT=LISTEN...: the ruleset, one transaction that replaces the table whole. Both NAT chains
|
||||
# run before Docker's (dstnat, -100: priorities are numbers, which Debian 12's nft needs here) and
|
||||
# give every TCP and UDP port of the stand-in address a
|
||||
# mapping, so Docker's chains, which would send a published port's traffic to a container, never
|
||||
# see one: a redirected port goes to its listener, DNS to dnsmasq, and every other port to the dead
|
||||
# port, which refuses it at once. DNS to any public server goes to dnsmasq, and so does DNS to the
|
||||
# VM's own name servers ($resolvers, own_resolvers), which Docker gives containers; loopback's other
|
||||
# addresses, private, link-local and CGNAT ones are left as they are. 127.0.0.1:53 is where the
|
||||
# VM's resolver asks (Lima's DNS setting): it goes to dnsmasq, which listens on the stand-in
|
||||
# address alone, so nothing of transparent mode listens on loopback.
|
||||
render() {
|
||||
local pl r redirects='' own='' a=${addr:-198.18.0.1}
|
||||
for pl in "$@"; do
|
||||
redirects+=" ip daddr $a tcp dport ${pl%%=*} dnat ip to $a:${pl#*=}"$'\n'
|
||||
done
|
||||
for r in ${resolvers:-}; do own+="${own:+, }$r"; done
|
||||
if [[ -n $own ]]; then
|
||||
redirects+=" ip daddr { $own } udp dport 53 dnat ip to $a:53"$'\n'
|
||||
redirects+=" ip daddr { $own } tcp dport 53 dnat ip to $a:53"$'\n'
|
||||
fi
|
||||
cat <<EOF
|
||||
table inet $table
|
||||
delete table inet $table
|
||||
table inet $table {
|
||||
set kept {
|
||||
type ipv4_addr; flags interval
|
||||
elements = { 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.168.0.0/16, $a }
|
||||
}
|
||||
# Before every NAT chain (-150): the stand-in address takes only the VM's own and Docker's bridges,
|
||||
# and only TCP, UDP and ICMP, so another bridge (Podman's, LXD's) or a protocol the NAT chains don't
|
||||
# map (SCTP) never reaches Docker's DNAT of a published port through it.
|
||||
chain early_in {
|
||||
type filter hook prerouting priority -150; policy accept;
|
||||
ip daddr $a iifname != "lo" iifname != "docker0" iifname != "br-*" drop
|
||||
ip daddr $a meta l4proto != { tcp, udp, icmp } drop
|
||||
}
|
||||
chain early_out {
|
||||
type filter hook output priority -150; policy accept;
|
||||
ip daddr $a meta l4proto != { tcp, udp, icmp } drop
|
||||
}
|
||||
chain output {
|
||||
type nat hook output priority -110; policy accept;
|
||||
${redirects} jump sentinel
|
||||
ip daddr 127.0.0.1 udp dport 53 dnat ip to $a:53
|
||||
ip daddr 127.0.0.1 tcp dport 53 dnat ip to $a:53
|
||||
ip daddr != @kept udp dport 53 dnat ip to $a:53
|
||||
ip daddr != @kept tcp dport 53 dnat ip to $a:53
|
||||
}
|
||||
chain prerouting {
|
||||
type nat hook prerouting priority -110; policy accept;
|
||||
iifname "docker0" jump from_containers
|
||||
iifname "br-*" jump from_containers
|
||||
}
|
||||
chain from_containers {
|
||||
${redirects} jump sentinel
|
||||
ip daddr != @kept udp dport 53 dnat ip to $a:53
|
||||
ip daddr != @kept tcp dport 53 dnat ip to $a:53
|
||||
}
|
||||
# IPv6 returns first: in an inet table, ip daddr matches IPv4 alone, so an IPv6 packet would skip
|
||||
# the next return and be logged as refused. The stand-in address is IPv4, and a connection to it
|
||||
# from an IPv6 socket (::ffff:198.18.0.1) leaves as IPv4, so this opens no way to it.
|
||||
chain sentinel {
|
||||
meta nfproto != ipv4 return
|
||||
ip daddr != $a return
|
||||
udp dport 53 dnat ip to $a:53
|
||||
tcp dport 53 dnat ip to $a:53
|
||||
meta l4proto tcp limit rate 5/second log prefix "devvm-transparent refused: " level info
|
||||
meta l4proto tcp dnat ip to $a:$dead
|
||||
meta l4proto udp dnat ip to $a:$dead
|
||||
}
|
||||
chain input {
|
||||
type filter hook input priority -10; policy accept;
|
||||
ip daddr $a iifname != "lo" iifname != "docker0" iifname != "br-*" drop
|
||||
ip daddr $a udp dport 53 accept
|
||||
ip daddr $a tcp dport 53 accept
|
||||
ip daddr $a ct status dnat accept
|
||||
ip daddr $a meta l4proto tcp reject with tcp reset
|
||||
ip daddr $a meta l4proto udp reject
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
# pairs: the ports file's ports as render takes them (slots), and the slots file written to match.
|
||||
pairs() {
|
||||
local p l list
|
||||
# shellcheck disable=SC2046 # one port a line
|
||||
list=$(slots $(cat "$tp/ports"))
|
||||
printf '%s\n' "$list" >"$tp/slots.tmp" && mv "$tp/slots.tmp" "$tp/slots"
|
||||
while read -r p l; do [[ -z $p ]] || printf '%s=%s ' "$p" "$l"; done <<<"$list"
|
||||
}
|
||||
|
||||
# own_resolvers: the VM's own name servers but loopback's, which its resolver asks besides
|
||||
# 127.0.0.1 (such as the one Lima's DHCP gives it) and which Docker gives containers: IPv4
|
||||
# addresses from systemd-resolved's list and /etc/resolv.conf, each once, at most 8.
|
||||
own_resolvers() {
|
||||
local r seen=' ' n=0
|
||||
while read -r r; do
|
||||
[[ $r =~ ^[0-9]{1,3}(\.[0-9]{1,3}){3}$ && $r != 127.* && $r != "${addr:-198.18.0.1}" && $seen != *" $r "* ]] || continue
|
||||
n=$((n + 1))
|
||||
((n <= 8)) || break
|
||||
seen+="$r "
|
||||
echo "$r"
|
||||
done < <(awk '$1 == "nameserver" { print $2 }' /run/systemd/resolve/resolv.conf /etc/resolv.conf 2>/dev/null)
|
||||
}
|
||||
|
||||
# apply: the ruleset for the ports file's ports and the VM's own name servers as they are now, loaded
|
||||
# whole.
|
||||
apply() {
|
||||
local f
|
||||
resolvers=$(own_resolvers | tr '\n' ' ')
|
||||
f=$(mktemp)
|
||||
# shellcheck disable=SC2046 # PORT=LISTEN words
|
||||
render $(pairs) >"$f"
|
||||
nft -f "$f" || echo "devvm-transparent: nft didn't load the ruleset" >&2
|
||||
rm -f "$f"
|
||||
}
|
||||
|
||||
# alive PIDFILE NAME: the process in PIDFILE runs, and is NAME.
|
||||
alive() {
|
||||
local pid
|
||||
pid=$(cat "$1" 2>/dev/null) || return 1
|
||||
[[ -n $pid && "$(cat "/proc/$pid/comm" 2>/dev/null)" == "$2" ]]
|
||||
}
|
||||
|
||||
# stop PIDFILE NAME: end the process in PIDFILE when it's NAME, and forget it.
|
||||
stop() {
|
||||
if alive "$1" "$2"; then kill "$(cat "$1")" 2>/dev/null; fi
|
||||
rm -f "$1"
|
||||
}
|
||||
|
||||
# search_domains: the domains the VM's resolver appends to a name without a dot (/etc/resolv.conf's
|
||||
# search line, which Lima fills from this machine's network), each a DNS name, at most 6.
|
||||
search_domains() {
|
||||
local d n=0
|
||||
while read -r d; do
|
||||
d=${d%.}
|
||||
[[ $d =~ ^[A-Za-z0-9]([A-Za-z0-9.-]{0,252}[A-Za-z0-9])?$ ]] || continue
|
||||
n=$((n + 1))
|
||||
((n <= 6)) || break
|
||||
echo "$d"
|
||||
done < <(awk '$1 == "search" { for (i = 2; i <= NF; i++) print $i }' /etc/resolv.conf 2>/dev/null)
|
||||
}
|
||||
|
||||
# start_dnsmasq: dnsmasq, with no answer for the names under the search domains: so a name without
|
||||
# a dot that isn't in /etc/hosts doesn't resolve, as it doesn't to the stand-in address either
|
||||
# (address=//), rather than turning into one of this machine's network's names.
|
||||
start_dnsmasq() {
|
||||
local d args=()
|
||||
for d in $(search_domains); do args+=("--address=/$d/"); done
|
||||
dnsmasq --keep-in-foreground --conf-file="$tp/dnsmasq.conf" ${args[@]+"${args[@]}"} &
|
||||
echo "$!" >"$run_dir/dnsmasq.pid"
|
||||
}
|
||||
|
||||
# start_socat PORT LISTEN: the listener for PORT on the stand-in address's LISTEN.
|
||||
start_socat() {
|
||||
socat "TCP4-LISTEN:$2,bind=$addr,reuseaddr,fork,max-children=256,backlog=256,su=$user" \
|
||||
"PROXY:$proxy_host:$host:$1,proxyport=$proxy_port,proxyauthfile=$tp/auth,connect-timeout=10" &
|
||||
echo "$!" >"$run_dir/socat-$1.pid"
|
||||
}
|
||||
|
||||
# listeners: start what isn't running, the listeners of the slots file's ports, and stop those whose
|
||||
# port is gone.
|
||||
listeners() {
|
||||
local f p l
|
||||
alive "$run_dir/dnsmasq.pid" dnsmasq || start_dnsmasq
|
||||
for f in "$run_dir"/socat-*.pid; do
|
||||
[[ -e $f ]] || continue
|
||||
p=${f##*/socat-} p=${p%.pid}
|
||||
grep -q "^$p " "$tp/slots" || stop "$f" socat
|
||||
done
|
||||
while read -r p l; do
|
||||
[[ -z $p ]] || alive "$run_dir/socat-$p.pid" socat || start_socat "$p" "$l"
|
||||
done <"$tp/slots"
|
||||
}
|
||||
|
||||
# fetch: the proxy's port list, into the ports file when it's valid and has changed (0), else 1.
|
||||
fetch() {
|
||||
local f
|
||||
f=$(mktemp)
|
||||
if curl -sSf --max-time 5 -K "$tp/curlrc" -o "$f" http://devvm.proxy/transparent/ports 2>/dev/null &&
|
||||
valid_ports "$f" && ! cmp -s "$f" "$tp/ports"; then
|
||||
mv "$f" "$tp/ports"
|
||||
return 0
|
||||
fi
|
||||
rm -f "$f"
|
||||
return 1
|
||||
}
|
||||
|
||||
run() {
|
||||
load_env || { echo "devvm-transparent: no $tp/env" >&2; exit 1; }
|
||||
mkdir -p "$run_dir" && chmod 700 "$run_dir"
|
||||
[[ -s $tp/ports ]] && valid_ports "$tp/ports" || printf '80\n443\n' >"$tp/ports"
|
||||
down_children
|
||||
ip -4 addr show dev lo | grep -q " $addr/32 " || ip addr add "$addr/32" dev lo
|
||||
apply
|
||||
trap 'down; exit 0' TERM INT
|
||||
local tick=0 hosts_at
|
||||
hosts_at=$(stat -c %Y /etc/hosts 2>/dev/null)
|
||||
listeners
|
||||
touch "$run_dir/ready"
|
||||
while :; do
|
||||
sleep 1 &
|
||||
wait $!
|
||||
listeners
|
||||
if [[ "$(stat -c %Y /etc/hosts 2>/dev/null)" != "$hosts_at" ]]; then
|
||||
hosts_at=$(stat -c %Y /etc/hosts 2>/dev/null)
|
||||
[[ ! -f $run_dir/dnsmasq.pid ]] || kill -HUP "$(cat "$run_dir/dnsmasq.pid")" 2>/dev/null
|
||||
fi
|
||||
# A launch's setup fetched new ports (reload); every tenth second, the proxy's ports, the VM's
|
||||
# own name servers, and the table back if something removed it (nft flush ruleset).
|
||||
tick=$(((tick + 1) % 10))
|
||||
if [[ -e $run_dir/reload ]] || { ((tick == 0)) && { fetch || [[ "$(own_resolvers | tr '\n' ' ')" != "$resolvers" ]] ||
|
||||
! nft list table inet "$table" >/dev/null 2>&1; }; }; then
|
||||
rm -f "$run_dir/reload"
|
||||
apply
|
||||
listeners
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# down_children: stop every child a supervisor recorded, this one's or one that died.
|
||||
down_children() {
|
||||
local f
|
||||
for f in "$run_dir"/socat-*.pid; do [[ ! -e $f ]] || stop "$f" socat; done
|
||||
stop "$run_dir/dnsmasq.pid" dnsmasq
|
||||
}
|
||||
|
||||
down() {
|
||||
load_env || addr=198.18.0.1
|
||||
down_children
|
||||
rm -f "$run_dir/ready"
|
||||
nft delete table inet "$table" 2>/dev/null
|
||||
ip addr del "$addr/32" dev lo 2>/dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
systemd=false
|
||||
[[ -d /run/systemd/system ]] && systemd=true
|
||||
|
||||
# put FILE MODE OWNER: FILE from stdin, written only when it differs; 0 when it changed.
|
||||
put() {
|
||||
local tmp
|
||||
tmp=$(mktemp)
|
||||
cat >"$tmp"
|
||||
if cmp -s "$tmp" "$1"; then
|
||||
rm -f "$tmp"
|
||||
return 1
|
||||
fi
|
||||
install -m "$2" -o root -g "$3" "$tmp" "$1"
|
||||
rm -f "$tmp"
|
||||
}
|
||||
|
||||
# dnsmasq_conf: dnsmasq's settings, read with --conf-file, so /etc/dnsmasq.conf and /etc/dnsmasq.d
|
||||
# aren't. Every name's A record is the stand-in address, with TTL 0, and every other type is an empty
|
||||
# answer, never REFUSED, which musl waits 5 s on. /etc/hosts comes first: localhost, the VM's
|
||||
# hostname, host.lima.internal and the links' names keep their own addresses. A name without a dot,
|
||||
# and any other name under devvm.internal, doesn't exist.
|
||||
dnsmasq_conf() {
|
||||
cat <<EOF
|
||||
# devvm: names for tools that skip the proxy (devvm-transparent). No upstream: nothing leaves the VM.
|
||||
port=53
|
||||
listen-address=$addr
|
||||
bind-interfaces
|
||||
no-resolv
|
||||
no-poll
|
||||
pid-file=
|
||||
user=$user
|
||||
group=$user
|
||||
address=/#/$addr
|
||||
local=/#/
|
||||
address=/localhost/127.0.0.1
|
||||
address=/localhost/::1
|
||||
address=/devvm.internal/
|
||||
address=//
|
||||
log-queries
|
||||
EOF
|
||||
# systemd's journal keeps stderr; OpenRC's service doesn't, so there it's syslog.
|
||||
! $systemd || echo 'log-facility=-'
|
||||
}
|
||||
|
||||
unit() {
|
||||
cat <<'EOF'
|
||||
[Unit]
|
||||
Description=devvm: names and connections for tools that skip the proxy
|
||||
After=network.target systemd-resolved.service
|
||||
ConditionPathExists=/etc/devvm/transparent/env
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/sbin/devvm-transparent run
|
||||
ExecStopPost=/usr/local/sbin/devvm-transparent down
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
KillMode=control-group
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
}
|
||||
|
||||
openrc() {
|
||||
cat <<'EOF'
|
||||
#!/sbin/openrc-run
|
||||
description="devvm: names and connections for tools that skip the proxy"
|
||||
supervisor=supervise-daemon
|
||||
command=/usr/local/sbin/devvm-transparent
|
||||
command_args=run
|
||||
respawn_delay=1
|
||||
respawn_max=0
|
||||
depend() { need net localmount; after firewall; }
|
||||
start_pre() { [ -f /etc/devvm/transparent/env ]; }
|
||||
stop_post() { /usr/local/sbin/devvm-transparent down; }
|
||||
EOF
|
||||
}
|
||||
|
||||
setup() {
|
||||
addr=$1 host=$2
|
||||
local url hp auth changed=false svc
|
||||
for p in dnsmasq socat nft; do command -v "$p" >/dev/null || exit 3; done
|
||||
IFS= read -r url
|
||||
hp=${url#http://} auth=''
|
||||
if [[ $hp == *@* ]]; then auth=${hp%%@*} hp=${hp#*@}; fi
|
||||
proxy_host=${hp%:*} proxy_port=${hp##*:}
|
||||
proxy_port=${proxy_port%%/*}
|
||||
# The user dnsmasq and socat's connections run as: shadow's tools, else busybox's.
|
||||
grep -q "^$user:" /etc/group || groupadd --system "$user" 2>/dev/null || addgroup -S "$user"
|
||||
grep -q "^$user:" /etc/passwd || useradd --system --no-create-home --home-dir /nonexistent --shell /sbin/nologin -g "$user" "$user" 2>/dev/null ||
|
||||
adduser -S -D -H -h /nonexistent -s /sbin/nologin -G "$user" "$user"
|
||||
install -d -m 755 "$tp"
|
||||
printf 'addr=%s\nhost=%s\nproxy_host=%s\nproxy_port=%s\n' "$addr" "$host" "$proxy_host" "$proxy_port" | put "$tp/env" 644 root && changed=true
|
||||
printf '%s' "$auth" | put "$tp/auth" 640 "$user" && changed=true
|
||||
printf 'proxy = "http://%s:%s"\nproxy-user = "%s"\nnoproxy = ""\n' "$proxy_host" "$proxy_port" "$auth" | put "$tp/curlrc" 600 root || true
|
||||
dnsmasq_conf | put "$tp/dnsmasq.conf" 644 root && changed=true
|
||||
put "$self" 755 root <"$0" && changed=true
|
||||
if $systemd; then
|
||||
svc=/etc/systemd/system/devvm-transparent.service
|
||||
unit | put "$svc" 644 root && { changed=true; systemctl daemon-reload; }
|
||||
systemctl enable devvm-transparent.service >/dev/null 2>&1
|
||||
else
|
||||
openrc | put /etc/init.d/devvm-transparent 755 root && changed=true
|
||||
rc-update add devvm-transparent default >/dev/null 2>&1
|
||||
fi
|
||||
# The ports now, so the first shell has them, which a running service takes at once (reload); else
|
||||
# the last ones, else 80 and 443.
|
||||
if fetch; then
|
||||
mkdir -p "$run_dir" && chmod 700 "$run_dir" && touch "$run_dir/reload"
|
||||
fi
|
||||
[[ -s $tp/ports ]] || printf '80\n443\n' >"$tp/ports"
|
||||
if $changed; then
|
||||
rm -f "$run_dir/ready"
|
||||
if $systemd; then systemctl restart devvm-transparent; else rc-service devvm-transparent restart >/dev/null; fi
|
||||
elif $systemd; then
|
||||
systemctl start devvm-transparent
|
||||
else
|
||||
rc-service devvm-transparent status >/dev/null 2>&1 || rc-service devvm-transparent start >/dev/null
|
||||
fi
|
||||
local i=0
|
||||
until [[ -e $run_dir/ready && ! -e $run_dir/reload ]]; do
|
||||
i=$((i + 1))
|
||||
((i <= 100)) || { echo "devvm-transparent: the service didn't start" >&2; return 1; }
|
||||
sleep 0.1
|
||||
done
|
||||
}
|
||||
|
||||
teardown() {
|
||||
[[ -e $self || -e $tp ]] || return 0
|
||||
if $systemd; then
|
||||
systemctl disable --now devvm-transparent.service >/dev/null 2>&1
|
||||
rm -f /etc/systemd/system/devvm-transparent.service
|
||||
systemctl daemon-reload
|
||||
else
|
||||
rc-service devvm-transparent stop >/dev/null 2>&1
|
||||
rc-update del devvm-transparent default >/dev/null 2>&1
|
||||
rm -f /etc/init.d/devvm-transparent
|
||||
fi
|
||||
down
|
||||
rm -rf "$tp" "$run_dir" "$self"
|
||||
! $systemd || resolvectl flush-caches 2>/dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
status() {
|
||||
local ports
|
||||
if [[ -e $run_dir/ready ]]; then
|
||||
ports=$(tr '\n' ' ' <"$tp/ports" 2>/dev/null)
|
||||
echo "Transparent mode: on, for ports ${ports% }; other ports are refused."
|
||||
else
|
||||
echo "Transparent mode: not running."
|
||||
return 0
|
||||
fi
|
||||
echo "Refused lately (a port devvm doesn't send to the proxy):"
|
||||
if $systemd; then
|
||||
journalctl -k -n 1000 -o short-iso --no-pager 2>/dev/null | grep 'devvm-transparent refused: ' | tail -10 |
|
||||
sed -E 's/^([^ ]+).* DPT=([0-9]+).*/ \2 at \1/'
|
||||
else
|
||||
dmesg 2>/dev/null | grep 'devvm-transparent refused: ' | tail -10 | sed -E 's/.* DPT=([0-9]+).*/ \1/'
|
||||
fi
|
||||
echo "Names looked up lately:"
|
||||
{ if $systemd; then journalctl -u devvm-transparent -n 1000 -o cat --no-pager 2>/dev/null; else cat /var/log/messages 2>/dev/null; fi; } |
|
||||
grep -oE 'query\[A\] [^ ]+' | awk '{ print " " $2 }' | tail -10
|
||||
}
|
||||
|
||||
case ${1:-} in
|
||||
setup) shift; setup "$@" ;;
|
||||
teardown) teardown ;;
|
||||
run) run ;;
|
||||
down) down ;;
|
||||
status) status ;;
|
||||
render) shift; resolvers=${DEVVM_TRANSPARENT_RESOLVERS:-}; render "$@" ;;
|
||||
slots) shift; slots "$@" ;;
|
||||
valid) valid_ports "${2:?}" ;;
|
||||
*) grep '^# devvm-transparent ' "$0" >&2; exit 2 ;;
|
||||
esac
|
||||
+38
-22
@@ -4,37 +4,50 @@
|
||||
set -euxo pipefail
|
||||
: "${devvm_arch:?}" "${devvm_libc:?}" # devvm's prelude (prelude.sh) comes before this script
|
||||
# Pinned downloads (scripts/bump.sh updates them).
|
||||
mise_version=2026.10.7
|
||||
mise_sha256_arm64=c7108d85a32ba17e4747d31d4a42f39f0c134f16211e204e8ef0a49d4f518fe1
|
||||
mise_sha256_amd64=6eb1b890e90818417ca34c90dbbd47881917d5cd199f31b63b062ea9c6b18d85
|
||||
mise_sha256_arm64_musl=e036eb7bd3ca63e8565497e597967484330a74ff24e9c4c9f2ac41824cbf4090
|
||||
mise_sha256_amd64_musl=fc5137a3147494e039c3d5fc3d84de354170d7d8dafdb0b5f0b6f3f19d1dd922
|
||||
mise_version=2026.11.3
|
||||
mise_sha256_arm64=a9a2a66bbbe87ea9cc849e1f006606ae2b34f3d3ba56a54d5cd5d64b6557d164
|
||||
mise_sha256_amd64=c2f7e814cb39f60b7f67a0ff36cb805e94128bf2dff09d175309d0f095b8cc3b
|
||||
mise_sha256_arm64_musl=78c87fb8c8af031755f9241cbcd1886cd458c75e8f324020015445a776789e38
|
||||
mise_sha256_amd64_musl=72f1cb4591ee2ba90150022c3ee8aea4dd88fadac10c56d04ede4faffb5a1b03
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
# Alpine (--from alpine): apk, OpenRC and musl. Its packages come from the release's repositories,
|
||||
# which have no snapshots: they aren't pinned.
|
||||
if [[ $devvm_libc == musl ]]; then
|
||||
# GNU tar: devvm's launch sends files with it (busybox's lacks options it uses). sqlite: an export
|
||||
# of agents' history copies opencode's database without its logins with it.
|
||||
# of agents' history copies opencode's database without its logins with it. icu-libs: the dotnet
|
||||
# shared tool's .NET needs ICU. fd: the pi shared tool finds files with it, and downloads it
|
||||
# itself, unpinned, where it's missing. dnsmasq, socat and nftables: transparent mode
|
||||
# (guest/transparent.sh), whose service only a confined VM's setup enables.
|
||||
sudo apk add --no-cache git curl wget ca-certificates build-base unzip jq ripgrep bash coreutils tar \
|
||||
util-linux util-linux-misc losetup findmnt erofs-utils sqlite
|
||||
util-linux util-linux-misc losetup findmnt erofs-utils sqlite icu-libs fd dnsmasq socat nftables
|
||||
echo "devvm: Alpine's packages aren't pinned" >&2
|
||||
else
|
||||
# The package lists are apt.sh begin's: base's packages are recorded at its first build and replayed
|
||||
# from devvm's cache after (layers/apt.sh), and a --from image's come from its own sources, unpinned.
|
||||
# erofs-utils: the shared tools' builds make their images with it, in a VM cloned from base. sqlite3:
|
||||
# an export of agents' history copies opencode's database without its logins with it.
|
||||
sudo apt-get install -y git curl wget ca-certificates build-essential unzip jq ripgrep erofs-utils sqlite3
|
||||
# an export of agents' history copies opencode's database without its logins with it. ICU: the dotnet
|
||||
# shared tool's .NET needs it, and its package's name has its version (libicu76), so it's the newest
|
||||
# libicuN the package lists have (a replay's lists have only the one recorded). fd-find (fdfind): the
|
||||
# pi shared tool finds files with it, and downloads fd itself, unpinned, where it's missing.
|
||||
# dnsmasq-base (dnsmasq alone, no service of its own), socat and nftables: transparent mode
|
||||
# (guest/transparent.sh), whose service only a confined VM's setup enables.
|
||||
icu=$(apt-cache pkgnames libicu | grep -E '^libicu[0-9]+$' | sort -V | tail -1 || true)
|
||||
sudo apt-get install -y git curl wget ca-certificates build-essential unzip jq ripgrep erofs-utils sqlite3 fd-find \
|
||||
dnsmasq-base socat nftables ${icu:+"$icu"}
|
||||
fi
|
||||
|
||||
# devvm-fetch URL SHA256 OUT: every layer downloads through this, so an image only ever contains
|
||||
# files whose checksums are pinned in devvm's scripts.
|
||||
# files whose checksums are pinned in devvm's scripts. A SHA-512 (128 hex digits) is checked as one:
|
||||
# the shared tools' build gets the .NET SDK's from the tools lock.
|
||||
sudo tee /usr/local/bin/devvm-fetch >/dev/null <<'SH'
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
url=$1 want=$2 out=$3
|
||||
curl -fsSL --retry 3 -o "$out" "$url"
|
||||
got=$(sha256sum "$out" | cut -d' ' -f1)
|
||||
sum=sha256sum
|
||||
[ "${#want}" -ne 128 ] || sum=sha512sum
|
||||
got=$("$sum" "$out" | cut -d' ' -f1)
|
||||
if [ "$got" != "$want" ]; then
|
||||
rm -f "$out"
|
||||
printf 'devvm-fetch: checksum mismatch for %s\n expected %s\n got %s\n' "$url" "$want" "$got" >&2
|
||||
@@ -70,7 +83,7 @@ fi
|
||||
mkdir -p ~/.bashrc.d
|
||||
grep -qs bashrc.d ~/.bashrc || echo 'for f in ~/.bashrc.d/*.sh; do [ -r "$f" ] && . "$f"; done' >> ~/.bashrc
|
||||
|
||||
# mise runs the shared tools (node, python, go, rust, agents), read-only images mounted at
|
||||
# mise runs the shared tools (the toolchains and the coding agents), read-only images mounted at
|
||||
# /opt/devvm/tools by devvm-tools (guest/tools.sh). Each VM's tools and versions are in
|
||||
# /etc/mise/config.toml (written by guest/sync.sh); the user's own mise config and a project's version
|
||||
# files (.nvmrc, .python-version, ...) come first, and versions that aren't shared install into the VM.
|
||||
@@ -82,15 +95,20 @@ rm /tmp/mise
|
||||
# Every shell finds the tools: login shells through profile.d, interactive ones through mise activate
|
||||
# (it follows `cd` into projects with other versions), and the rest (`bash -c` from agents, editors
|
||||
# over SSH) through BASH_ENV and mise's shims. Read-only installs can't take global packages or update
|
||||
# themselves: npm installs globals into ~/.npm-global, and Claude Code's and opencode's auto-updates
|
||||
# are off.
|
||||
# themselves, so global installs go into the VM's home, on the PATH, and the coding agents'
|
||||
# self-updates are off. The toolchains' environment and their folders for the PATH (devvm_path), and
|
||||
# the agents', come from /etc/devvm/toolchains.sh and /etc/devvm/agents.sh, which every launch's setup
|
||||
# writes from devvm's registries, so a new toolchain or agent changes no image. Their telemetry and
|
||||
# version checks are off here rather than in devvm-telemetry.sh, so a tool that a non-login shell runs
|
||||
# (ssh VM pi, an editor's terminal) sends none either.
|
||||
sudo tee /etc/profile.d/devvm-tools.sh >/dev/null <<'SH'
|
||||
devvm_path=
|
||||
if [ -r /etc/devvm/toolchains.sh ]; then . /etc/devvm/toolchains.sh; fi
|
||||
case ":$PATH:" in *":$HOME/.local/share/mise/shims:"*) ;; *)
|
||||
export PATH="$HOME/.npm-global/bin:$HOME/go/bin:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH" ;;
|
||||
export PATH="$devvm_path$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH" ;;
|
||||
esac
|
||||
export NPM_CONFIG_PREFIX="$HOME/.npm-global"
|
||||
export DISABLE_AUTOUPDATER=1
|
||||
export OPENCODE_DISABLE_AUTOUPDATE=1
|
||||
unset devvm_path
|
||||
if [ -r /etc/devvm/agents.sh ]; then . /etc/devvm/agents.sh; fi
|
||||
SH
|
||||
grep -qs devvm-tools /etc/environment || echo 'BASH_ENV=/etc/profile.d/devvm-tools.sh' | sudo tee -a /etc/environment >/dev/null
|
||||
echo 'eval "$(mise activate bash)"' > ~/.bashrc.d/mise.sh
|
||||
@@ -129,11 +147,10 @@ SH
|
||||
sudo chmod 755 /usr/local/bin/xdg-open
|
||||
echo 'export BROWSER=xdg-open' | sudo tee /etc/profile.d/devvm-browser.sh >/dev/null
|
||||
|
||||
# Telemetry off for every tool that has a switch (installed by devvm or commonly by projects).
|
||||
# Telemetry off for every tool that has a switch (installed by devvm or commonly by projects), but
|
||||
# the toolchains' and the coding agents', which devvm-tools.sh turns off in every shell.
|
||||
sudo tee /etc/profile.d/devvm-telemetry.sh >/dev/null <<'SH'
|
||||
export DO_NOT_TRACK=1 # generic opt-out (bun and others)
|
||||
export DISABLE_TELEMETRY=1 # Claude Code
|
||||
export DISABLE_ERROR_REPORTING=1 # Claude Code
|
||||
export NEXT_TELEMETRY_DISABLED=1
|
||||
export TURBO_TELEMETRY_DISABLED=1
|
||||
export ASTRO_TELEMETRY_DISABLED=1
|
||||
@@ -141,7 +158,6 @@ export NUXT_TELEMETRY_DISABLED=1
|
||||
export GATSBY_TELEMETRY_DISABLED=1
|
||||
export STORYBOOK_DISABLE_TELEMETRY=1
|
||||
export YARN_ENABLE_TELEMETRY=0
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
SH
|
||||
# Ubuntu: no news fetched for the login banner or apt output.
|
||||
sudo sed -i 's/^ENABLED=1/ENABLED=0/' /etc/default/motd-news 2>/dev/null || true
|
||||
|
||||
@@ -5,11 +5,11 @@ set -euxo pipefail
|
||||
: "${devvm_libc:?}" # devvm's prelude (prelude.sh) comes before this script
|
||||
# Pinned downloads (scripts/bump.sh updates them). Docker's repository has no snapshots: its packages
|
||||
# are pinned by version.
|
||||
docker_version=29.9.0
|
||||
containerd_version=2.4.1
|
||||
buildx_version=0.38.0
|
||||
compose_version=5.6.0
|
||||
model_version=1.2.6
|
||||
docker_version=29.9.3
|
||||
containerd_version=2.4.2
|
||||
buildx_version=0.38.1
|
||||
compose_version=5.7.0
|
||||
model_version=1.2.9
|
||||
docker_gpg_sha256=1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570
|
||||
|
||||
# Alpine (--from alpine): Docker is Alpine's own package, from the release's repositories, which have
|
||||
|
||||
@@ -7,9 +7,9 @@ set -euxo pipefail
|
||||
: "${devvm_arch:?}" "${devvm_libc:?}" # devvm's prelude (prelude.sh) comes before this script
|
||||
# Pinned downloads (scripts/bump.sh updates them). Nix's release tarball, with its own installer;
|
||||
# nix-direnv is one script, the same on every architecture.
|
||||
nix_version=2.35.4
|
||||
nix_sha256_arm64=14a940a2d0ae5b2c623dc2ca168311c9367fd4bc416f6ded0c1087089d6de934
|
||||
nix_sha256_amd64=ff66236d2f7e2a21f3350e73668e021ac6a8881ef277a38e16e952bfb22718c3
|
||||
nix_version=2.35.5
|
||||
nix_sha256_arm64=34b8d0c0658321e63143f892086bd2d9623a81bf96e4ffefc1551092d80caedb
|
||||
nix_sha256_amd64=c349f0559b7849a2cb3b20b8584e532b3fcf5025092cb6180eb0b99240d7b96c
|
||||
direnv_version=2.38.2
|
||||
direnv_sha256_arm64=ec2a32dbe2f19dd085bd9315a1b4ea88b55ec288aa7eabe8723490baf466cb23
|
||||
direnv_sha256_amd64=148820a187930d36ca6a204504e5cdb30d8396cd1a97e64c3b3f10d793c11247
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# (~/.local/share/devvm/mise.lock) in its .build folder. Each tool gets a VM and a folder of its own,
|
||||
# so nothing one tool's installer does, as root or not, reaches another tool's image.
|
||||
# build.sh TOOL VERSION FILE
|
||||
# build.sh dotnet VERSION FILE URL SHA512
|
||||
# The tool is installed at exactly the locked version (checked against the lock's checksums), then
|
||||
# packed into one compressed read-only EROFS image, FILE in that folder; devvm moves it into the share
|
||||
# and records its hash. Project VMs mount it at /opt/devvm/tools/<tool>/<version>, where mise finds it
|
||||
@@ -14,11 +15,11 @@ set -euxo pipefail
|
||||
: "${devvm_arch:?}" "${devvm_libc:?}" # devvm's prelude (prelude.sh) comes before this script
|
||||
# Pinned downloads (scripts/bump.sh updates them). rustup checks the toolchain against Rust's signed
|
||||
# channel manifest.
|
||||
rustup_version=1.29.1
|
||||
rustup_sha256_arm64=15f6e4ce9f583b929c996c91562bad6d4454f3281de858b02cdfdef615fac433
|
||||
rustup_sha256_amd64=dda7234360b7f578ca8b0ddcb80145646fa61a67c1720a5abc7051b35c9fcb71
|
||||
rustup_sha256_arm64_musl=1ddf36182ac5d1782dbeefcb9bea7f5f9412d88f4a0d5047b1564a223624e8c6
|
||||
rustup_sha256_amd64_musl=331228566cc931f32cd684f9bebc5956a5e5d7394c8d5de595f196a658ab98e6
|
||||
rustup_version=1.29.3
|
||||
rustup_sha256_arm64=9f608c142e0e38a78957d0661ba1dfaf0b6fb37184cfaa4b9a0aa57af6184282
|
||||
rustup_sha256_amd64=b1c8cb14e30889e7e2999e6b69e62d9e9b9ffc0f4df8180564d306d9680e6c55
|
||||
rustup_sha256_arm64_musl=956deacdc27ab82ae7ac821d5d3e9e95e4795d476d17efe99743bb8531ca1031
|
||||
rustup_sha256_amd64_musl=1552169aba2836777136ccff7a381e95c17233b5d8250cd5e10ae3cb971bfcfc
|
||||
|
||||
share=/mnt/devvm-tools
|
||||
# Where VMs mount the tools: installs record absolute paths (mise's bin links, scripts' shebangs).
|
||||
@@ -57,7 +58,8 @@ glibc_needs() {
|
||||
rm -f "$files" "$elf"
|
||||
}
|
||||
[[ $devvm_libc != gnu ]] || command -v readelf >/dev/null || { echo "build.sh: base has no readelf (binutils)" >&2; exit 1; }
|
||||
(( $# == 3 )) || { echo "build.sh: wants TOOL VERSION FILE, got $# arguments" >&2; exit 2; }
|
||||
(( $# == 3 )) || [[ $# == 5 && $1 == dotnet ]] ||
|
||||
{ echo "build.sh: wants TOOL VERSION FILE (dotnet: and URL SHA512), got $# arguments" >&2; exit 2; }
|
||||
tool=$1 version=$2 file=$3
|
||||
|
||||
wait_share
|
||||
@@ -75,6 +77,22 @@ if [[ $tool == rust ]]; then
|
||||
RUSTUP_HOME=$work/rustup CARGO_HOME=$work/cargo "$dir/rustup-init" -y -q --no-modify-path \
|
||||
--profile default --default-toolchain "$version" -c rust-src -c rust-analyzer
|
||||
mv "$work/rustup/toolchains/$version-$triple" "$dir/toolchain"
|
||||
elif [[ $tool == dotnet ]]; then
|
||||
# Microsoft's SDK archive, the lock's download for this platform, which devvm passes with the
|
||||
# SHA-512 the lock records for it: mise's own installer runs Microsoft's install script, which
|
||||
# checks nothing.
|
||||
[[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ && $# == 5 ]] || { echo "build.sh: dotnet wants a release's VERSION, URL and SHA512" >&2; exit 2; }
|
||||
dir=$work/dotnet/$version; mkdir -p "$dir"
|
||||
devvm-fetch "$4" "$5" /tmp/dotnet-sdk.tar.gz
|
||||
tar -xzf /tmp/dotnet-sdk.tar.gz -C "$dir"
|
||||
rm /tmp/dotnet-sdk.tar.gz
|
||||
sdks=$("$dir/dotnet" --list-sdks)
|
||||
[[ $sdks == "$version "* ]] || { echo "build.sh: the archive has another SDK than $version: $sdks" >&2; exit 1; }
|
||||
# Workloads install into the user's ~/.dotnet, which the SDK does when its folder has this marker
|
||||
# for its feature band (10.0.400 for 10.0.403): the SDK's own folder is read-only in VMs.
|
||||
band=${version%.*}.$(( ${version##*.} / 100 * 100 ))
|
||||
mkdir -p "$dir/metadata/workloads/$band"
|
||||
touch "$dir/metadata/workloads/$band/userlocal"
|
||||
else
|
||||
# By name: mise resolves mise.toml's version through the lock (an explicit tool@version isn't
|
||||
# matched to the lock's entry).
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# dotnet: NuGet's packages and tools, and the revocation lists of DigiCert, which issues NuGet's
|
||||
# signing certificates, that NuGet checks each package's signatures against; the SDKs mise installs
|
||||
# for a global.json's version (the install script at dot.net, the SDK's archive). Microsoft's
|
||||
# telemetry is left out.
|
||||
api.nuget.org
|
||||
crl3.digicert.com:80
|
||||
dot.net
|
||||
builds.dotnet.microsoft.com
|
||||
@@ -1,6 +1,18 @@
|
||||
# The shared tools (the docs' images page, "Shared tools"). devvm resolves each, per user, to upstream's newest
|
||||
# release matching its version here, into ~/.local/share/devvm/mise.lock with each download's checksum
|
||||
# per platform. A version here is a hold (node = "24"); nothing is pinned.
|
||||
|
||||
# Where each tool that isn't one of mise's own (core:) comes from, named here so that mise's registry
|
||||
# can't move it to another source: its first choice can change between mise releases (opencode 2
|
||||
# moved to npm, which has no download per platform). VMs' mise gets the same list.
|
||||
[tool_alias]
|
||||
claude = "aqua:anthropics/claude-code"
|
||||
codex = "aqua:openai/codex"
|
||||
opencode = "github:anomalyco/opencode" # its GitHub releases: a musl build of its own, attested
|
||||
pi = "github:earendil-works/pi" # its GitHub releases: one Bun-built program per platform, glibc only
|
||||
pnpm = "aqua:pnpm/pnpm"
|
||||
uv = "aqua:astral-sh/uv"
|
||||
|
||||
[tools]
|
||||
node = "24" # Node 25+ drops corepack
|
||||
pnpm = "latest"
|
||||
@@ -9,9 +21,11 @@ python = "latest"
|
||||
uv = "latest"
|
||||
go = "latest"
|
||||
rust = "latest" # installed with the rustup pinned in build.sh; rustup checks the toolchain
|
||||
dotnet = "latest" # the SDK; devvm adds its downloads and their SHA-512 from Microsoft's releases
|
||||
claude = "latest"
|
||||
codex = "latest"
|
||||
opencode = "2" # upstream marks its 1.x releases as GitHub's latest, which "latest" resolves to
|
||||
pi = "latest"
|
||||
|
||||
[settings]
|
||||
experimental = true
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# pi: its model catalog. Its version check and install report go to the same host, and every VM turns
|
||||
# them off (PI_SKIP_VERSION_CHECK, PI_TELEMETRY). Add your model provider's API host
|
||||
# (e.g. api.anthropic.com, api.openai.com) with `devvm network allow`.
|
||||
pi.dev
|
||||
@@ -0,0 +1,159 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// bashes are the shells guest/transparent.sh's test runs it with: bash on
|
||||
// the PATH, and macOS's /bin/bash, which is 3.2, as in-VM scripts must
|
||||
// run on.
|
||||
func bashes(t *testing.T) []string {
|
||||
t.Helper()
|
||||
var out []string
|
||||
if p, err := exec.LookPath("bash"); err == nil {
|
||||
out = append(out, p)
|
||||
}
|
||||
if _, err := os.Stat("/bin/bash"); err == nil && !slices.Contains(out, "/bin/bash") {
|
||||
out = append(out, "/bin/bash")
|
||||
}
|
||||
if len(out) == 0 {
|
||||
t.Skip("no bash")
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// transparentScript writes guest/transparent.sh into a folder of the
|
||||
// test's own, and returns its path and the folder, its files' folder.
|
||||
func transparentScript(t *testing.T) (string, string) {
|
||||
t.Helper()
|
||||
b, err := fs.ReadFile(FS, "guest/transparent.sh")
|
||||
must(t, err)
|
||||
dir := t.TempDir()
|
||||
f := filepath.Join(dir, "transparent.sh")
|
||||
must(t, os.WriteFile(f, b, 0o600))
|
||||
return f, dir
|
||||
}
|
||||
|
||||
// runTransparent runs the script with bash and args, its files in dir,
|
||||
// and returns its output and whether it succeeded.
|
||||
func runTransparent(t *testing.T, bash, script, dir string, args ...string) (string, bool) {
|
||||
t.Helper()
|
||||
cmd := exec.CommandContext(t.Context(), bash, append([]string{script}, args...)...) //nolint:gosec // G204: devvm's own embedded script, with the test's arguments
|
||||
cmd.Env = append(os.Environ(), "DEVVM_TRANSPARENT_DIR="+dir, "DEVVM_TRANSPARENT_RESOLVERS=192.168.5.2 10.0.2.3")
|
||||
out, err := cmd.Output()
|
||||
return string(out), err == nil
|
||||
}
|
||||
|
||||
// The ruleset: each redirected port to its listener, every other port of
|
||||
// the stand-in address to the dead port (so Docker's published ports never
|
||||
// take it), DNS to public servers and 127.0.0.1 to dnsmasq, private ones
|
||||
// left alone, and nftables takes it where it can be asked.
|
||||
func TestTransparentRuleset(t *testing.T) {
|
||||
script, dir := transparentScript(t)
|
||||
for _, bash := range bashes(t) {
|
||||
out, ok := runTransparent(t, bash, script, dir, "render", "80=61080", "443=61443", "8443=61100")
|
||||
if !ok {
|
||||
t.Fatalf("%s: render failed:\n%s", bash, out)
|
||||
}
|
||||
for _, want := range []string{
|
||||
"ip daddr 198.18.0.1 tcp dport 80 dnat ip to 198.18.0.1:61080",
|
||||
"ip daddr 198.18.0.1 tcp dport 8443 dnat ip to 198.18.0.1:61100",
|
||||
"meta l4proto tcp dnat ip to 198.18.0.1:61079",
|
||||
"meta l4proto udp dnat ip to 198.18.0.1:61079",
|
||||
"udp dport 53 dnat ip to 198.18.0.1:53",
|
||||
"ip daddr 127.0.0.1 tcp dport 53 dnat ip to 198.18.0.1:53",
|
||||
"ip daddr != @kept udp dport 53 dnat ip to 198.18.0.1:53",
|
||||
"ip daddr { 192.168.5.2, 10.0.2.3 } tcp dport 53 dnat ip to 198.18.0.1:53",
|
||||
"10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.168.0.0/16",
|
||||
"type nat hook output priority -110;",
|
||||
"type nat hook prerouting priority -110;",
|
||||
`iifname "br-*" jump from_containers`,
|
||||
"type filter hook prerouting priority -150;",
|
||||
"type filter hook output priority -150;",
|
||||
`ip daddr 198.18.0.1 iifname != "lo" iifname != "docker0" iifname != "br-*" drop`,
|
||||
"ip daddr 198.18.0.1 meta l4proto != { tcp, udp, icmp } drop",
|
||||
} {
|
||||
if !strings.Contains(out, want) {
|
||||
t.Errorf("%s: the ruleset lacks %q:\n%s", bash, want, out)
|
||||
}
|
||||
}
|
||||
// IPv6 leaves the sentinel before anything else: an inet table's
|
||||
// ip daddr matches IPv4 alone, so an IPv6 connection would get past
|
||||
// the address's return and be logged as refused. The log is the
|
||||
// sentinel's alone.
|
||||
if !strings.Contains(out, " chain sentinel {\n meta nfproto != ipv4 return\n ip daddr != 198.18.0.1 return\n") ||
|
||||
strings.Count(out, "log prefix") != 1 || strings.Index(out, "log prefix") < strings.Index(out, "chain sentinel {") {
|
||||
t.Errorf("%s: the sentinel doesn't return IPv6 first:\n%s", bash, out)
|
||||
}
|
||||
if strings.Count(out, "{") != strings.Count(out, "}") || strings.Count(out, "jump sentinel") != 2 {
|
||||
t.Errorf("%s: unbalanced, or a chain without the stand-in address's ports:\n%s", bash, out)
|
||||
}
|
||||
if n, err := exec.LookPath("nft"); err == nil {
|
||||
f := filepath.Join(dir, "rules.nft")
|
||||
must(t, os.WriteFile(f, []byte(out), 0o600))
|
||||
if b, err := exec.CommandContext(t.Context(), n, "-c", "-f", f).CombinedOutput(); err != nil { //nolint:gosec // G204: nft from the PATH, checking the test's ruleset
|
||||
if strings.Contains(string(b), "Operation not permitted") {
|
||||
t.Log("nft -c can't run here")
|
||||
} else {
|
||||
t.Errorf("nft -c refused it: %v\n%s", err, b)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Each port past 80 and 443 keeps the listener it had while it stays, a
|
||||
// port that's gone frees its own, and a new one takes the lowest free.
|
||||
func TestTransparentSlots(t *testing.T) {
|
||||
script, dir := transparentScript(t)
|
||||
must(t, os.WriteFile(filepath.Join(dir, "slots"), []byte("8080 61101\n9000 61100\n"), 0o600))
|
||||
for _, bash := range bashes(t) {
|
||||
out, ok := runTransparent(t, bash, script, dir, "slots", "80", "443", "9000", "8443", "7000")
|
||||
if want := "80 61080\n443 61443\n9000 61100\n8443 61101\n7000 61102\n"; !ok || out != want {
|
||||
t.Errorf("%s: slots:\n%s\nwant:\n%s", bash, out, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The proxy's port list goes into the ruleset only when it's 2 to 34
|
||||
// ports, each once, with 80 and 443, never 22 or 53.
|
||||
func TestTransparentPortList(t *testing.T) {
|
||||
script, dir := transparentScript(t)
|
||||
many := "80\n443\n"
|
||||
for p := 9000; p < 9033; p++ {
|
||||
many += strconv.Itoa(p) + "\n"
|
||||
}
|
||||
for _, bash := range bashes(t) {
|
||||
for _, c := range []struct {
|
||||
list string
|
||||
ok bool
|
||||
}{
|
||||
{"80\n443\n", true},
|
||||
{"80\n443\n8443\n", true},
|
||||
{"443\n80\n", true},
|
||||
{"80\n", false},
|
||||
{"80\n8443\n", false},
|
||||
{"80\n443\n22\n", false},
|
||||
{"80\n443\n53\n", false},
|
||||
{"80\n443\n8443\n8443\n", false},
|
||||
{"80\n443\n65536\n", false},
|
||||
{"80\n443\n08443\n", false},
|
||||
{"80\n443\n84 43\n", false},
|
||||
{"80\n443\n$(id)\n", false},
|
||||
{many, false},
|
||||
} {
|
||||
f := filepath.Join(dir, "ports-list")
|
||||
must(t, os.WriteFile(f, []byte(c.list), 0o600))
|
||||
if _, ok := runTransparent(t, bash, script, dir, "valid", f); ok != c.ok {
|
||||
t.Errorf("%s: %q: %v, want %v", bash, c.list, ok, c.ok)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,93 @@
|
||||
Copyright 2022–2024 Helena Zhang (helenazhang.com).
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -1,5 +1,8 @@
|
||||
---
|
||||
title: devvm
|
||||
# The social card's title (layouts/_partials/og-image.html): the hero's headline, as the logo says devvm.
|
||||
cardTitle: One VM for every project
|
||||
explainer: An isolated sandbox for you or a coding agent
|
||||
layout: hextra-home
|
||||
# Mostly shortcodes: no Copy page menu (hugo.yaml gives the home page no Markdown copy).
|
||||
contextMenu: false
|
||||
@@ -57,13 +60,13 @@ Claude Code needs your Claude login before its first start, which `devvm agent l
|
||||
|
||||
{{< feature title="Toolchains" icon="code" level="3" art="toolchains" >}}
|
||||
|
||||
`devvm` chooses the toolchains your project's files call for, and you can choose more when you customize a new VM or name them with `--tools` ([toolchains](docs/using/toolchains.md)).
|
||||
`devvm` has [toolchains](docs/using/toolchains.md) for your project's languages, node among them. It chooses the ones your project's files call for, and you can choose more when you customize a new VM or name them with `--tools`.
|
||||
|
||||
{{< /feature >}}
|
||||
|
||||
{{< feature title="Coding agents" icon="robot" level="3" art="coding-agents" >}}
|
||||
|
||||
Claude Code, Codex and opencode run in the VM. Choose one when you customize a new VM, or choose them for every new VM in `devvm setup` ([coding agents](docs/using/coding-agents.md)).
|
||||
The [supported coding agents](docs/using/coding-agents.md#supported-agents) run in the VM, Claude Code among them. Choose one when you customize a new VM, or choose them for every new VM in `devvm setup` ([coding agents](docs/using/coding-agents.md)).
|
||||
|
||||
{{< /feature >}}
|
||||
|
||||
@@ -108,7 +111,7 @@ devvm ships the `docker`, `nix` and `desktop` layers, which you choose when you
|
||||
|
||||
- The VM mounts your project folder at the same path. Apart from your agents' settings from devvm's own store, which it gets read-only, it sees nothing else in your home folder ([what a VM can reach](docs/safety/_index.md#what-a-vm-can-reach)).
|
||||
- New VMs get the allowlist [network tier](docs/safety/network.md) by default, so they reach only an allowlist of hosts, through a proxy on your machine. You can choose a looser tier, internet or open, or a stricter one, none.
|
||||
- On macOS, `devvm` locks `.git`'s hooks and config, so the VM can't change what git runs on your machine ([.git protection](docs/safety/git-protection.md)).
|
||||
- `devvm` locks `.git`'s hooks and config, so the VM can't change what git runs on your machine, except on a Linux host whose kernel doesn't let it lock them, where it watches them instead ([.git protection](docs/safety/git-protection.md)).
|
||||
- With [`--clone`](docs/using/clone.md), the VM works on a clone of the repo of its own instead of your folder, so nothing in it can touch your working tree or `.git`, and its work reaches your repo only when you fetch it.
|
||||
- No sandbox closes every gap, so [attack vectors](docs/safety/attack-vectors.md#narrowed-not-closed) lists what's left open, and [staying safe](docs/safety/_index.md#the-habits) lists the habits that close most of it.
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Branding
|
||||
explainer: devvm's logo, icons, colors and fonts
|
||||
layout: branding
|
||||
description: "devvm's logo, icons, social card, colors and fonts, to download and use when you write about devvm."
|
||||
sidebar:
|
||||
@@ -46,7 +47,7 @@ The app icon at any size, and the icons the site uses for browser tabs and home
|
||||
|
||||
## The social card
|
||||
|
||||
The image that sites and chat apps show with a link to devvm.dev:
|
||||
The image to show with a link to devvm. Sites and chat apps show each page of devvm.dev with a card of its own in the same style, which has the page's section, its title and a line on what it covers.
|
||||
|
||||
{{< brand-assets wide="true" >}}
|
||||
{{< brand-asset title="Social card, 1200 by 630" src="images/social-card.png" bg="dark" alt="The devvm social card: the logo, One VM for every project, and the tagline" files="images/social-card.png" >}}
|
||||
@@ -60,7 +61,7 @@ Click a swatch to copy its hex.
|
||||
|
||||
## Fonts
|
||||
|
||||
All three are free under the SIL Open Font License.
|
||||
All three are free under the SIL Open Font License, and this site serves each one itself, with its license.
|
||||
|
||||
<!-- markdownlint-disable MD034 -- the font-sample shortcodes' parameters, not bare URLs -->
|
||||
|
||||
@@ -68,11 +69,11 @@ All three are free under the SIL Open Font License.
|
||||
A pixel font by Helena Zhang, for the logo, headings and buttons. It's sharp at multiples of 11px.
|
||||
{{< /font-sample >}}
|
||||
|
||||
{{< font-sample name="Instrument Sans" font="sans" link="https://fonts.google.com/specimen/Instrument+Sans" >}}
|
||||
{{< font-sample name="Instrument Sans" font="sans" link="https://github.com/Instrument/instrument-sans" license="fonts/instrument-sans/LICENSE" >}}
|
||||
The font for text.
|
||||
{{< /font-sample >}}
|
||||
|
||||
{{< font-sample name="Martian Mono" font="mono" link="https://fonts.google.com/specimen/Martian+Mono" >}}
|
||||
{{< font-sample name="Martian Mono" font="mono" link="https://github.com/evilmartians/mono" license="fonts/martian-mono/LICENSE" >}}
|
||||
The font for code, set narrower than its default and without ligatures.
|
||||
{{< /font-sample >}}
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
---
|
||||
title: Docs
|
||||
explainer: The guides, in the order you'll need them
|
||||
---
|
||||
|
||||
The docs are in the order you'll need them: getting devvm running, using it day to day, staying safe and choosing a backend, then every command, how devvm works and how to change it.
|
||||
The docs are in the order you'll need them: getting devvm running, using it day to day, staying safe, choosing a backend and comparing devvm with other tools, then every command, how devvm works and how to change it.
|
||||
|
||||
{{< cards >}}
|
||||
{{< section-card path="getting-started" >}}Installing devvm, making your first VM, and the commands you use most.{{< /section-card >}}
|
||||
{{< section-card path="using" >}}Images and toolchains, ports and size, coding agents, editors, settings, and what to do when something fails.{{< /section-card >}}
|
||||
{{< section-card path="safety" >}}The habits that keep you safe, network tiers, `.git` protection, and what devvm does about each attack.{{< /section-card >}}
|
||||
{{< section-card path="backends" >}}What runs the VMs: Lima.{{< /section-card >}}
|
||||
{{< section-card path="compared" >}}How devvm differs from Docker Sandboxes, other VM and OS sandboxes, and hosted ones.{{< /section-card >}}
|
||||
{{< section-card path="cli" >}}Every command, with its arguments and flags.{{< /section-card >}}
|
||||
{{< section-card path="internals" >}}How devvm builds images, forwards ports, confines VMs to their proxies and protects `.git`.{{< /section-card >}}
|
||||
{{< section-card path="contributing" >}}Building, testing and writing docs, other hosts, and releases.{{< /section-card >}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Backends
|
||||
explainer: The program that runs devvm's VMs
|
||||
weight: 40
|
||||
---
|
||||
|
||||
@@ -17,7 +18,7 @@ A backend is the program that runs devvm's VMs and builds their images. devvm de
|
||||
| The nix layer | {{< yes >}} yes |
|
||||
| Limits | paths with commas, and shrinking a disk ([limits](lima.md#limits)) |
|
||||
|
||||
`.git` protection uses your machine's file flags, so it doesn't depend on the backend.
|
||||
On macOS, `.git` protection uses your machine's file flags, so it doesn't depend on the backend. On Linux it needs the backend to keep paths in the project folder read-only in the VM, which Lima does where the kernel lets devvm use a user namespace ([.git protection on Linux hosts](../safety/git-protection.md#linux-hosts)).
|
||||
|
||||
An image's key includes its backend, so a backend never uses an image another backend built.
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Lima
|
||||
explainer: What Lima needs, and how devvm uses it
|
||||
weight: 1
|
||||
---
|
||||
|
||||
@@ -11,13 +12,13 @@ weight: 1
|
||||
{{< os-tab name="macOS" >}}
|
||||
|
||||
- macOS 13 or newer, on arm64 or x86_64.
|
||||
- Lima 2.0 or newer, with `limactl` on your `PATH`. Install it with Homebrew, `brew install lima`, or see [Lima's install guide](https://lima-vm.io/docs/installation/).
|
||||
- Lima 2.2 or newer, with `limactl` on your `PATH`. Install it with Homebrew, `brew install lima`, or see [Lima's install guide](https://lima-vm.io/docs/installation/).
|
||||
|
||||
{{< /os-tab >}}
|
||||
{{< os-tab name="Linux" >}}
|
||||
|
||||
- Linux on arm64 or x86_64.
|
||||
- Lima 2.0 or newer, with `limactl` on your `PATH`. Install it with Homebrew, `brew install lima`, or see [Lima's install guide](https://lima-vm.io/docs/installation/).
|
||||
- Lima 2.2 or newer, with `limactl` on your `PATH`. Install it with Homebrew, `brew install lima`, or see [Lima's install guide](https://lima-vm.io/docs/installation/).
|
||||
- QEMU from your package manager: `qemu-system-aarch64` (or `qemu-system-x86_64`) and `qemu-img`.
|
||||
- Read and write access to `/dev/kvm`. That means virtualization is turned on in the firmware (or nested virtualization, in a VM), and your user is in the `kvm` group.
|
||||
|
||||
@@ -62,14 +63,69 @@ To have a watcher see your edits, set it to poll the project folder, which costs
|
||||
|
||||
Set the variables in the VM's shell or in your project's scripts, before the tool starts. Leave Lima's own file event setting, `mountInotify`, off, because with it on, commands in the VM that write to the project folder, such as `git init`, fail at random ([details](../internals/lima.md#what-devvm-sets-on-a-vm)).
|
||||
|
||||
## The project folder's cache
|
||||
|
||||
On Linux, QEMU shares the project folder with the VM over 9p, and the VM's kernel can cache the folder's files as it reads and writes them. devvm gives every new VM the cache mode `none`, so the VM reads and writes straight through to the folder on this machine, and what you edit on either side is what the other side sees.
|
||||
|
||||
Lima's own default for a writable folder is `mmap`, which caches the files' contents in the VM, and Linux's 9p client loses data with it in two ways. When a program reads a file's size while another write is making the file longer, the VM can take the older size from this machine and drop the new data, even after `fsync` succeeded, so the file ends up empty or cut to 4096 bytes, and Claude Code's edits are one way to set it off. And when a program locks a file it has written, its next read of that file returns zeros. That stops SQLite at its second write with `file is not a database`, whatever its journal mode, and Gradle's second build with `Unexpected lock protocol found in lock file`.
|
||||
|
||||
A VM made before devvm chose `none` keeps `mmap`, and devvm doesn't change its mount on its own, so each launch of such a VM warns until you switch it. `devvm mount-cache` shows how this folder's VM caches its project folder, and `devvm mount-cache none` switches it from the VM's next start, so in a terminal devvm offers to restart a running VM now. `none` is the only mode devvm sets, so any other value is refused.
|
||||
|
||||
```sh
|
||||
devvm mount-cache
|
||||
devvm mount-cache none
|
||||
```
|
||||
|
||||
A [`--clone` VM](../using/clone.md) mounts no project folder, so it has no cache mode until `devvm clone off` mounts the folder, which then gets `none`. On macOS, VMs share the project folder with virtiofs, which has no cache mode to choose, so there `devvm mount-cache` refuses. On Linux it refuses the same for a VM whose project folder isn't a 9p mount, such as one whose Lima config you gave another mount type.
|
||||
|
||||
### When the cache mode changes
|
||||
|
||||
The VM gets `none` at its next start, and that start mounts the project folder again once the VM runs, before devvm sets the VM up or opens its shell. The VM's first mount of the folder at boot still has the old mode, because the guest reads its new mount options only after it has mounted the folder. devvm then checks the folder:
|
||||
|
||||
- When the folder is mounted with `none`, the VM goes on as usual.
|
||||
- When the folder is still mounted with the old mode, isn't mounted at all, or the VM doesn't answer the check, devvm restarts the VM once, before it sets it up or opens its shell. The folder can be left with the old mode when the VM couldn't unmount it, because something it started at boot, such as a container, was using it, or when the VM's start was degraded. It can be left unmounted when the VM unmounted it but couldn't mount it again, as happens on an Alpine VM. The restart's boot mounts the folder with `none`, and devvm checks it again.
|
||||
|
||||
After the restart, devvm checks the folder once more and doesn't restart the VM again:
|
||||
|
||||
- When the folder is mounted with `none`, the VM goes on as usual.
|
||||
- When the folder is still mounted with the old mode, devvm warns and goes on, though the folder can lose writes under that mode.
|
||||
- When the folder isn't mounted at all, or the VM doesn't answer the check, devvm stops the VM before it sets it up or opens its shell, because files written there would go to the VM's own disk and vanish once the folder is mounted over them.
|
||||
|
||||
In both cases a restart of your own repeats what failed, so look first at why the VM's boot didn't mount the folder with `none`. Its console log, which [A VM won't boot](../using/troubleshooting.md#a-vm-wont-boot) shows where to find, has what the boot said, and the run log has what the VM's `umount` and `mount` said and why devvm restarted the VM ([logs](../using/troubleshooting.md#a-command-fails)).
|
||||
|
||||
When devvm can't stop the VM for the restart, a folder still mounted with the old mode is warned of and the VM goes on as it runs. Otherwise the launch fails, saying the VM didn't stop, because it may still be running. Pressing Ctrl+C while devvm mounts or checks the folder, or stops the VM for the restart, stops the VM, without a restart. A launch into a running VM checks too that its project folder is mounted, and refuses to open a shell in one whose folder isn't, naming `devvm restart`.
|
||||
|
||||
### devvm mount-cache --json
|
||||
|
||||
`devvm mount-cache --json` prints the VM's mode, whether it was chosen, as the VM was made or with `devvm mount-cache none`, rather than kept from Lima, and the mode its next start gives it, when that differs:
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"mode": "mmap",
|
||||
"chosen": true,
|
||||
"pending": "none"
|
||||
}
|
||||
```
|
||||
|
||||
### Programs that map files for writing
|
||||
|
||||
With `none`, a program in the VM can't map a file in the project folder for shared writing, or map one it opened for writing at all, and it fails at once with `Invalid argument`, so nothing is lost. LMDB, numpy's `memmap` in `r+` or `w+` mode, Java's read-write `MappedByteBuffer` and the mold linker do this, while git, npm, Vite, webpack, esbuild, jest, Go, cargo with Rust's own linker, GNU ld, lld, Gradle, DuckDB, ccache and Terraform work as they do on any disk. LMDB is what Parcel's `.parcel-cache` and Gatsby's cache use.
|
||||
|
||||
For a program that maps its files, keep them on the VM's own disk, such as in its home folder: for mold, a `CARGO_TARGET_DIR` there, or lld instead. Or use a [`--clone` VM](../using/clone.md), whose repo is on the VM's own disk. The VM's own disk is also far faster than the shared folder, so a `--clone` VM suits large repos and heavy builds: on a Fedora 43 host, `npm ci` of 369 packages took 4.8 s in the shared folder and 2.8 s on the VM's disk, a debug `cargo build` of ripgrep 8.5 s and 4.8 s, and a cold `git status` of an 18,000-file tree 23 s and 1 s.
|
||||
|
||||
### SQLite and the cache
|
||||
|
||||
SQLite's default journal works in the project folder. WAL mode doesn't, because SQLite maps its shared index and fails with `disk I/O error`, unless the connection sets `PRAGMA locking_mode=EXCLUSIVE` before `PRAGMA journal_mode=WAL`. That keeps the index in memory, and lets only that connection use the database. A project whose database is in WAL mode works in a `--clone` VM, or with the database outside the project folder, such as in the VM's home folder or `/tmp`.
|
||||
|
||||
## Cleaning up
|
||||
|
||||
`devvm gc` deletes devvm's stale and unfinished Lima images and the shared tools that no VM has and that aren't current, and it leaves your VMs as they are. `devvm images rm` deletes an image that's current, except on Linux hosts one whose disk VMs use ([cleaning up](../using/images.md#cleaning-up)). Lima also keeps a download cache of its own, which holds Ubuntu's cloud images that devvm's builds downloaded, and which your own Lima VMs share. `devvm gc --caches` deletes the cloud images that devvm downloads and that no image of devvm's names, after listing them and asking, and devvm never runs `limactl prune`, which empties the whole cache ([what devvm keeps](../using/space.md#lima)).
|
||||
|
||||
## Limits
|
||||
|
||||
- **Folder names in VM names are cut short.** Lima keeps each VM's ssh socket in the VM's folder in its home, and a socket path has at most 104 characters. A long Lima home leaves less room for the name, so set `DEVVM_LIMA_HOME` to a shorter folder if devvm says the home is too long, or that a VM's name leaves no room for the folder's name ([VM names](../internals/backends.md#vm-names)).
|
||||
- **Folder names in VM names are cut short.** Lima keeps each VM's ssh socket in the VM's folder in its home, and a socket path has fewer than 104 characters. A long Lima home leaves less room for the name, so set `DEVVM_LIMA_HOME` to a shorter folder if devvm says the home is too long, or that a VM's name leaves no room for the folder's name ([VM names](../internals/backends.md#vm-names)).
|
||||
- **Paths can't contain commas.** Lima and QEMU split mount options on commas, so devvm refuses to mount a project folder whose path has one, and it leaves out an agent's folder whose path has one, with a warning.
|
||||
- **Disks can grow but not shrink.**
|
||||
- **Mounts on Linux are 9p.** A 9p share mounts once per guest, and file watchers in the VM miss changes in its subfolders ([file watchers](#file-watchers)).
|
||||
- **Mounts on Linux are 9p.** A 9p share mounts once per guest, file watchers in the VM miss changes in its subfolders ([file watchers](#file-watchers)), and SQLite's WAL mode doesn't work in the project folder, which a `--clone` VM avoids ([SQLite and the cache](#sqlite-and-the-cache)).
|
||||
- **A VM that Lima reports as failed to start** still starts, with a warning, when it's running but degraded because one of Lima's boot scripts failed. A VM that doesn't answer over ssh within a minute is stopped instead, and its console log is in its Lima folder (`serial*.log`).
|
||||
Generated
+6
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: CLI reference
|
||||
weight: 90
|
||||
explainer: Every devvm command, with its arguments and flags
|
||||
---
|
||||
|
||||
Every devvm command, with its arguments and flags. `devvm <command> --help` prints the same.
|
||||
@@ -13,6 +14,8 @@ Every devvm command, with its arguments and flags. `devvm <command> --help` prin
|
||||
- [devvm agent save](devvm_agent_save.md): Copy the agents' settings from this folder's VM into devvm's store
|
||||
- [devvm build](devvm_build.md): Build an image and the images under it, unless they're built
|
||||
- [devvm clone](devvm_clone.md): Show or change whether this folder's VM has its own clone of the repo
|
||||
- [devvm clone add](devvm_clone_add.md): Copy one more repo into this folder's --clone VM
|
||||
- [devvm clone fetch](devvm_clone_fetch.md): Fetch the work of this folder's --clone VM into each of its repos
|
||||
- [devvm code](devvm_code.md): Open this folder's VM in VS Code over Remote-SSH
|
||||
- [devvm completion](devvm_completion.md): Print the shell completion script for bash, zsh or fish
|
||||
- [devvm desktop](devvm_desktop.md): Open this folder's VM's desktop in a VNC viewer
|
||||
@@ -39,11 +42,14 @@ Every devvm command, with its arguments and flags. `devvm <command> --help` prin
|
||||
- [devvm link rm](devvm_link_rm.md): Remove one of this folder's VM's links
|
||||
- [devvm link unpublish](devvm_link_unpublish.md): Stop offering ports of this folder's VM to links
|
||||
- [devvm ls](devvm_ls.md): List the project VMs
|
||||
- [devvm mount-cache](devvm_mount-cache.md): Show or change how this folder's VM caches its project folder
|
||||
- [devvm network](devvm_network.md): Show or change the network tier of this folder's VM
|
||||
- [devvm network allow](devvm_network_allow.md): Allow hosts for this folder's VM
|
||||
- [devvm network deny](devvm_network_deny.md): Deny hosts for this folder's VM
|
||||
- [devvm network lock](devvm_network_lock.md): Lock this folder's VM to the hosts it learned, on the allowlist tier
|
||||
- [devvm network log](devvm_network_log.md): Show what this folder's VM connected to and what its proxy blocked
|
||||
- [devvm network rm](devvm_network_rm.md): Remove rules from this folder's VM
|
||||
- [devvm network transparent](devvm_network_transparent.md): Show or change transparent mode for this folder's VM
|
||||
- [devvm ports](devvm_ports.md): Show or change which ports this folder's VM forwards
|
||||
- [devvm ports add](devvm_ports_add.md): Forward more ports from this folder's VM
|
||||
- [devvm ports rm](devvm_ports_rm.md): Stop forwarding some ports from this folder's VM
|
||||
|
||||
Generated
+5
-3
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm
|
||||
weight: 1
|
||||
explainer: "Open a shell in this folder's VM, creating it first"
|
||||
---
|
||||
|
||||
Open a shell in this folder's VM, creating it first
|
||||
@@ -27,7 +27,7 @@ devvm [flags]
|
||||
|
||||
```text
|
||||
--agents LIST the LIST of coding agents a new VM gets, such as claude,codex, or none (default: devvm setup's)
|
||||
--clone create the VM with its own clone of this repo instead of mounting the folder
|
||||
--clone create the VM with its own clone of this repo, or of each repo in this folder, instead of mounting the folder
|
||||
--cpus N the N CPUs the VM gets (default: devvm size -g, else the image's)
|
||||
--disk GiB the VM's disk in GiB, at least the image's (default: devvm size -g, else the image's)
|
||||
--from IMAGE the container IMAGE base starts from, such as node:24, instead of Ubuntu's cloud image (default: $DEVVM_FROM)
|
||||
@@ -35,12 +35,13 @@ devvm [flags]
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--layers LIST the LIST of layers a new VM's image gets, bottom first, such as docker,mine, or none (default: devvm setup's)
|
||||
--memory GiB the VM's memory in GiB, such as 16 or 16G (default: devvm size -g, else the image's)
|
||||
--network TIER the network TIER a new VM gets: open, internet, allowlist or none (default: devvm network -g's, else allowlist)
|
||||
--network TIER the network TIER a new VM gets: open, internet, allowlist or none, or learn for internet while it learns the hosts it needs (default: devvm network -g's, else allowlist)
|
||||
--no-devcontainer create the VM without reading the folder's devcontainer.json
|
||||
--no-git-protect create the VM without .git protection
|
||||
--no-input never ask, and fail where devvm would ask, naming the flag that answers it
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
--ports PORTS the PORTS the VM forwards: all, none or a list like 5173,8000-8010 (default: devvm ports -g, else all)
|
||||
--repos LIST the repos a --clone VM of a folder of repos gets: all, none or a LIST of their paths, such as frontend,backend (default: a picker in a terminal)
|
||||
--ssh-agent create the VM with your SSH agent forwarded, so anything in it can use your keys while you're connected
|
||||
--ssh-config add devvm's Include line to ~/.ssh/config without asking
|
||||
--tools LIST the LIST of toolchains a new VM gets, such as node,python, or none (default: those the folder's files call for)
|
||||
@@ -73,6 +74,7 @@ devvm [flags]
|
||||
- [devvm limactl](devvm_limactl.md): Run Lima's limactl for debugging, which starts VMs unconfined, whatever their tier
|
||||
- [devvm link](devvm_link.md): List this folder's VM's links to your other VMs
|
||||
- [devvm ls](devvm_ls.md): List the project VMs
|
||||
- [devvm mount-cache](devvm_mount-cache.md): Show or change how this folder's VM caches its project folder
|
||||
- [devvm network](devvm_network.md): Show or change the network tier of this folder's VM
|
||||
- [devvm ports](devvm_ports.md): Show or change which ports this folder's VM forwards
|
||||
- [devvm rebuild](devvm_rebuild.md): Build an image again, and delete the old one
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm adopt
|
||||
weight: 2
|
||||
explainer: "Give this folder the VM made for an earlier folder or path"
|
||||
---
|
||||
|
||||
Give this folder the VM made for an earlier folder or path
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm agent
|
||||
weight: 3
|
||||
explainer: "Fill devvm's store of the agents' settings and logins that every VM gets"
|
||||
---
|
||||
|
||||
Fill devvm's store of the agents' settings and logins that every VM gets
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm agent import
|
||||
weight: 4
|
||||
explainer: "Copy the agents' settings and logins from this machine into devvm's store"
|
||||
---
|
||||
|
||||
Copy the agents' settings and logins from this machine into devvm's store
|
||||
|
||||
## Synopsis
|
||||
|
||||
Copy the settings and logins of AGENT, claude, codex or opencode, or of every agent, from your home folder into devvm's store, never their history. It follows no link out of an agent's folder, and it asks before replacing what the store has.
|
||||
Copy the settings and logins of AGENT, claude, codex, opencode or pi, or of every agent, from your home folder into devvm's store, never their history. It follows no link out of an agent's folder, and it asks before replacing what the store has.
|
||||
|
||||
```text
|
||||
devvm agent import [AGENT...] [flags]
|
||||
|
||||
+4
-3
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm agent login
|
||||
weight: 5
|
||||
explainer: "Log an agent in, in this folder's VM, and save the login in devvm's store"
|
||||
---
|
||||
|
||||
Log an agent in, in this folder's VM, and save the login in devvm's store
|
||||
|
||||
## Synopsis
|
||||
|
||||
Log AGENT in inside this folder's VM, and keep the login in devvm's store for every VM with the agent, which gets only placeholders. claude logs in to your Claude subscription in a browser on any machine, whose code you paste back, or gets a long-lived Claude Code token with --setup-token. codex and opencode log in to ChatGPT in a browser on this machine, or with a code with --device-code, or save an API key with --api-key.
|
||||
Log AGENT in inside this folder's VM, and keep the login in devvm's store for every VM with the agent, which gets only placeholders. claude logs in to your Claude subscription in a browser on any machine, whose code you paste back, or gets a long-lived Claude Code token with --setup-token. codex and opencode log in to ChatGPT in a browser on this machine, or with a code with --device-code, or save an API key with --api-key, which is pi's only login.
|
||||
|
||||
```text
|
||||
devvm agent login AGENT [flags]
|
||||
@@ -21,6 +21,7 @@ devvm agent login AGENT [flags]
|
||||
devvm agent login codex # log Codex in to ChatGPT in a browser on this machine
|
||||
devvm agent login codex --device-code # log in with a code, in a browser on any machine
|
||||
devvm agent login opencode --api-key --provider anthropic # save opencode's Anthropic API key, asking for it
|
||||
devvm agent login pi --api-key --provider openai # save pi's OpenAI API key, asking for it
|
||||
```
|
||||
|
||||
## Options
|
||||
@@ -31,7 +32,7 @@ devvm agent login AGENT [flags]
|
||||
-h, --help help for login
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
--provider PROVIDER with opencode's --api-key, the PROVIDER it's for: anthropic, openai or openrouter
|
||||
--provider PROVIDER with opencode's or pi's --api-key, the PROVIDER it's for: anthropic, deepseek, google, groq, mistral, openai, openrouter or xai
|
||||
--setup-token with claude, get a long-lived Claude Code token with claude setup-token instead
|
||||
--stdin read the secret from a line of input, without asking
|
||||
```
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm agent save
|
||||
weight: 6
|
||||
explainer: "Copy the agents' settings from this folder's VM into devvm's store"
|
||||
---
|
||||
|
||||
Copy the agents' settings from this folder's VM into devvm's store
|
||||
|
||||
## Synopsis
|
||||
|
||||
Copy the settings of AGENT, claude, codex or opencode, or of every agent this folder's VM has, from the VM into devvm's store, so every VM with the agent gets them, never its logins or history. It shows what changed and asks first, so it runs only in a terminal without --no-input, and devvm starts a stopped VM for it.
|
||||
Copy the settings of AGENT, claude, codex, opencode or pi, or of every agent this folder's VM has, from the VM into devvm's store, so every VM with the agent gets them, never its logins or history. It shows what changed and asks first, so it runs only in a terminal without --no-input, and devvm starts a stopped VM for it.
|
||||
|
||||
```text
|
||||
devvm agent save [AGENT...] [flags]
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm build
|
||||
weight: 7
|
||||
explainer: "Build an image and the images under it, unless they're built"
|
||||
---
|
||||
|
||||
Build an image and the images under it, unless they're built
|
||||
|
||||
Generated
+6
-2
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm clone
|
||||
weight: 8
|
||||
explainer: "Show or change whether this folder's VM has its own clone of the repo"
|
||||
---
|
||||
|
||||
Show or change whether this folder's VM has its own clone of the repo
|
||||
|
||||
## Synopsis
|
||||
|
||||
Show whether this folder's VM has its own clone of the repo, on, or mounts this folder, off. devvm clone on and devvm clone off make the VM again from its image, after asking in a terminal without --no-input, then open a shell in it, and devvm keeps its home folder and its settings, while everything else on its disk is lost. On copies the repo's branches into the new clone, and off first offers to fetch the clone's work into this repo, unless you give --no-clone-check.
|
||||
Show whether this folder's VM has its own clone of the repo, or of each repo in a folder of repos, on, or mounts this folder, off. devvm clone on and devvm clone off make the VM again from its image, after asking in a terminal without --no-input, then open a shell in it, and devvm keeps its home folder and its settings, while everything else on its disk is lost. On copies the repos' branches into the new clone, and off first offers to fetch the clone's work into this machine's repos, unless you give --no-clone-check.
|
||||
|
||||
```text
|
||||
devvm clone [on|off] [flags]
|
||||
@@ -20,6 +20,7 @@ devvm clone [on|off] [flags]
|
||||
devvm clone on # make the VM again with its own clone of the repo, after asking
|
||||
devvm clone off # fetch the clone's work, then make the VM again with this folder mounted
|
||||
devvm clone on --force # make it again without asking, as a script must
|
||||
devvm clone fetch # fetch the VM's branches into each repo on this machine
|
||||
```
|
||||
|
||||
## Options
|
||||
@@ -33,6 +34,7 @@ devvm clone [on|off] [flags]
|
||||
--no-clone-check don't check a --clone VM's clone for unfetched commits and uncommitted changes first, which are lost
|
||||
--no-export don't export the agents' history first
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
--repos LIST the repos a --clone VM of a folder of repos gets: all, none or a LIST of their paths, such as frontend,backend (default: a picker in a terminal)
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
@@ -49,3 +51,5 @@ devvm clone [on|off] [flags]
|
||||
## See also
|
||||
|
||||
- [devvm](devvm.md): Open a shell in this folder's VM, creating it first
|
||||
- [devvm clone add](devvm_clone_add.md): Copy one more repo into this folder's --clone VM
|
||||
- [devvm clone fetch](devvm_clone_fetch.md): Fetch the work of this folder's --clone VM into each of its repos
|
||||
Generated
+44
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: devvm clone add
|
||||
explainer: "Copy one more repo into this folder's --clone VM"
|
||||
---
|
||||
|
||||
Copy one more repo into this folder's --clone VM
|
||||
|
||||
## Synopsis
|
||||
|
||||
Copy the repo at PATH, a folder in this folder's --clone VM's folder, into the VM at the same path, with its current and default branches, starting the VM if it's stopped. The repo gets a remote for the VM, as each of the VM's repos has.
|
||||
|
||||
```text
|
||||
devvm clone add PATH [flags]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm clone add tools # copy the repo in ./tools into the VM
|
||||
devvm clone add ../shared # copy a repo beside this one, in the same folder of repos
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
-h, --help help for add
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
```text
|
||||
--no-input never ask, and fail where devvm would ask, naming the flag that answers it
|
||||
-v, --verbose show the output of the commands devvm runs instead of a status line
|
||||
```
|
||||
|
||||
## Docs
|
||||
|
||||
[The docs page for devvm clone add](../using/clone.md#adding-a-repo) explains it in full.
|
||||
|
||||
## See also
|
||||
|
||||
- [devvm clone](devvm_clone.md): Show or change whether this folder's VM has its own clone of the repo
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: devvm clone fetch
|
||||
explainer: "Fetch the work of this folder's --clone VM into each of its repos"
|
||||
---
|
||||
|
||||
Fetch the work of this folder's --clone VM into each of its repos
|
||||
|
||||
## Synopsis
|
||||
|
||||
Fetch every branch of each repo in this folder's --clone VM into the repo on this machine, as remote-tracking branches of its remote for the VM, such as devvm/main, starting the VM if it's stopped. Then list the branches that are new or moved, each with the repos it's in.
|
||||
|
||||
```text
|
||||
devvm clone fetch [flags]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm clone fetch # fetch every repo's branches, and list what's new
|
||||
devvm clone fetch --json # list what's new for a script
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
-h, --help help for fetch
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--json print it as one JSON object, for scripts
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
```text
|
||||
--no-input never ask, and fail where devvm would ask, naming the flag that answers it
|
||||
-v, --verbose show the output of the commands devvm runs instead of a status line
|
||||
```
|
||||
|
||||
## Docs
|
||||
|
||||
[The docs page for devvm clone fetch](../using/clone.md#fetching-the-vms-work) explains it in full.
|
||||
|
||||
## See also
|
||||
|
||||
- [devvm clone](devvm_clone.md): Show or change whether this folder's VM has its own clone of the repo
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm code
|
||||
weight: 9
|
||||
explainer: "Open this folder's VM in VS Code over Remote-SSH"
|
||||
---
|
||||
|
||||
Open this folder's VM in VS Code over Remote-SSH
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm completion
|
||||
weight: 10
|
||||
explainer: "Print the shell completion script for bash, zsh or fish"
|
||||
---
|
||||
|
||||
Print the shell completion script for bash, zsh or fish
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm desktop
|
||||
weight: 11
|
||||
explainer: "Open this folder's VM's desktop in a VNC viewer"
|
||||
---
|
||||
|
||||
Open this folder's VM's desktop in a VNC viewer
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm doctor
|
||||
weight: 12
|
||||
explainer: "Check what devvm needs on this machine"
|
||||
---
|
||||
|
||||
Check what devvm needs on this machine
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm gc
|
||||
weight: 13
|
||||
explainer: "Delete stale images, unused tools, old files and the Nix cache over its cap"
|
||||
---
|
||||
|
||||
Delete stale images, unused tools, old files and the Nix cache over its cap
|
||||
|
||||
+3
-3
@@ -1,16 +1,16 @@
|
||||
---
|
||||
title: devvm git-protect
|
||||
weight: 14
|
||||
explainer: "Show or change .git protection for this folder's VM"
|
||||
---
|
||||
|
||||
Show or change .git protection for this folder's VM
|
||||
|
||||
## Synopsis
|
||||
|
||||
Show this folder's VM's .git protection, which locks the git hooks and config that run code on this machine, as on, strict, off, or clone for a --clone VM. devvm git-protect on, strict or off changes it at once on a stopped VM, and on a running one when it next stops, so in a terminal devvm offers to restart it now.
|
||||
Show this folder's VM's .git protection, which locks the git hooks and config that run code on this machine, as on, off, or clone for a --clone VM. devvm git-protect on or off changes it at once on a stopped VM, and on a running one when it next stops, so in a terminal devvm offers to restart it now.
|
||||
|
||||
```text
|
||||
devvm git-protect [on|strict|off] [flags]
|
||||
devvm git-protect [on|off] [flags]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm group
|
||||
weight: 15
|
||||
explainer: "Show the group this folder's VM is in"
|
||||
---
|
||||
|
||||
Show the group this folder's VM is in
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm group join
|
||||
weight: 16
|
||||
explainer: "Put this folder's VM in a group of VMs"
|
||||
---
|
||||
|
||||
Put this folder's VM in a group of VMs
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm group leave
|
||||
weight: 17
|
||||
explainer: "Take this folder's VM out of its group"
|
||||
---
|
||||
|
||||
Take this folder's VM out of its group
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm history
|
||||
weight: 18
|
||||
explainer: "List the saved exports of agents' history"
|
||||
---
|
||||
|
||||
List the saved exports of agents' history
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm history export
|
||||
weight: 19
|
||||
explainer: "Save this folder's VM's agent history to a .tar.gz"
|
||||
---
|
||||
|
||||
Save this folder's VM's agent history to a .tar.gz
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm history import
|
||||
weight: 20
|
||||
explainer: "Put an export of agent history into this folder's VM"
|
||||
---
|
||||
|
||||
Put an export of agent history into this folder's VM
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm host
|
||||
weight: 21
|
||||
explainer: "Get this folder's VM ready for ssh and editors, and show its host name"
|
||||
---
|
||||
|
||||
Get this folder's VM ready for ssh and editors, and show its host name
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm images
|
||||
weight: 22
|
||||
explainer: "List the images and the shared tools"
|
||||
---
|
||||
|
||||
List the images and the shared tools
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm images rm
|
||||
weight: 23
|
||||
explainer: "Delete images, by name or by key"
|
||||
---
|
||||
|
||||
Delete images, by name or by key
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm layer
|
||||
weight: 24
|
||||
explainer: "Make image layers of your own, or change this folder's VM's layers"
|
||||
---
|
||||
|
||||
Make image layers of your own, or change this folder's VM's layers
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm layer add
|
||||
weight: 25
|
||||
explainer: "Make this folder's VM again with more layers, then open a shell in it"
|
||||
---
|
||||
|
||||
Make this folder's VM again with more layers, then open a shell in it
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm layer new
|
||||
weight: 26
|
||||
explainer: "Start a layer of your own"
|
||||
---
|
||||
|
||||
Start a layer of your own
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm layer rm
|
||||
weight: 27
|
||||
explainer: "Make this folder's VM again without some of its layers, then open a shell in it"
|
||||
---
|
||||
|
||||
Make this folder's VM again without some of its layers, then open a shell in it
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm limactl
|
||||
weight: 28
|
||||
explainer: "Run Lima's limactl for debugging, which starts VMs unconfined, whatever their tier"
|
||||
---
|
||||
|
||||
Run Lima's limactl for debugging, which starts VMs unconfined, whatever their tier
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm link
|
||||
weight: 29
|
||||
explainer: "List this folder's VM's links to your other VMs"
|
||||
---
|
||||
|
||||
List this folder's VM's links to your other VMs
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm link add
|
||||
weight: 30
|
||||
explainer: "Link this folder's VM to a port of another VM"
|
||||
---
|
||||
|
||||
Link this folder's VM to a port of another VM
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm link publish
|
||||
weight: 31
|
||||
explainer: "Show or add the ports this folder's VM offers to links"
|
||||
---
|
||||
|
||||
Show or add the ports this folder's VM offers to links
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm link rm
|
||||
weight: 32
|
||||
explainer: "Remove one of this folder's VM's links"
|
||||
---
|
||||
|
||||
Remove one of this folder's VM's links
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm link unpublish
|
||||
weight: 33
|
||||
explainer: "Stop offering ports of this folder's VM to links"
|
||||
---
|
||||
|
||||
Stop offering ports of this folder's VM to links
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm ls
|
||||
weight: 34
|
||||
explainer: "List the project VMs"
|
||||
---
|
||||
|
||||
List the project VMs
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: devvm mount-cache
|
||||
explainer: "Show or change how this folder's VM caches its project folder"
|
||||
---
|
||||
|
||||
Show or change how this folder's VM caches its project folder
|
||||
|
||||
## Synopsis
|
||||
|
||||
Show how this folder's VM caches its project folder on a Linux host: none, which new VMs get, or mmap for a VM made before devvm chose none, which can lose writes and breaks SQLite and Gradle there. devvm mount-cache none switches it from the VM's next start, so in a terminal devvm offers to restart a running VM now.
|
||||
|
||||
```text
|
||||
devvm mount-cache [none] [flags]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm mount-cache # show the VM's cache mode
|
||||
devvm mount-cache none # stop the VM losing writes, from its next start
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
-h, --help help for mount-cache
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--json print it as one JSON object, for scripts
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
```text
|
||||
--no-input never ask, and fail where devvm would ask, naming the flag that answers it
|
||||
-v, --verbose show the output of the commands devvm runs instead of a status line
|
||||
```
|
||||
|
||||
## Docs
|
||||
|
||||
[The docs page for devvm mount-cache](../backends/lima.md#the-project-folders-cache) explains it in full.
|
||||
|
||||
## See also
|
||||
|
||||
- [devvm](devvm.md): Open a shell in this folder's VM, creating it first
|
||||
Generated
+7
-4
@@ -1,16 +1,16 @@
|
||||
---
|
||||
title: devvm network
|
||||
weight: 35
|
||||
explainer: "Show or change the network tier of this folder's VM"
|
||||
---
|
||||
|
||||
Show or change the network tier of this folder's VM
|
||||
|
||||
## Synopsis
|
||||
|
||||
Show the network tier of this folder's VM, which is open, internet, allowlist, none or unenforced, and then its allowlist, policy by policy: devvm's built-in ones by name, then your files by path. With a tier, give the VM that tier: between the confined tiers at once, and into or out of open from the VM's next start, so in a terminal devvm offers to restart a running VM now. With -g, show or change the tier new VMs get, allowlist unless you change it.
|
||||
Show the network tier of this folder's VM, which is open, internet, allowlist, none or unenforced, and then its allowlist, policy by policy: devvm's built-in ones by name, then your files by path. With a tier, give the VM that tier: between the confined tiers at once, and into or out of open from the VM's next start, so in a terminal devvm offers to restart a running VM now, and learn gives it the internet tier while it learns the hosts it reaches, until devvm network lock. With -g, show or change the tier new VMs get, allowlist unless you change it, which is never learn, because each VM learns on its own.
|
||||
|
||||
```text
|
||||
devvm network [open|internet|allowlist|none] [flags]
|
||||
devvm network [open|internet|learn|allowlist|none] [flags]
|
||||
```
|
||||
|
||||
## Examples
|
||||
@@ -19,7 +19,8 @@ devvm network [open|internet|allowlist|none] [flags]
|
||||
devvm network # show the VM's network tier and allowlist
|
||||
devvm network allow example.com # let the VM reach example.com
|
||||
devvm network log --blocked # list what the VM's proxy blocked
|
||||
devvm network internet # let the VM reach any public host
|
||||
devvm network learn # let the VM reach any public host while it learns the ones it needs
|
||||
devvm network lock # choose which of them it keeps, and put it on the allowlist tier
|
||||
devvm network -g none # give every new VM the none tier
|
||||
```
|
||||
|
||||
@@ -49,5 +50,7 @@ devvm network [open|internet|allowlist|none] [flags]
|
||||
- [devvm](devvm.md): Open a shell in this folder's VM, creating it first
|
||||
- [devvm network allow](devvm_network_allow.md): Allow hosts for this folder's VM
|
||||
- [devvm network deny](devvm_network_deny.md): Deny hosts for this folder's VM
|
||||
- [devvm network lock](devvm_network_lock.md): Lock this folder's VM to the hosts it learned, on the allowlist tier
|
||||
- [devvm network log](devvm_network_log.md): Show what this folder's VM connected to and what its proxy blocked
|
||||
- [devvm network rm](devvm_network_rm.md): Remove rules from this folder's VM
|
||||
- [devvm network transparent](devvm_network_transparent.md): Show or change transparent mode for this folder's VM
|
||||
+13
-10
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm network allow
|
||||
weight: 36
|
||||
explainer: "Allow hosts for this folder's VM"
|
||||
---
|
||||
|
||||
Allow hosts for this folder's VM
|
||||
|
||||
## Synopsis
|
||||
|
||||
Add RULEs to the allowlist of this folder's VM, or with -g of every VM, from the next connection on. RULE is a host, *.host for its subdomains, ** for any host, or an address or CIDR, and with a port, such as example.com:8443, it matches only that port instead of 443 and 80.
|
||||
Add RULEs to the allowlist of this folder's VM, or with -g of every VM, from the next connection on. RULE is a host, *.host for its subdomains, ** for any host, or an address or CIDR, and with a port, such as example.com:8443, it matches only that port instead of 443 and 80. --method and --path narrow a host's rule to some of its requests, which its proxy decrypts to check.
|
||||
|
||||
```text
|
||||
devvm network allow RULE... [flags]
|
||||
@@ -16,19 +16,22 @@ devvm network allow RULE... [flags]
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm network allow example.com # let the VM reach example.com
|
||||
devvm network allow '*.example.com' # and any of its subdomains
|
||||
devvm network allow 10.0.0.5:5432 # one port of one address
|
||||
devvm network allow -g pypi.org # let every VM reach pypi.org
|
||||
devvm network allow example.com # let the VM reach example.com
|
||||
devvm network allow '*.example.com' # and any of its subdomains
|
||||
devvm network allow 10.0.0.5:5432 # one port of one address
|
||||
devvm network allow api.example.com --method GET,HEAD # let it only read from api.example.com
|
||||
devvm network allow -g pypi.org # let every VM reach pypi.org
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
-g, --global change your rules for every VM instead
|
||||
-h, --help help for allow
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
-g, --global change your rules for every VM instead
|
||||
-h, --help help for allow
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--method METHODS narrow each rule to these METHODS of a host's requests, such as GET,HEAD
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
--path PATH narrow each rule to the requests whose path matches PATH, such as /repos/ for everything below /repos/
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
+12
-8
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm network deny
|
||||
weight: 37
|
||||
explainer: "Deny hosts for this folder's VM"
|
||||
---
|
||||
|
||||
Deny hosts for this folder's VM
|
||||
|
||||
## Synopsis
|
||||
|
||||
Add RULEs as denies to this folder's VM's rules, or with -g every VM's, from the next connection on, and a deny beats any allow. RULE is a host, *.host for its subdomains, ** for any host, or an address or CIDR, and with a port, such as example.com:8443, it matches only that port instead of 443 and 80.
|
||||
Add RULEs as denies to this folder's VM's rules, or with -g every VM's, from the next connection on, and a deny beats any allow. RULE is a host, *.host for its subdomains, ** for any host, or an address or CIDR, and with a port, such as example.com:8443, it matches only that port instead of 443 and 80. --method and --path narrow a host's rule to some of its requests, which its proxy decrypts to check.
|
||||
|
||||
```text
|
||||
devvm network deny RULE... [flags]
|
||||
@@ -16,17 +16,21 @@ devvm network deny RULE... [flags]
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm network deny example.com # keep the VM from reaching example.com
|
||||
devvm network deny -g '*.example.com' # keep every VM from its subdomains
|
||||
devvm network deny example.com # keep the VM from reaching example.com
|
||||
devvm network deny api.github.com --method POST,PUT,PATCH,DELETE # keep it from changing anything through GitHub's API
|
||||
devvm network deny github.com --path '/*/*/git-receive-pack' # keep it from pushing to GitHub over HTTPS
|
||||
devvm network deny -g '*.example.com' # keep every VM from its subdomains
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
-g, --global change your rules for every VM instead
|
||||
-h, --help help for deny
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
-g, --global change your rules for every VM instead
|
||||
-h, --help help for deny
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--method METHODS narrow each rule to these METHODS of a host's requests, such as GET,HEAD
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
--path PATH narrow each rule to the requests whose path matches PATH, such as /repos/ for everything below /repos/
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
---
|
||||
title: devvm network lock
|
||||
explainer: "Lock this folder's VM to the hosts it learned, on the allowlist tier"
|
||||
---
|
||||
|
||||
Lock this folder's VM to the hosts it learned, on the allowlist tier
|
||||
|
||||
## Synopsis
|
||||
|
||||
For this folder's VM, which learns the hosts it reaches, choose in a list which of the hosts it reached beyond its allowlist to add to its own rules, then give it the allowlist tier at once. Only a host on port 443 of a package registry or vendor that devvm knows, such as registry.npmjs.org, starts ticked, and risky ones are listed apart, so read the list before you confirm it. Without a terminal, --all adds every host and --none adds none, and --json lists the hosts and changes nothing.
|
||||
|
||||
```text
|
||||
devvm network lock [flags]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm network lock # choose the hosts the VM keeps, then lock it to them
|
||||
devvm network lock --json # list the hosts it learned, changing nothing
|
||||
devvm network lock --all # keep every host it learned, without asking
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
--all add every host the VM learned, without asking
|
||||
-h, --help help for lock
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--json print it as one JSON object, for scripts
|
||||
--none add none of the hosts the VM learned, without asking
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
```text
|
||||
--no-input never ask, and fail where devvm would ask, naming the flag that answers it
|
||||
-v, --verbose show the output of the commands devvm runs instead of a status line
|
||||
```
|
||||
|
||||
## Docs
|
||||
|
||||
[The docs page for devvm network lock](../safety/network.md#locking-it) explains it in full.
|
||||
|
||||
## See also
|
||||
|
||||
- [devvm network](devvm_network.md): Show or change the network tier of this folder's VM
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm network log
|
||||
weight: 38
|
||||
explainer: "Show what this folder's VM connected to and what its proxy blocked"
|
||||
---
|
||||
|
||||
Show what this folder's VM connected to and what its proxy blocked
|
||||
|
||||
+11
-8
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm network rm
|
||||
weight: 39
|
||||
explainer: "Remove rules from this folder's VM"
|
||||
---
|
||||
|
||||
Remove rules from this folder's VM
|
||||
|
||||
## Synopsis
|
||||
|
||||
Remove RULEs, as written with a deny's !, from this folder's VM's own rules, or with -g yours for every VM. The change applies at once.
|
||||
Remove RULEs, as written with a deny's !, from this folder's VM's own rules, or with -g yours for every VM, with --method and --path for a rule that narrows. The change applies at once.
|
||||
|
||||
```text
|
||||
devvm network rm RULE... [flags]
|
||||
@@ -16,17 +16,20 @@ devvm network rm RULE... [flags]
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm network rm example.com # remove an allow
|
||||
devvm network rm '!example.com' # remove a deny
|
||||
devvm network rm example.com # remove an allow
|
||||
devvm network rm '!example.com' # remove a deny
|
||||
devvm network rm api.example.com --method GET,HEAD # remove an allow that narrows
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
-g, --global change your rules for every VM instead
|
||||
-h, --help help for rm
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
-g, --global change your rules for every VM instead
|
||||
-h, --help help for rm
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--method METHODS narrow each rule to these METHODS of a host's requests, such as GET,HEAD
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
--path PATH narrow each rule to the requests whose path matches PATH, such as /repos/ for everything below /repos/
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: devvm network transparent
|
||||
explainer: "Show or change transparent mode for this folder's VM"
|
||||
---
|
||||
|
||||
Show or change transparent mode for this folder's VM
|
||||
|
||||
## Synopsis
|
||||
|
||||
Show whether this folder's VM sends tools that ignore the proxy settings to its proxy by the names they look up, on or off, and where that comes from: the VM's own setting, config.toml's transparent-proxy, or devvm's default, on. devvm network transparent on or off gives the VM its own setting, which applies from its next launch, while it's on a confined tier.
|
||||
|
||||
```text
|
||||
devvm network transparent [on|off] [flags]
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm network transparent # show the VM's transparent mode and where it comes from
|
||||
devvm network transparent off # turn it off for this VM, from its next launch
|
||||
devvm network transparent on # turn it on again, whatever config.toml says
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
-h, --help help for transparent
|
||||
--here use this folder's own VM, never that of a folder it's inside
|
||||
--json print it as one JSON object, for scripts
|
||||
--parent use the VM of the nearest folder this one is inside, even across a git repo of its own
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
```text
|
||||
--no-input never ask, and fail where devvm would ask, naming the flag that answers it
|
||||
-v, --verbose show the output of the commands devvm runs instead of a status line
|
||||
```
|
||||
|
||||
## Docs
|
||||
|
||||
[The docs page for devvm network transparent](../safety/network.md#tools-that-ignore-the-proxy) explains it in full.
|
||||
|
||||
## See also
|
||||
|
||||
- [devvm network](devvm_network.md): Show or change the network tier of this folder's VM
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm ports
|
||||
weight: 40
|
||||
explainer: "Show or change which ports this folder's VM forwards"
|
||||
---
|
||||
|
||||
Show or change which ports this folder's VM forwards
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm ports add
|
||||
weight: 41
|
||||
explainer: "Forward more ports from this folder's VM"
|
||||
---
|
||||
|
||||
Forward more ports from this folder's VM
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm ports rm
|
||||
weight: 42
|
||||
explainer: "Stop forwarding some ports from this folder's VM"
|
||||
---
|
||||
|
||||
Stop forwarding some ports from this folder's VM
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm rebuild
|
||||
weight: 43
|
||||
explainer: "Build an image again, and delete the old one"
|
||||
---
|
||||
|
||||
Build an image again, and delete the old one
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm restart
|
||||
weight: 44
|
||||
explainer: "Restart this folder's VM and open a shell in it"
|
||||
---
|
||||
|
||||
Restart this folder's VM and open a shell in it
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm retention
|
||||
weight: 45
|
||||
explainer: "Show or change what devvm deletes on its own"
|
||||
---
|
||||
|
||||
Show or change what devvm deletes on its own
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm rm
|
||||
weight: 46
|
||||
explainer: "Delete this folder's VM, or a VM whose folder is gone"
|
||||
---
|
||||
|
||||
Delete this folder's VM, or a VM whose folder is gone
|
||||
|
||||
Generated
+6
-5
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm secret
|
||||
weight: 47
|
||||
explainer: "List the secrets kept on this machine, for VMs to use"
|
||||
---
|
||||
|
||||
List the secrets kept on this machine, for VMs to use
|
||||
|
||||
## Synopsis
|
||||
|
||||
List the secrets devvm keeps on this machine, claude for the Claude Code token, github for a GitHub token and proxy for the password of the company proxy that config.toml names, with whether each is saved and the VMs using it. A VM gets a placeholder, and its proxy puts the secret into requests for the secret's hosts. No VM gets proxy, which devvm's proxies send only to the company proxy.
|
||||
List the secrets devvm keeps on this machine, claude for the Claude Code token, github for a GitHub token, proxy for the password of the company proxy that config.toml names, and your own, with each one's hosts, header and variable, whether it's saved and the VMs using it. A VM gets a placeholder, and its proxy puts the secret into requests for the secret's hosts. No VM gets proxy, which devvm's proxies send only to the company proxy.
|
||||
|
||||
```text
|
||||
devvm secret [flags]
|
||||
@@ -16,9 +16,10 @@ devvm secret [flags]
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm secret # list the secrets and the VMs using each
|
||||
devvm secret set github # save a GitHub token, asking for it
|
||||
devvm secret use github # let this folder's VM use it
|
||||
devvm secret # list the secrets and the VMs using each
|
||||
devvm secret set github # save a GitHub token, asking for it
|
||||
devvm secret set stripe --host api.stripe.com --env STRIPE_API_KEY --prefix sk_ # save a secret of your own for api.stripe.com
|
||||
devvm secret use github # let this folder's VM use it
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
Generated
+2
-2
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm secret rm
|
||||
weight: 48
|
||||
explainer: "Delete a saved secret"
|
||||
---
|
||||
|
||||
Delete a saved secret
|
||||
|
||||
## Synopsis
|
||||
|
||||
Delete a saved secret, after asking in a terminal without --no-input. Proxies that are running stop putting it in at once, but what a VM did with it stays done.
|
||||
Delete a saved secret, after asking in a terminal without --no-input. A secret of your own goes with its hosts, header and variable, and the VMs using it stop using it. Proxies that are running stop putting it in at once, but what a VM did with it stays done.
|
||||
|
||||
```text
|
||||
devvm secret rm NAME [flags]
|
||||
|
||||
+18
-7
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm secret set
|
||||
weight: 49
|
||||
explainer: "Save a secret on this machine"
|
||||
---
|
||||
|
||||
Save a secret on this machine
|
||||
|
||||
## Synopsis
|
||||
|
||||
Save a secret on this machine, claude for the Claude Code token that claude setup-token prints, github for a GitHub token, or proxy for the password of the company proxy that config.toml names. devvm asks for it without showing it, and --stdin reads a line instead. Proxies that are running put a new token in at once, and a VM's proxy reads proxy as it starts.
|
||||
Save a secret on this machine: claude for the Claude Code token that claude setup-token prints, github for a GitHub token, proxy for the password of the company proxy that config.toml names, or one of your own, which needs --host and --env the first time and keeps what it has of them after. devvm asks for it without showing it, and --stdin reads a line instead. Proxies that are running put a new value in at once, and a VM's proxy reads proxy as it starts.
|
||||
|
||||
```text
|
||||
devvm secret set NAME [flags]
|
||||
@@ -16,16 +16,27 @@ devvm secret set NAME [flags]
|
||||
## Examples
|
||||
|
||||
```text
|
||||
devvm secret set claude # save the Claude Code token, asking for it
|
||||
gh auth token | devvm secret set github --stdin # save GitHub CLI's token without asking
|
||||
devvm secret set proxy # save the company proxy's password, asking for it
|
||||
devvm secret set claude # save the Claude Code token, asking for it
|
||||
gh auth token | devvm secret set github --stdin # save GitHub CLI's token without asking
|
||||
devvm secret set stripe --host api.stripe.com --env STRIPE_API_KEY --prefix sk_ # save a Stripe key, sent to api.stripe.com alone
|
||||
devvm secret set openrouter --host openrouter.ai --env OPENROUTER_API_KEY # save an API key, sent as Authorization: Bearer
|
||||
devvm secret set stripe # save a new value for a secret of yours, keeping its hosts
|
||||
devvm secret set proxy # save the company proxy's password, asking for it
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
```text
|
||||
-h, --help help for set
|
||||
--stdin read the secret from a line of input, without asking
|
||||
--basic-user let a secret of your own go in as the username of Basic credentials, as Stripe takes a key
|
||||
--env VARIABLE the VARIABLE that holds the placeholder of a secret of your own in VMs, such as STRIPE_API_KEY
|
||||
--header HEADER the HEADER that a secret of your own goes in, such as X-Api-Key (default: Authorization)
|
||||
-h, --help help for set
|
||||
--host HOST a HOST that a secret of your own goes to, such as api.example.com: repeat it, or join hosts with commas
|
||||
--method METHODS the METHODS of the requests a secret of your own goes in, such as GET,HEAD, or none for every method
|
||||
--path PATH the PATH of the requests a secret of your own goes in, such as /api/ for everything below /api/, or none for every path
|
||||
--prefix PREFIX the PREFIX that the placeholder of a secret of your own starts with, such as sk_, for a client that checks how a key starts
|
||||
--scheme SCHEME the SCHEME of a secret of your own in Authorization besides Bearer and Token, such as ApiKey, or none
|
||||
--stdin read the secret from a line of input, without asking
|
||||
```
|
||||
|
||||
## Options inherited from parent commands
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm secret unuse
|
||||
weight: 50
|
||||
explainer: "Stop this folder's VM using a secret"
|
||||
---
|
||||
|
||||
Stop this folder's VM using a secret
|
||||
|
||||
+3
-2
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: devvm secret use
|
||||
weight: 51
|
||||
explainer: "Let this folder's VM use a secret"
|
||||
---
|
||||
|
||||
Let this folder's VM use a secret
|
||||
|
||||
## Synopsis
|
||||
|
||||
Let this folder's VM use a secret. Its proxy puts the secret in at once, and the VM gets its placeholder from its next launch.
|
||||
Let this folder's VM use a secret, and reach its hosts on port 443. Its proxy puts the secret in at once, and the VM gets its placeholder from its next launch.
|
||||
|
||||
```text
|
||||
devvm secret use NAME [flags]
|
||||
@@ -17,6 +17,7 @@ devvm secret use NAME [flags]
|
||||
|
||||
```text
|
||||
devvm secret use github # let the VM use your GitHub token
|
||||
devvm secret use stripe # let the VM use a secret of yours
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm setup
|
||||
weight: 52
|
||||
explainer: "Choose base's features, and new VMs' size, network tier, coding agents and layers"
|
||||
---
|
||||
|
||||
Choose base's features, and new VMs' size, network tier, coding agents and layers
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: devvm size
|
||||
weight: 53
|
||||
explainer: "Show or change this folder's VM's size"
|
||||
---
|
||||
|
||||
Show or change this folder's VM's size
|
||||
|
||||
Loaded 100 of 846 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user