#!/bin/bash # Initialize planning files for a new session # Usage: ./init-session.sh [--template TYPE] [project-name] # Templates: default, analytics set -e # Parse arguments TEMPLATE="default" PROJECT_NAME="project" while [[ $# -gt 0 ]]; do case "$1" in --template|-t) TEMPLATE="$2" shift 2 ;; *) PROJECT_NAME="$1" shift ;; esac done DATE=$(date +%Y-%m-%d) # Resolve template directory (skill root is one level up from scripts/) SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SKILL_ROOT="$(dirname "$SCRIPT_DIR")" TEMPLATE_DIR="$SKILL_ROOT/templates" echo "Initializing planning files for: $PROJECT_NAME (template: $TEMPLATE)" # Validate template if [ "$TEMPLATE" != "default" ] && [ "$TEMPLATE" != "analytics" ]; then echo "Unknown template: $TEMPLATE (available: default, analytics). Using default." TEMPLATE="default" fi # Create task_plan.md if it doesn't exist if [ ! -f "task_plan.md" ]; then if [ "$TEMPLATE" = "analytics" ] && [ -f "$TEMPLATE_DIR/analytics_task_plan.md" ]; then cp "$TEMPLATE_DIR/analytics_task_plan.md" task_plan.md else cat > task_plan.md << 'EOF' # Task Plan: [Brief Description] ## Goal [One sentence describing the end state] ## Current Phase Phase 1 ## Phases ### Phase 1: Requirements & Discovery - [ ] Understand user intent - [ ] Identify constraints - [ ] Document in findings.md - **Status:** in_progress ### Phase 2: Planning & Structure - [ ] Define approach - [ ] Create project structure - **Status:** pending ### Phase 3: Implementation - [ ] Execute the plan - [ ] Write to files before executing - **Status:** pending ### Phase 4: Testing & Verification - [ ] Verify requirements met - [ ] Document test results - **Status:** pending ### Phase 5: Delivery - [ ] Review outputs - [ ] Deliver to user - **Status:** pending ## Decisions Made | Decision | Rationale | |----------|-----------| ## Errors Encountered | Error | Resolution | |-------|------------| EOF fi echo "Created task_plan.md" else echo "task_plan.md already exists, skipping" fi # Create findings.md if it doesn't exist if [ ! -f "findings.md" ]; then if [ "$TEMPLATE" = "analytics" ] && [ -f "$TEMPLATE_DIR/analytics_findings.md" ]; then cp "$TEMPLATE_DIR/analytics_findings.md" findings.md else cat > findings.md << 'EOF' # Findings & Decisions ## Requirements - ## Research Findings - ## Technical Decisions | Decision | Rationale | |----------|-----------| ## Issues Encountered | Issue | Resolution | |-------|------------| ## Resources - EOF fi echo "Created findings.md" else echo "findings.md already exists, skipping" fi # Create progress.md if it doesn't exist if [ ! -f "progress.md" ]; then if [ "$TEMPLATE" = "analytics" ]; then cat > progress.md << EOF # Progress Log ## Session: $DATE ### Current Status - **Phase:** 1 - Data Discovery - **Started:** $DATE ### Actions Taken - ### Query Log | Query | Result Summary | Interpretation | |-------|---------------|----------------| ### Errors | Error | Resolution | |-------|------------| EOF else cat > progress.md << EOF # Progress Log ## Session: $DATE ### Current Status - **Phase:** 1 - Requirements & Discovery - **Started:** $DATE ### Actions Taken - ### Test Results | Test | Expected | Actual | Status | |------|----------|--------|--------| ### Errors | Error | Resolution | |-------|------------| EOF fi echo "Created progress.md" else echo "progress.md already exists, skipping" fi echo "" echo "Planning files initialized!" echo "Files: task_plan.md, findings.md, progress.md"