Use XDG config directory as default config path

- Look for config at $XDG_CONFIG_HOME/converge/config.yaml by default
- --config still overrides to an explicit path
- Falls back to single-repo --repo mode if no config file found
- New defaultConfigPath and configFileExists helpers in Converge module
This commit is contained in:
2026-05-11 10:11:34 -04:00
parent d6e15864f4
commit 97e129a855
4 changed files with 71 additions and 37 deletions
+24 -18
View File
@@ -6,41 +6,47 @@ Converge notifies the user via libnotify / `notify-send` whenever a merge confli
## Usage
### Single repository
### Configuration
Converge looks for its config file at `$XDG_CONFIG_HOME/converge/config.yaml` (typically `~/.config/converge/config.yaml`). If found, it uses that file automatically.
```bash
# Watch the current directory (defaults)
# Run with the default XDG config file
./scripts/run
# Watch a specific repo
./scripts/run -- --repo /path/to/repo --branch master --debounce 10000
```
### Multiple repositories (config file)
You can also specify a config file explicitly:
```bash
# Create a config file
cp converge.example.yaml converge.yaml
# Edit to list your repos
vim converge.yaml
./scripts/run -- --config /path/to/converge.yaml
```
# Run with config
./scripts/run -- --config converge.yaml
### Single repository (no config file)
If no config file exists, converge falls back to watching a single repository:
```bash
# Watch the current directory
./scripts/run
# Watch a specific repo with options
./scripts/run -- --repo /path/to/repo --branch master --debounce 10000
```
### Options
| Option | Default | Description |
|--------|---------|-------------|
| `-c`, `--config FILE` | | Path to YAML config file listing repositories |
| `-r`, `--repo PATH` | `.` (cwd) | Path to a single git repository |
| `-d`, `--debounce MS` | `5000` | Debounce window in milliseconds (overrides config) |
| `--remote NAME` | `origin` | Remote name (single-repo mode) |
| `-b`, `--branch NAME` | `main` | Branch to pull (single-repo mode) |
| `-c`, `--config FILE` | `$XDG_CONFIG_HOME/converge/config.yaml` | Path to YAML config file listing repositories |
| `-r`, `--repo PATH` | `.` (cwd) | Path to a single git repository (single-repo fallback mode) |
| `-d`, `--debounce MS` | `5000` | Debounce window in milliseconds (overrides config file) |
| `--remote NAME` | `origin` | Remote name (single-repo fallback mode) |
| `-b`, `--branch NAME` | `main` | Branch to pull (single-repo fallback mode) |
### Config file format
```yaml
# ~/.config/converge/config.yaml (XDG default)
repos:
- path: /absolute/or/relative/path
remote: origin # optional, defaults to "origin"
@@ -74,5 +80,5 @@ All development tools run inside Docker via the `hs` wrapper script.
- **File watching**: [fsnotify](https://hackage.haskell.org/package/fsnotify)
- **Concurrency**: one watcher thread per repository via `async`
- **Notifications**: shell out to `notify-send` (libnotify)
- **Configuration**: YAML config file for multi-repo, CLI flags for single-repo
- **Configuration**: YAML config file at XDG config path for multi-repo, CLI flags for single-repo fallback
- **Daemonization**: TBD (likely systemd service)