This directory contains all automation scripts for the SpecPilot project, organized by functionality to support the SpecPilot development workflow.
scripts/
├── README.md # This documentation
├── common/ # Shared utilities
│ └── logging.sh # Unified logging system
├── github/ # GitHub integration tools
│ ├── README.md # GitHub tools documentation
│ ├── github-manager.sh # Main GitHub integration manager
│ ├── setup-labels.sh # GitHub labels configuration
│ └── ... (other GitHub tools)
├── git-worktree/ # Git worktree management tools
│ ├── README.md # Git worktree documentation
│ └── ... (worktree scripts)
└── specpilot-workflow.sh # Main SpecPilot workflow orchestratorUnified logging and utility functions used across all scripts.
Key Features:
- Consistent logging to
.specpilot-debug.log - Script execution tracking with start/end timestamps
- Error handling and operation logging
- Compatible with
src/tools/logging system
Complete GitHub integration suite for managing milestones, issues, and pull requests.
Key Features:
- Automatic milestone creation from epics
- Issue management synchronized with tasks
- Label management system
- Status synchronization between SpecPilot and GitHub
Quick Start:
# Setup (one-time)
./scripts/github/setup-labels.sh
# Daily usage
./scripts/github/github-manager.sh sync-allGit worktree tools for isolated development environments per task.
Key Features:
- Isolated development branches
- Clean workspace management
- Parallel development support
- Automatic cleanup and synchronization
Main orchestrator script that coordinates all development workflow components.
Key Features:
- Task lifecycle management
- Branch creation and management
- Integration with GitHub tools
- Worktree coordination
The specpilot-workflow.sh script provides comprehensive task lifecycle management through the following operations:
Purpose: Initialize development environment for a new task
Operations performed:
- Update task status:
new→in_progressin main branch - Update related epic status to
in_progress(if epic wasnew) - Commit status updates to main branch with standardized message
- Create isolated worktree environment via
create-worktree.sh - Sync updated spec files to worktree directory
- Sync with GitHub Issues and Milestones (conditional)
- Restore any stashed changes
Output: Ready development environment in workspaces/<task-id>
Purpose: Complete development and prepare for code review
Operations performed:
- Commit and push worktree changes (if executed from worktree directory)
- Add all changes with
git add . - Commit with standardized message format
- Push to feature branch
<task-id>-feature
- Add all changes with
- Update task status:
in_progress→reviewin main branch - Check and update epic completion status
- Commit status updates to main branch
- Sync updated spec files to worktree
- Verify GitHub repository exists
- Create pull request via
create-pr.sh - Sync with GitHub Issues and Milestones (conditional)
Output: Pull request created, task ready for review
Purpose: Finalize task completion and cleanup
Operations performed:
- Update task status:
review→donein main branch - Check and update epic completion status (mark epic as
doneif all tasks complete) - Commit final status updates to main branch
- Merge pull request via
merge-pr.sh - Sync updated spec files to worktree
- Sync with GitHub to close Issues and update Milestones (conditional)
- Clean up worktree environment via
cleanup-worktree.sh
Output: Task completed, PR merged, environment cleaned
Purpose: Create isolated development environment
Operations performed:
- Validate task ID parameter
- Execute
git-worktree/create-worktree.shwith task ID and base branch - Log operation details
Purpose: Remove worktree and optionally clean up branch
Operations performed:
- Validate task ID parameter
- Execute
git-worktree/cleanup-worktree.shwith cleanup options - Log operation details
Purpose: Synchronize worktree with latest base branch changes
Operations performed:
- Validate task ID parameter
- Execute
git-worktree/sync-worktree.shwith sync parameters - Log operation details
Purpose: Display all active worktrees
Operations performed:
- Execute
git-worktree/list-worktrees.sh - Display worktree status and locations
Purpose: Create pull request for task
Operations performed:
- Validate task ID parameter
- Verify GitHub repository exists via
check-or-create-repo.sh - Execute
github/create-pr.shwith PR details - Log operation details
Purpose: Check pull request status
Operations performed:
- Validate task ID parameter
- Execute
github/check-pr-status.sh - Display PR status information
Purpose: Merge pull request with specified method
Operations performed:
- Validate task ID parameter
- Execute
github/merge-pr.shwith merge method - Log merge operation
Purpose: Display comprehensive usage information
Operations performed:
- Display usage syntax and examples
- Show AI agent quick reference
- List all available operations with descriptions
- Provide workflow examples
All operations include:
- Parameter validation with clear error messages
- Comprehensive error trapping and logging
- GitHub CLI authentication verification
- Git repository state validation
- Uncommitted changes detection and handling
- Operation logging to
.specpilot-debug.log - Graceful cleanup on script interruption
# Required tools
brew install gh # GitHub CLI
git --version # Git (2.5+)# 1. Initialize GitHub integration
./scripts/github/setup-labels.sh
# 2. Sync project to GitHub
./scripts/github/github-manager.sh sync-all
# 3. Start development on a task
./scripts/specpilot-workflow.sh start-task task-001
# 4. Update task status and sync
./scripts/github/github-manager.sh sync-task task-001See github/README.md for comprehensive GitHub integration documentation including:
- Label system configuration
- Milestone and issue management
- Status synchronization workflows
- API integration details
See git-worktree/README.md for git worktree documentation including:
- Worktree creation and management
- Branch isolation strategies
- Cleanup and maintenance procedures
- Kebab-case: All script files use kebab-case naming
- Descriptive: Names clearly indicate functionality
- Organized: Scripts grouped by functional area
# All scripts support --help
./scripts/github/github-manager.sh --help
# Consistent parameter patterns
./scripts/github/github-manager.sh <operation> <target>
./scripts/git-worktree/create-worktree.sh <task-id>- All scripts include comprehensive error checking
- Clear error messages with suggested solutions
- Safe defaults and validation
- Automatic logging of errors and failures
- All scripts log execution details to
.specpilot-debug.log - Enable debug mode:
export SPECPILOT_DEBUG=true - Custom log file:
export SPECPILOT_DEBUG_FILE=/path/to/logfile - Unified logging format with timestamps and operation tracking
- Place in appropriate subdirectory
- Follow naming conventions
- Include comprehensive help text
- Add error handling and validation
- Include logging integration: Source
common/logging.sh - Update relevant README.md
#!/bin/bash
# Script description and purpose
set -e # Exit on error
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
# Source logging utilities
source "$PROJECT_ROOT/scripts/common/logging.sh"
# Error trap to log failures
trap 'log_script_end "script-name.sh" "false"' ERR
# Log script start
log_script_start "script-name.sh" "$*"
# Color output functions
# Parameter validation with log_error for failures
# Main functionality with log_operation for key operations
# Error handling
# Log successful completion
log_script_end "script-name.sh" "true"| Component | GitHub | Git Worktree | SpecPilot | Logging |
|---|---|---|---|---|
| Tasks | ✅ Issues | ✅ Branches | ✅ Files | ✅ Operations |
| Epics | ✅ Milestones | ➖ N/A | ✅ Files | ✅ Operations |
| Status | ✅ Labels | ✅ Branch State | ✅ YAML | ✅ Tracked |
| Progress | ✅ Automated | ✅ Tracked | ✅ Calculated | ✅ Logged |
| Debug | ➖ CLI Output | ➖ Git Output | ✅ Debug Mode | ✅ Unified |
- Regular Synchronization: Sync changes frequently to maintain consistency
- Atomic Operations: Use specific sync commands for targeted updates
- Status Verification: Check project status before major operations
- Clean Workflows: Use worktree isolation for all development tasks
- Debug Logging: Enable
SPECPILOT_DEBUG=truewhen troubleshooting issues - Log Monitoring: Check
.specpilot-debug.logfor detailed operation history