> ## 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.

# Choose which files to include

> Decide what goes into your installer: set the source folder, leave files out with exclude patterns, and handle secrets, clutter and long paths.

Your installer contains the files you tell Bach to package. This page explains how to point Bach at the right folder, how to leave files out, and why Bach sometimes stops a build because of a file it found.

## The source folder

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[files]
source = "build"
```

Everything inside `source`, including every subfolder, goes into the setup file and ends up in the install folder with the same structure. The path is relative to the folder that holds `bach.toml`.

To see exactly what will be packaged:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach check
```

The list at the end shows every file with its size.

## Leave files out

Use `exclude` with a list of patterns:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[files]
source = "build"
exclude = ["*.pdb", "*.log", "docs/**"]
```

The patterns work like this:

| Pattern | Matches |
| - | - |
| `*.pdb` | any file ending in `.pdb`, in any folder |
| `config.dev.json` | a file with that name, in any folder |
| `docs/**` | everything inside the `docs` folder at the top of `source` |
| `data/*.tmp` | `.tmp` files directly inside `data` |
| `**/test/**` | everything inside any folder called `test` |
| `log?.txt` | `log1.txt`, `logA.txt` and so on |

A pattern without `/` is compared with the file name only. A pattern with `/` is compared with the whole path, starting at the top of `source`. `*` stays within one folder, `**` crosses folders, `?` stands for one character. Upper and lower case don't matter.

## Files that look like secrets stop the build

It's easy to point `source` at the wrong folder and ship a private key by accident. So when Bach finds a file that looks like a secret, it refuses to build:

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
files.source holds ".env", an environment file with credentials; leave it out with files.exclude, or package it on purpose with files.allow_secrets = [".env"]
```

Bach checks for, among others:

* `.env` files, certificates and private keys (`.pfx`, `.pem`, `.key`, SSH keys)
* credential files such as `.npmrc`, `credentials.json` or cloud service account keys
* version control and cloud login folders such as `.git`, `.ssh` and `.aws`
* your own `bach.toml`
* small text files (config files, scripts and similar, up to 256 KB) that contain a private key or an AWS, GitHub or Slack token

If the file doesn't belong in the installer, exclude it. If it does, for example a public certificate your app needs, allow it:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[files]
source = "build"
allow_secrets = ["certs/server-ca.pem"]
```

Bach can only recognize common cases. Don't rely on it to find every private file; keep your build folder clean.

## Warnings

These don't stop the build, but `bach check` and `bach build` mention them:

* **Clutter**, such as `*.pdb`, `*.log`, `Thumbs.db`, `.DS_Store`, or `node_modules`, `target` and `__pycache__` folders.
* **Long paths.** A file whose installed path would be longer than 259 characters. Setup can write it, but shortcuts, File Explorer and many programs can't open it. This often happens with `node_modules`.
* **A very large file list**, for example thousands of small files. Bach keeps the list in the setup file and again in the uninstaller on every computer, so packing files together (for Electron, into an `asar` archive) keeps both smaller.

To make warnings fail the build, for example in CI, use `--strict`.

## Rules for the folder

* It must contain the program named in `app.executable`, and that program can't be excluded.
* It must have at least one file.
* It can't contain symbolic links.
* Two files can't differ only in upper and lower case.
* A file named `uninstall.exe` at the top isn't allowed, because Bach adds its own.

## Make some files optional

If users should be able to choose whether to install part of your app, such as sample projects or extra language packs, don't exclude those files. Put them in a [component](/docs/guides/choices-and-components.md) instead.

## Different files for ARM64 or macOS

`[files]` is for the 64-bit Intel and AMD build. [`[arch.arm64]`](/docs/reference/config/arch) names a folder for ARM64, and [`[macos]`](/docs/guides/macos) one for the Mac version.


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