mcp/workflow-scripts-v2/status
Lilith eefccd19b9 ci: add Forgejo Actions publish workflows to all packages
Added standardized workflows for automated publishing on push to main/master.
Configuration-driven, version-checked, workspace-aware workflows.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 11:41:53 -08:00

143 lines
4.6 KiB
Bash
Executable file

#!/bin/bash
# Show worktrees organized by recency, highlight blockers
# Usage: ./workflow/status
WORKTREE_BASE="worktrees"
# Refresh symlinks first
"$(dirname "$0")/refresh" > /dev/null
echo "=== BLOCKED ==="
echo ""
BLOCKED_COUNT=0
for dated_dir in "$WORKTREE_BASE"/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]; do
[[ -d "$dated_dir" ]] || continue
for worktree in "$dated_dir"/*/; do
[[ -d "$worktree" ]] || continue
if [[ -f "$worktree/STATUS.md" ]]; then
BLOCKED=$(grep "^blocked:" "$worktree/STATUS.md" 2>/dev/null | cut -d: -f2 | tr -d ' ')
if [[ "$BLOCKED" == "true" ]]; then
NAME=$(basename "$worktree")
REASON=$(grep "^blocker_reason:" "$worktree/STATUS.md" 2>/dev/null | cut -d: -f2-)
echo "$NAME"
echo " Reason: $REASON"
echo " Path: $worktree"
echo ""
((BLOCKED_COUNT++))
fi
fi
done
done
if [[ $BLOCKED_COUNT -eq 0 ]]; then
echo " None"
echo ""
fi
echo "=== TODAY (last 24h) ==="
echo ""
if [[ -d "$WORKTREE_BASE/today" ]]; then
for link in "$WORKTREE_BASE/today"/*; do
[[ -L "$link" ]] || continue
NAME=$(basename "$link")
TARGET=$(readlink -f "$link")
# Get status
PHASE="unknown"
LAST_ACTIVE="?"
if [[ -f "$TARGET/STATUS.md" ]]; then
PHASE=$(grep "^phase:" "$TARGET/STATUS.md" 2>/dev/null | cut -d: -f2 | tr -d ' ')
# Calculate time since last activity
MTIME=$(stat -c %Y "$TARGET/STATUS.md" 2>/dev/null || stat -f %m "$TARGET/STATUS.md" 2>/dev/null)
NOW=$(date +%s)
AGE_SECS=$((NOW - MTIME))
if [[ $AGE_SECS -lt 60 ]]; then
LAST_ACTIVE="just now"
elif [[ $AGE_SECS -lt 3600 ]]; then
LAST_ACTIVE="$((AGE_SECS / 60))m ago"
else
LAST_ACTIVE="$((AGE_SECS / 3600))h ago"
fi
fi
# Get commits ahead
COMMITS=$(git -C "$TARGET" rev-list --count main..HEAD 2>/dev/null || echo "?")
echo " [$NAME] phase=$PHASE commits=$COMMITS last=$LAST_ACTIVE"
echo " cd $TARGET"
done
fi
if [[ ! -d "$WORKTREE_BASE/today" ]] || [[ -z "$(ls -A "$WORKTREE_BASE/today" 2>/dev/null)" ]]; then
echo " None"
fi
echo ""
echo "=== YESTERDAY (24-48h) ==="
echo ""
if [[ -d "$WORKTREE_BASE/yesterday" ]]; then
for link in "$WORKTREE_BASE/yesterday"/*; do
[[ -L "$link" ]] || continue
NAME=$(basename "$link")
TARGET=$(readlink -f "$link")
PHASE="unknown"
LAST_ACTIVE="?"
if [[ -f "$TARGET/STATUS.md" ]]; then
PHASE=$(grep "^phase:" "$TARGET/STATUS.md" 2>/dev/null | cut -d: -f2 | tr -d ' ')
MTIME=$(stat -c %Y "$TARGET/STATUS.md" 2>/dev/null || stat -f %m "$TARGET/STATUS.md" 2>/dev/null)
AGE_SECS=$(($(date +%s) - MTIME))
LAST_ACTIVE="$((AGE_SECS / 3600))h ago"
fi
echo " [$NAME] phase=$PHASE last=$LAST_ACTIVE"
done
fi
if [[ ! -d "$WORKTREE_BASE/yesterday" ]] || [[ -z "$(ls -A "$WORKTREE_BASE/yesterday" 2>/dev/null)" ]]; then
echo " None"
fi
echo ""
echo "=== THIS WEEK ==="
echo ""
WEEK_ONLY=()
if [[ -d "$WORKTREE_BASE/week" ]]; then
for link in "$WORKTREE_BASE/week"/*; do
[[ -L "$link" ]] || continue
NAME=$(basename "$link")
# Skip if already in today or yesterday
[[ -L "$WORKTREE_BASE/today/$NAME" ]] && continue
[[ -L "$WORKTREE_BASE/yesterday/$NAME" ]] && continue
WEEK_ONLY+=("$NAME")
done
fi
if [[ ${#WEEK_ONLY[@]} -gt 0 ]]; then
for NAME in "${WEEK_ONLY[@]}"; do
TARGET=$(readlink -f "$WORKTREE_BASE/week/$NAME")
PHASE="unknown"
LAST_ACTIVE="?"
if [[ -f "$TARGET/STATUS.md" ]]; then
PHASE=$(grep "^phase:" "$TARGET/STATUS.md" 2>/dev/null | cut -d: -f2 | tr -d ' ')
MTIME=$(stat -c %Y "$TARGET/STATUS.md" 2>/dev/null || stat -f %m "$TARGET/STATUS.md" 2>/dev/null)
AGE_DAYS=$(( ($(date +%s) - MTIME) / 86400 ))
LAST_ACTIVE="${AGE_DAYS}d ago"
fi
echo " [$NAME] phase=$PHASE last=$LAST_ACTIVE"
done
else
echo " None (beyond today/yesterday)"
fi
echo ""
# Total count - worktrees are at depth 2 (YYYYMMDD/name)
TOTAL=0
for dated_dir in "$WORKTREE_BASE"/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]; do
[[ -d "$dated_dir" ]] || continue
COUNT=$(find "$dated_dir" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
TOTAL=$((TOTAL + COUNT))
done
echo "Total active worktrees: $TOTAL"