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

View File

@@ -171,7 +171,7 @@ Track compaction costs:
```bash
# Show stats after compaction
bd compact --stats
bd admin compact --stats
# Estimate monthly cost
# (issues_compacted / 1000) * $1.00

View File

@@ -46,7 +46,7 @@ fi
# Check eligible issues
echo "Checking eligible issues (Tier $TIER)..."
ELIGIBLE=$(bd compact --dry-run --all --tier "$TIER" --json 2>/dev/null | jq '. | length' || echo "0")
ELIGIBLE=$(bd admin compact --dry-run --all --tier "$TIER" --json 2>/dev/null | jq '. | length' || echo "0")
if [ -z "$ELIGIBLE" ] || [ "$ELIGIBLE" = "null" ]; then
ELIGIBLE=0
@@ -61,18 +61,18 @@ fi
if [ "$DRY_RUN" = true ]; then
echo "🔍 Dry run mode - showing candidates:"
bd compact --dry-run --all --tier "$TIER"
bd admin compact --dry-run --all --tier "$TIER"
exit 0
fi
# Run compaction
echo "🗜️ Compacting $ELIGIBLE issues (Tier $TIER)..."
bd compact --all --tier "$TIER"
bd admin compact --all --tier "$TIER"
# Show stats
echo
echo "📊 Statistics:"
bd compact --stats
bd admin compact --stats
echo
echo "✅ Auto-compaction complete"

View File

@@ -48,17 +48,17 @@ git pull origin main 2>&1 | tee -a "$LOG_FILE"
# Tier 1 compaction
log "Running Tier 1 compaction..."
TIER1_COUNT=$(bd compact --all --json 2>&1 | jq '. | length' || echo "0")
TIER1_COUNT=$(bd admin compact --all --json 2>&1 | jq '. | length' || echo "0")
log "Compacted $TIER1_COUNT Tier 1 issues"
# Tier 2 compaction
log "Running Tier 2 compaction..."
TIER2_COUNT=$(bd compact --all --tier 2 --json 2>&1 | jq '. | length' || echo "0")
TIER2_COUNT=$(bd admin compact --all --tier 2 --json 2>&1 | jq '. | length' || echo "0")
log "Compacted $TIER2_COUNT Tier 2 issues"
# Show statistics
log "Compaction statistics:"
bd compact --stats 2>&1 | tee -a "$LOG_FILE"
bd admin compact --stats 2>&1 | tee -a "$LOG_FILE"
# Commit and push if changes exist
if git diff --quiet .beads/issues.jsonl issues.db 2>/dev/null; then

View File

@@ -30,14 +30,14 @@ fi
# Preview candidates
echo "--- Preview Tier 1 Candidates ---"
bd compact --dry-run --all
bd admin compact --dry-run --all
echo
read -p "Proceed with Tier 1 compaction? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "--- Running Tier 1 Compaction ---"
bd compact --all
bd admin compact --all
echo "✅ Tier 1 compaction complete"
else
echo "⏭️ Skipping Tier 1"
@@ -46,14 +46,14 @@ fi
# Preview Tier 2
echo
echo "--- Preview Tier 2 Candidates ---"
bd compact --dry-run --all --tier 2
bd admin compact --dry-run --all --tier 2
echo
read -p "Proceed with Tier 2 compaction? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "--- Running Tier 2 Compaction ---"
bd compact --all --tier 2
bd admin compact --all --tier 2
echo "✅ Tier 2 compaction complete"
else
echo "⏭️ Skipping Tier 2"
@@ -62,7 +62,7 @@ fi
# Show stats
echo
echo "--- Final Statistics ---"
bd compact --stats
bd admin compact --stats
echo
echo "=== Compaction Complete ==="