this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add utility scripts for plan management

- latest-plan.sh: find and display latest plan file
- save-plan.sh: save plans with auto-incrementing numbers

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

alice 8de12287 8b1dd049

+92
+47
scripts/latest-plan.sh
··· 1 + #!/bin/bash 2 + # Finds and prints the latest plan (or one matching a query) 3 + # Usage: latest-plan.sh [query] 4 + # No args: prints the highest-numbered plan 5 + # With query: finds plans matching the query (by number or name) 6 + 7 + set -euo pipefail 8 + 9 + PLANS_DIR=".claude/plans" 10 + 11 + if [[ ! -d "$PLANS_DIR" ]]; then 12 + echo "No plans directory found at $PLANS_DIR" >&2 13 + exit 1 14 + fi 15 + 16 + # Check if any .md files exist (macOS/BSD compatible) 17 + if [[ -z "$(find "$PLANS_DIR" -maxdepth 1 -name '*.md' -print -quit 2>/dev/null)" ]]; then 18 + echo "No plans found in $PLANS_DIR" >&2 19 + exit 1 20 + fi 21 + 22 + if [[ -z "${1:-}" ]]; then 23 + # No query - get the highest numbered plan 24 + LATEST=$(find "$PLANS_DIR" -maxdepth 1 -name '*.md' -exec basename {} \; \ 25 + | grep -E '^[0-9]{4}-' \ 26 + | sort -n \ 27 + | tail -1 || true) 28 + if [[ -n "$LATEST" ]]; then 29 + cat "$PLANS_DIR/$LATEST" 30 + else 31 + echo "No numbered plans found" >&2 32 + exit 1 33 + fi 34 + else 35 + # Query provided - search by number or name 36 + QUERY="$1" 37 + MATCH=$(find "$PLANS_DIR" -maxdepth 1 -name '*.md' -exec basename {} \; \ 38 + | grep -iE "$QUERY" \ 39 + | sort -n \ 40 + | tail -1 || true) 41 + if [[ -n "$MATCH" ]]; then 42 + cat "$PLANS_DIR/$MATCH" 43 + else 44 + echo "No plan matching '$QUERY' found" >&2 45 + exit 1 46 + fi 47 + fi
+45
scripts/save-plan.sh
··· 1 + #!/bin/bash 2 + # Saves a plan to .claude/plans/NNNN-name.md 3 + # Usage: save-plan.sh <name> < plan-content.md 4 + # or: echo "plan content" | save-plan.sh <name> 5 + # or: save-plan.sh <name> <file> 6 + 7 + set -euo pipefail 8 + 9 + if [[ -z "${1:-}" ]]; then 10 + echo "Usage: save-plan.sh <name> [file]" >&2 11 + echo " Reads from stdin if no file provided" >&2 12 + exit 1 13 + fi 14 + 15 + NAME="$1" 16 + PLANS_DIR=".claude/plans" 17 + 18 + mkdir -p "$PLANS_DIR" 19 + 20 + # Find the next number (macOS/BSD compatible) 21 + NEXT=0 22 + if [[ -d "$PLANS_DIR" ]]; then 23 + HIGHEST=$(find "$PLANS_DIR" -maxdepth 1 -name '*.md' -exec basename {} \; 2>/dev/null \ 24 + | grep -E '^[0-9]{4}-' \ 25 + | sed 's/-.*//' \ 26 + | sort -n \ 27 + | tail -1 || true) 28 + if [[ -n "$HIGHEST" ]]; then 29 + NEXT=$((10#$HIGHEST + 1)) 30 + fi 31 + fi 32 + 33 + # Zero-pad to 4 digits 34 + NUM=$(printf "%04d" "$NEXT") 35 + FILENAME="${NUM}-${NAME}.md" 36 + FILEPATH="$PLANS_DIR/$FILENAME" 37 + 38 + # Read content from file arg or stdin 39 + if [[ -n "${2:-}" ]] && [[ -f "$2" ]]; then 40 + cp "$2" "$FILEPATH" 41 + else 42 + cat > "$FILEPATH" 43 + fi 44 + 45 + echo "$FILEPATH"