feat(dolt): auto-commit write commands and set explicit commit authors (#1270)

Adds Dolt auto-commit functionality for write commands and sets explicit commit authors.

Includes fix for race condition in commandDidWrite (converted to atomic.Bool).

Original PR: #1267 by @coffeegoddd
Co-authored-by: Dustin Brown <dustin@dolthub.com>
This commit is contained in:
Steve Yegge
2026-01-22 20:52:20 -08:00
committed by John Ogle
parent 9fd0ea2c67
commit 0ee020ed76
18 changed files with 596 additions and 45 deletions
+26
View File
@@ -41,6 +41,7 @@ Tool-level settings you can configure:
| `conflict.strategy` | - | `BD_CONFLICT_STRATEGY` | `newest` | Conflict resolution: `newest`, `ours`, `theirs`, `manual` |
| `federation.remote` | - | `BD_FEDERATION_REMOTE` | (none) | Dolt remote URL for federation |
| `federation.sovereignty` | - | `BD_FEDERATION_SOVEREIGNTY` | (none) | Data sovereignty tier: `T1`, `T2`, `T3`, `T4` |
| `dolt.auto-commit` | `--dolt-auto-commit` | `BD_DOLT_AUTO_COMMIT` | `on` | (Dolt backend) Automatically create a Dolt commit after successful write commands |
| `create.require-description` | - | `BD_CREATE_REQUIRE_DESCRIPTION` | `false` | Require description when creating issues |
| `validation.on-create` | - | `BD_VALIDATION_ON_CREATE` | `none` | Template validation on create: `none`, `warn`, `error` |
| `validation.on-sync` | - | `BD_VALIDATION_ON_SYNC` | `none` | Template validation before sync: `none`, `warn`, `error` |
@@ -61,6 +62,31 @@ Tool-level settings you can configure:
- **SQLite** supports daemon mode and auto-start.
- **Dolt (embedded)** is treated as **single-process-only**. Daemon mode and auto-start are disabled; `auto-start-daemon` has no effect. If you need daemon mode, use the SQLite backend (`bd init --backend sqlite`).
### Dolt Auto-Commit (SQL commit vs Dolt commit)
When using the **Dolt backend**, there are two different kinds of “commit”:
- **SQL transaction commit**: what happens when a `bd` command updates tables successfully (durable in the Dolt *working set*).
- **Dolt version-control commit**: what records those changes into Dolts *history* (visible in `bd vc log`, push/pull/merge workflows).
By default, `bd` is configured to **auto-commit Dolt history after each successful write command**:
- **Default**: `dolt.auto-commit: on`
- **Disable for a single command**:
```bash
bd --dolt-auto-commit off create "No commit for this one"
```
- **Disable in config** (`.beads/config.yaml` or `~/.config/bd/config.yaml`):
```yaml
dolt:
auto-commit: off
```
**Caveat:** enabling this creates **more Dolt commits** over time (one per write command). This is intentional so changes are not left only in the working set.
### Actor Identity Resolution
The actor name (used for `created_by` in issues and audit trails) is resolved in this order:
+4 -1
View File
@@ -456,11 +456,14 @@ See [MULTI_REPO_MIGRATION.md](MULTI_REPO_MIGRATION.md) for complete guide.
### Automatic Sync (Default)
**With daemon running:**
**With daemon running (SQLite backend):**
- Export to JSONL: 30-second debounce after changes
- Import from JSONL: when file is newer than DB
- Commit/push: configurable via `--auto-commit` / `--auto-push`
**Note:** `--auto-commit` here refers to **git commits** (typically to the sync branch).
For the Dolt backend, use `dolt.auto-commit` / `--dolt-auto-commit` to control **Dolt history commits**.
**30-second debounce provides transaction window:**
- Multiple changes within 30s get batched
- Single JSONL export/commit for the batch
+1 -4
View File
@@ -42,10 +42,7 @@ Notes:
- SQLite backend stores data in `.beads/beads.db`.
- Dolt backend stores data in `.beads/dolt/` and records `"database": "dolt"` in `.beads/metadata.json`.
- Dolt backend runs **single-process-only**; daemon mode is disabled.
Notes:
- SQLite backend stores data in `.beads/beads.db`.
- Dolt backend stores data in `.beads/dolt/` and records `"database": "dolt"` in `.beads/metadata.json`.
- Dolt backend **auto-commits** after each successful write command by default (`dolt.auto-commit: on`). Disable with `bd --dolt-auto-commit off ...` or config.
## Your First Issues
+3 -2
View File
@@ -358,8 +358,9 @@ export BEADS_DB=/path/to/specific/.beads/beads.db
```bash
# Configure sync behavior
bd config set sync.branch beads-sync # Use separate sync branch
bd config set sync.auto_commit true # Auto-commit changes
bd config set sync.auto_push true # Auto-push changes
# For git-portable workflows, enable daemon auto-commit/push (SQLite backend only):
bd daemon start --auto-commit --auto-push
```
## Performance Considerations