#!/bin/bash # setup-plan.sh - Setup Implementation Plan with Context7 + Web Research integration # Usage: ./setup-plan.sh --json set -e REPO_ROOT=$(pwd) JSON_OUTPUT=false # Parse arguments while [[ $# -gt 0 ]]; do case $1 in --json) JSON_OUTPUT=true shift ;; *) shift ;; esac done # Define paths SPECS_DIR="$REPO_ROOT/.specify" FEATURE_SPEC="$SPECS_DIR/specs/wordpress-plugin-kivicare-appointment-control.md" IMPL_PLAN="$SPECS_DIR/plan.md" BRANCH=$(git branch --show-current) # Create directories if needed mkdir -p "$SPECS_DIR/research" mkdir -p "$SPECS_DIR/contracts" mkdir -p "$SPECS_DIR/templates" # Verify feature spec exists if [ ! -f "$FEATURE_SPEC" ]; then echo "Error: Feature specification not found at $FEATURE_SPEC" exit 1 fi # Create plan template if not exists if [ ! -f "$SPECS_DIR/templates/plan-template.md" ]; then cat > "$SPECS_DIR/templates/plan-template.md" << 'EOF' # Implementation Plan Template ## Context Analysis [To be filled by planning process] ## Architecture Design [To be filled by planning process] ## Implementation Phases [To be filled by planning process] ## Validation Gates [To be filled by planning process] EOF fi # Copy template to plan location cp "$SPECS_DIR/templates/plan-template.md" "$IMPL_PLAN" # Output JSON result if [ "$JSON_OUTPUT" = true ]; then echo "{\"FEATURE_SPEC\":\"$FEATURE_SPEC\",\"IMPL_PLAN\":\"$IMPL_PLAN\",\"SPECS_DIR\":\"$SPECS_DIR\",\"BRANCH\":\"$BRANCH\"}" else echo "Plan setup complete:" echo "Feature Spec: $FEATURE_SPEC" echo "Implementation Plan: $IMPL_PLAN" echo "Specs Directory: $SPECS_DIR" echo "Branch: $BRANCH" fi