dotr-dear 2.0.3

A dotfiles manager as dear as a daughter.
Documentation
# Profiles

A **profile** describes an environment — work, home, a particular server —
as a set of packages, variables, and prompts. The same repository can
deploy differently depending on which profile is active.

Every repository has a `default` profile, created automatically by
`dotr init`.

```toml
[profiles.work]
dependencies = ["nvim", "git"]

[profiles.work.variables]
GIT_EMAIL = "work@company.com"

[profiles.home]
dependencies = ["nvim", "gaming"]

[profiles.home.variables]
GIT_EMAIL = "personal@email.com"
```

## Selecting a profile

Most commands accept `-P`/`--profile`:

```bash
dotr deploy --profile work
dotr import ~/.ssh/config --profile work
dotr update --profile work
dotr diff --profile work
```

If no `--profile` is given, DotR resolves the active profile in this order:

1. A `DOTR_PROFILE` variable, if set — `.uservariables.toml` wins over the
   environment if both are set (the reverse of `DOTR_BITWARDEN_NOTE`'s
   [precedence]./prompts.md#machine-local-override-for-bitwarden_note).
2. Otherwise, `default`.

Referencing a profile that doesn't exist is an error (except `default`,
which is created on the fly if missing).

Whichever value wins is also folded into [variables](./variables.md) as a
low-priority fallback, so `DOTR_PROFILE` shows up in `dotr print-vars` and
can be referenced in templates as `{{ DOTR_PROFILE }}` — a profile,
package, or user variable of the same name still overrides it.

## Fields

| Field          | Type             | Purpose                                                        |
| -------------- | ---------------- | ---------------------------------------------------------------- |
| `dependencies` | list of strings  | Packages deployed when this profile is active and no `--packages` is given |
| `variables`    | table            | Profile-scoped variables — override package/config/env variables, see [Variables]./variables.md |
| `prompts`      | table            | Profile-scoped prompts — see [Prompts]./prompts.md            |
| `prompt_backend` | string         | Overrides the top-level `prompt_backend` when this profile is active — see [Prompts]./prompts.md#where-answers-go-backends |
| `bitwarden_note` | string         | Overrides the top-level `bitwarden_note` when this profile is active — see [Prompts]./prompts.md#machine-local-override-for-bitwarden_note |
| `platform`     | string           | Shares a package's [`targets`]./packages.md#per-profile-destinations-targets destination with every other profile that sets the same value |

## How a profile decides which packages deploy

When you run `dotr deploy` (or `update`/`diff`) **without** `--packages`,
DotR deploys every package listed in the active profile's `dependencies`
that doesn't have `skip = true` (see [Packages](./packages.md#skipping-a-package-by-default-skip)).

When you pass `--packages` explicitly, the profile's `dependencies` list is
irrelevant to *selection* — only the named packages (and their own
[dependencies](./dependencies.md)) are used — but the profile still supplies
variables, prompts, and any [`targets`](./packages.md#per-profile-destinations-targets)
override.

## Managing profiles

```bash
dotr profiles list
dotr profiles list --verbose
dotr profiles add laptop
dotr profiles add laptop --set-as-current
dotr profiles remove work
dotr profiles remove work --remove-orphans
```

`--set-as-current` writes `DOTR_PROFILE = "laptop"` into
`.uservariables.toml`, so `laptop` becomes the implicit profile on this
machine without needing `--profile laptop` on every command.

`profiles remove` deletes the profile from `config.toml`. `--remove-orphans`
additionally removes any packages that were only referenced by that
profile's `dependencies` and no others.

Removing the `default` profile is not allowed.