feat(reset): implement core reset package for bd reset command

Phase 1 implementation of bd reset (GitHub #479):

- internal/reset/reset.go: Core reset logic with ResetOptions, ResetResult,
  ImpactSummary structs. Handles daemon killing, backup, file removal,
  git operations, and re-initialization.

- internal/reset/backup.go: CreateBackup() for timestamped .beads/ backups
  with permission preservation.

- internal/reset/git.go: Git state detection and operations for --hard mode.
  CheckGitState(), GitRemoveBeads(), GitCommitReset(), GitAddAndCommit().

- cmd/bd/doctor/gitignore.go: Add .beads-backup-*/ to gitignore template.

Code review fixes applied:
- Git rm now runs BEFORE file deletion (was backwards)
- Removed stderr output from core package (CLI-agnostic)
- IsDirty now checks only .beads/ changes, not entire repo
- GitCommitReset handles nothing to commit gracefully
This commit is contained in:
Steve Yegge
2025-12-13 09:41:37 +11:00
parent 7949b4215c
commit ca9d306ef0
6 changed files with 754 additions and 4 deletions

View File

@@ -35,6 +35,9 @@ beads.left.meta.json
beads.right.jsonl
beads.right.meta.json
# Backup directories created by bd reset --backup
.beads-backup-*/
# Keep JSONL exports and config (source of truth for git)
!issues.jsonl
!metadata.json