> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# [updates]: let the installed app update itself

> Reference for [updates] in bach.toml: github or a feed link, download_url and auto, which make bach build write latest.json and let the installed app update itself.

`[updates]` lets the installed app update itself. `bach build` writes `latest.json` next to the setup file. Publish both, and the app finds new versions. With GitHub releases one line is enough:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[updates]
github = "owner/repo"
```

With a server of your own:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[updates]
feed = "https://example.com/hello/latest.json"
download_url = "https://example.com/hello/{file}"   # {file}: the setup file's name
```

| Setting | Default | Meaning |
| - | - | - |
| `github` | none | `owner/repo`. Updates come from that repository's releases. The feed is `https://github.com/owner/repo/releases/latest/download/latest.json`, and each version's file is downloaded from its own tag, `.../releases/download/v{version}/{file}`. The setup file is named the way GitHub serves it: anything but letters, digits, `.`, `-` and `_` becomes `-`. |
| `feed` | from `github` | The `https` link of `latest.json`, which the installed app reads. Needed without `github`. |
| `download_url` | from `github` | The `https` link the setup file will be downloaded from. `{file}` is the setup file's name (encoded for a link), `{version}` the app's version. |
| `mirrors` | none | More feeds to ask when `feed` cannot be reached, each the `https` link of a full feed with its own download link. The first feed that answers decides the newest version. A mirror only offers another place to download the *same* file (same version and SHA-256), so a weaker mirror cannot widen what an installed app trusts. |
| `public_key` | none | The publisher's Ed25519 public key (64 hex digits, from `bach feed-key`). With it, the installed app accepts only feed entries signed with the matching private key, whichever host or mirror served them. See [Signed feeds](/docs/guides/updates.md#signed-feeds). |
| `next_public_key` | none | A second public key that is trusted too, to hand over to a new key without stranding installed copies. Needs `public_key` and must differ from it. See [Changing the key](/docs/guides/updates.md#changing-the-key). |
| `max_age_days` | none | How many days old a signed feed entry may be (1 to 3650, needs `public_key`). `bach feed` signs the time it ran into each entry, and an installed app ignores an older one, so a taken-over feed host cannot keep serving an old, validly signed entry. Left out, an entry never expires. You have to sign the feed again within that time. See [Keeping a signed feed fresh](/docs/guides/updates.md#keeping-a-signed-feed-fresh). |
| `beta_feed` | none | The `https` link of the beta channel's feed, written like `feed` (`bach feed FILE --out latest-beta.json`). A person who runs `uninstall.exe --channel beta` follows it instead of `feed` and `mirrors`. See [Beta versions](/docs/guides/updates.md#beta-versions). |
| `signer` | none | The publisher a downloaded update has to be signed by (Authenticode): the common name or organisation of the signing certificate, like `Example Inc.`, or its whole subject (`CN=..., O=..., L=..., C=...`), which has to match exactly. Windows must accept the signature. An unsigned update or one signed by anyone else is not installed. See [Signed updates](/docs/guides/updates.md#signed-updates-authenticode). |
| `auto` | `true` | Keep the app up to date in the background. `true`: the install page offers "Automatic updates", ticked. `false`: offered, unticked. `"always"` and `"never"` decide for the user. |

With `installer.scope = "machine"`, `auto` must be left out or `"never"`, because a background update would have to write to Program Files.

Either `github` or `feed` is needed. `app.version` must be numbers like `1.4.0` (a suffix like `-beta.1` is fine), because the app compares versions. `bach check` warns when `app.version` is not a version it can compare (like `abc`, or a number beyond 18446744073709551615): installed copies then treat every setup file as an update, and the downgrade protection does nothing.

Without `download_url` (and without `github`), `bach build` writes no `latest.json` and prints a warning. After uploading the setup file, run `bach feed SETUP --url URL`.

Signing changes the setup file and so its SHA-256. After signing, write the feed again with `bach feed SETUP.exe`. To offer an update to a share of computers first, add `--rollout 10`: see [Staged rollouts](/docs/guides/updates.md#staged-rollouts).

To spare computers the whole download, `bach build --patch-from OLD-SETUP.exe` also writes a patch with only the files that changed: see [Update patches](/docs/guides/updates.md#update-patches).

For a private server that checks an access key, see [`[access]`](/docs/reference/config/access) and [Private updates](/docs/guides/updates.md#private-updates).

## What it adds

With `[updates]`, the installed `uninstall.exe` answers `--check-update`, `--download-update`, `--apply-update`, `--update` and `--auto-update` (see [Command line](/docs/reference/setup/command-line.md)). The install page gets the "Automatic updates" box unless `auto` is `"always"` or `"never"`. Ticked, setup adds a per-user scheduled task named `Bach\<app id>` that runs `uninstall.exe --auto-update` every four hours. Unticking the box, an update without it and uninstalling all delete the task.

See [Updates](/docs/guides/updates.md) for the guide and [`bach feed`](/docs/reference/cli/feed) for the command.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.