feat: add bd admin parent command for cleanup/compact/reset (bd-3u8m)

Move cleanup, compact, and reset commands under `bd admin` namespace.
Creates hidden aliases for backwards compatibility that show deprecation
notice when used.

- Create cmd/bd/admin.go with parent command
- Create cmd/bd/admin_aliases.go for hidden backwards-compat aliases
- Update cleanup.go, compact.go, reset.go to remove rootCmd.AddCommand
- Update all documentation to use `bd admin <cmd>` syntax

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-27 16:07:13 -08:00
parent 2c82acd10b
commit d77a697cee
18 changed files with 173 additions and 63 deletions
+11 -11
View File
@@ -296,10 +296,10 @@ bd --actor alice <command>
```bash
# Clean up closed issues (bulk deletion)
bd cleanup --force --json # Delete ALL closed issues
bd cleanup --older-than 30 --force --json # Delete closed >30 days ago
bd cleanup --dry-run --json # Preview what would be deleted
bd cleanup --older-than 90 --cascade --force --json # Delete old + dependents
bd admin cleanup --force --json # Delete ALL closed issues
bd admin cleanup --older-than 30 --force --json # Delete closed >30 days ago
bd admin cleanup --dry-run --json # Preview what would be deleted
bd admin cleanup --older-than 90 --cascade --force --json # Delete old + dependents
```
### Duplicate Detection & Merging
@@ -319,15 +319,15 @@ bd merge bd-42 bd-43 --into bd-41 --dry-run # Preview merge
```bash
# Agent-driven compaction
bd compact --analyze --json # Get candidates for review
bd compact --analyze --tier 1 --limit 10 --json # Limited batch
bd compact --apply --id bd-42 --summary summary.txt # Apply compaction
bd compact --apply --id bd-42 --summary - < summary.txt # From stdin
bd compact --stats --json # Show statistics
bd admin compact --analyze --json # Get candidates for review
bd admin compact --analyze --tier 1 --limit 10 --json # Limited batch
bd admin compact --apply --id bd-42 --summary summary.txt # Apply compaction
bd admin compact --apply --id bd-42 --summary - < summary.txt # From stdin
bd admin compact --stats --json # Show statistics
# Legacy AI-powered compaction (requires ANTHROPIC_API_KEY)
bd compact --auto --dry-run --all # Preview
bd compact --auto --all --tier 1 # Auto-compact tier 1
bd admin compact --auto --dry-run --all # Preview
bd admin compact --auto --all --tier 1 # Auto-compact tier 1
# Restore compacted issue from git history
bd restore <id> # View full history at time of compaction
+1 -1
View File
@@ -576,7 +576,7 @@ jira_project = get_config("jira.project")
Some bd commands automatically use configuration:
- `bd compact` uses `compact_tier1_days`, `compact_tier1_dep_levels`, etc.
- `bd admin compact` uses `compact_tier1_days`, `compact_tier1_dep_levels`, etc.
- `bd init` sets `issue_prefix`
External integration scripts can read configuration to sync with Jira, Linear, GitHub, etc.
+3 -3
View File
@@ -66,7 +66,7 @@ Tombstones expire after a configurable TTL (default: 30 days). This prevents unb
### How Expiration Works
1. Tombstones older than TTL + 1 hour grace period are eligible for pruning
2. `bd compact` removes expired tombstones from `issues.jsonl`
2. `bd admin compact` removes expired tombstones from `issues.jsonl`
3. Git history fallback handles edge cases where pruned tombstones are needed
### Configuration
@@ -85,7 +85,7 @@ bd config set tombstone.ttl_days 60
### Manual Pruning
```bash
bd compact # Prune expired tombstones (and other compaction)
bd admin compact # Prune expired tombstones (and other compaction)
```
## Conflict Resolution
@@ -163,7 +163,7 @@ If you have many old tombstones:
bd list --status=tombstone | wc -l
# Prune expired tombstones
bd compact
bd admin compact
```
## Design Rationale
+2 -2
View File
@@ -333,10 +333,10 @@ Use compaction to remove old closed issues:
```bash
# Preview what would be compacted
bd compact --dry-run --all
bd admin compact --dry-run --all
# Compact issues closed more than 90 days ago
bd compact --days 90
bd admin compact --days 90
```
Or split your project into multiple databases:
+4 -4
View File
@@ -178,16 +178,16 @@ As your project accumulates closed issues, the database grows. Manage size with
```bash
# View compaction statistics
bd compact --stats
bd admin compact --stats
# Preview compaction candidates (30+ days closed)
bd compact --analyze --json --no-daemon
bd admin compact --analyze --json --no-daemon
# Apply agent-generated summary
bd compact --apply --id bd-42 --summary summary.txt --no-daemon
bd admin compact --apply --id bd-42 --summary summary.txt --no-daemon
# Immediately delete closed issues (CAUTION: permanent!)
bd cleanup --force
bd admin cleanup --force
```
**When to compact:**
+3 -3
View File
@@ -486,10 +486,10 @@ Check database size and consider compaction:
bd stats
# Preview compaction candidates
bd compact --dry-run --all
bd admin compact --dry-run --all
# Compact old closed issues
bd compact --days 90
bd admin compact --days 90
```
### Large JSONL files
@@ -501,7 +501,7 @@ If `.beads/issues.jsonl` is very large:
ls -lh .beads/issues.jsonl
# Remove old closed issues
bd compact --days 90
bd admin compact --days 90
# Or split into multiple projects
cd ~/project/component1 && bd init --prefix comp1