Scripts now correctly determine project root from current working
directory instead of calculating relative to script location.
This fixes the issue when scripts are called via ${CLAUDE_PLUGIN_ROOT}.
Also adds CLAUDE.md and CHANGELOG.md for development guidance.
Bumps version to 1.0.3.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
56 lines
1.3 KiB
Bash
56 lines
1.3 KiB
Bash
#!/bin/bash
|
|
# List all git worktrees
|
|
# Usage: worktree-list.sh
|
|
|
|
set -e
|
|
|
|
# Get project root from current working directory (where Claude Code is running)
|
|
PROJECT_ROOT="$(pwd)"
|
|
|
|
echo "========================================"
|
|
echo " Git Worktrees"
|
|
echo "========================================"
|
|
echo ""
|
|
|
|
# Check if we're in a git repository
|
|
if ! git -C "$PROJECT_ROOT" rev-parse --git-dir > /dev/null 2>&1; then
|
|
echo "Error: Not a git repository"
|
|
exit 1
|
|
fi
|
|
|
|
# List all worktrees from git
|
|
echo "Active Worktrees:"
|
|
echo ""
|
|
|
|
cd "$PROJECT_ROOT"
|
|
WORKTREES=$(git worktree list --porcelain)
|
|
|
|
if [ -z "$WORKTREES" ]; then
|
|
echo " No worktrees found"
|
|
else
|
|
git worktree list
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Show registry info if available
|
|
REGISTRY_FILE="$PROJECT_ROOT/.auto-build-data/worktrees/worktree-registry.json"
|
|
|
|
if [ -f "$REGISTRY_FILE" ]; then
|
|
echo "Auto-Build Registry:"
|
|
echo ""
|
|
|
|
if command -v jq &> /dev/null; then
|
|
jq -r '.worktrees[] | " \(.name) (\(.status))\n Branch: \(.branch)\n Path: \(.path)\n Created: \(.created)\n"' "$REGISTRY_FILE" 2>/dev/null || echo " (empty)"
|
|
else
|
|
cat "$REGISTRY_FILE"
|
|
fi
|
|
else
|
|
echo "Registry not found. Run /ab:worktree create first."
|
|
fi
|
|
|
|
echo ""
|
|
echo "Commands:"
|
|
echo " Create: /ab:worktree create <name>"
|
|
echo " Cleanup: /ab:worktree cleanup [name]"
|