mcp/workflow-scripts-v2/phase
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

54 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# Update worktree phase
# Usage: ./workflow/phase <name> <phase>
# Phases: started, planning, implementation, testing, review, blocked, done
set -e
NAME="$1"
PHASE="$2"
WORKTREE_BASE="worktrees"
VALID_PHASES="started planning implementation testing review blocked done"
if [[ -z "$NAME" ]] || [[ -z "$PHASE" ]]; then
echo "Usage: ./workflow/phase <name> <phase>"
echo "Phases: $VALID_PHASES"
exit 1
fi
# Validate phase
if [[ ! " $VALID_PHASES " =~ " $PHASE " ]]; then
echo "Error: Invalid phase '$PHASE'"
echo "Valid phases: $VALID_PHASES"
exit 1
fi
# Find worktree
WORKTREE_PATH=$(find "$WORKTREE_BASE" -mindepth 2 -maxdepth 2 -type d -name "$NAME" 2>/dev/null | head -1)
if [[ -z "$WORKTREE_PATH" ]]; then
echo "Error: Worktree '$NAME' not found"
exit 1
fi
STATUS_FILE="$WORKTREE_PATH/STATUS.md"
if [[ ! -f "$STATUS_FILE" ]]; then
echo "Error: No STATUS.md in $WORKTREE_PATH"
exit 1
fi
# Update phase
sed -i "s/^phase:.*/phase: $PHASE/" "$STATUS_FILE"
sed -i "s/^last_modified:.*/last_modified: $(date -Iseconds)/" "$STATUS_FILE"
# If phase is blocked, remind to use block command
if [[ "$PHASE" == "blocked" ]]; then
echo "Phase set to blocked. Don't forget to set the reason:"
echo " ./workflow/block $NAME 'reason here'"
fi
# Touch the worktree to update mtime for symlink refresh
touch "$WORKTREE_PATH/STATUS.md"
echo "Phase updated: $NAME -> $PHASE"