Skip to content

feat: auto-export git-tracked JSONL for portability without Dolt remote#2808

Merged
steveyegge merged 1 commit intosteveyegge:mainfrom
paf0186:feat/auto-export-clean
Mar 27, 2026
Merged

feat: auto-export git-tracked JSONL for portability without Dolt remote#2808
steveyegge merged 1 commit intosteveyegge:mainfrom
paf0186:feat/auto-export-clean

Conversation

@paf0186
Copy link
Contributor

@paf0186 paf0186 commented Mar 24, 2026

Follow-up to #2626, split out as requested per #2625.

The foundation PRs have all landed (#2709, #2710, #2570), so
this is now just the auto-export feature on its own.

When export.auto: true is set in config.yaml, beads
automatically writes a git-tracked JSONL file (issues +
memories) after mutations. This provides full portability
across machines via git alone, without requiring a Dolt remote.

New config keys:

  • export.auto: false — opt-in to auto-export
  • export.interval: 60s — throttle interval
  • export.path: export.jsonl — output file relative to .beads/
  • export.git-add: false — auto-stage the file

Behavior:

  • Runs in PersistentPostRun after auto-backup
  • Uses Dolt commit hash for change detection (no-op if unchanged)
  • Throttles by interval (default 60s)
  • Skips during git hooks (BD_GIT_HOOK=1)
  • Includes both issues and memories in the JSONL output

Files:

  • cmd/bd/export_auto.go — core auto-export logic
  • cmd/bd/main.go — wire into PersistentPostRun
  • internal/config/config.go — new export.* config defaults
  • internal/config/yaml_config.go — add "export." to yaml-only prefix list
  • cmd/bd/doctor/gitignore.go — add export-state.json to gitignore
  • cmd/bd/doctor/tracked_runtime.go — flag export-state.json if tracked

Also updated IsClosed() call to use the LifecycleManager
interface, since it was moved out of DoltStorage since the
original PR.

When `export.auto: true` is set in config.yaml, beads automatically
writes a git-tracked JSONL file (issues + memories) after mutations.
This provides full portability across machines via git alone, without
requiring a Dolt remote.

New config keys:
  export.auto: false       # opt-in to auto-export
  export.interval: 60s     # throttle interval
  export.path: export.jsonl  # output file relative to .beads/
  export.git-add: false    # auto-stage the file

The auto-export:
- Runs in PersistentPostRun after auto-backup
- Uses Dolt commit hash for change detection (no-op if nothing changed)
- Throttles by interval (default 60s)
- Skips during git hooks (BD_GIT_HOOK=1)
- Includes both issues and memories in the JSONL output

Also extracts exportToFile() as a shared helper usable by both
`bd export -o` and the auto-export system.

Files:
- cmd/bd/export_auto.go: Core auto-export logic
- cmd/bd/main.go: Wire maybeAutoExport into PersistentPostRun
- internal/config/config.go: New export.* config defaults
- internal/config/yaml_config.go: Add "export." to yaml-only prefix list
- cmd/bd/doctor/gitignore.go: Add export-state.json to gitignore
- cmd/bd/doctor/tracked_runtime.go: Flag export-state.json if tracked

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@steveyegge steveyegge merged commit 0fdb6a7 into steveyegge:main Mar 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants