This directory contains test examples and scripts for the planfile project, including ecosystem integrations with LLX, Proxy, and OpenRouter.
examples/
├── README.md # This file
├── test_all_examples.py # Test runner with LLM validation
├── llx_validator.py # LLX validation utilities
├── validate_with_llx.sh # Shell script for validation
├── readme-tests/ # Tests for README examples
│ └── test_readme_examples.sh
├── bash-generation/ # Bash scripts for planfile.yaml generation
│ ├── test_planfile_generation.sh
│ └── verify_planfile.sh
├── interactive-tests/ # Interactive mode tests
│ ├── test_interactive_mode.py
│ └── test_interactive_expect.sh
├── ecosystem/ # Ecosystem integration examples
│ ├── 01_full_workflow.sh # Complete workflow: planfile → llx → proxy
│ ├── 02_mcp_integration.py # MCP tools for LLM agents
│ ├── 03_proxy_routing.py # Smart model routing with proxy
│ └── 04_llx_integration.py # Metric-driven planning with LLX
├── strategies/ # Example strategy files
│ └── simple.yaml
├── tasks/ # Example task patterns
│ └── common.yaml
├── run_all_tests.sh # Master test runner
├── quick-start/ # ⚡ Quick start guide (NEW!)
│ ├── README.md
│ ├── run.sh
│ └── quick_start_examples.py
├── integrated-functionality/ # 🚀 Integrated features demo
│ ├── README.md
│ ├── run.sh
│ └── integrated_functionality_examples.py
├── cli-commands/ # 💻 CLI commands showcase
│ ├── README.md
│ ├── run.sh
│ └── cli_command_examples.py
├── external-tools/ # 🔧 External tools integration
│ ├── README.md
│ ├── run.sh
│ └── external_tools_examples.py
└── advanced-usage/ # 🎯 Advanced patterns and workflows
├── README.md
├── run.sh
└── advanced_usage_examples.py
# Core planfile
pip install -e .
# Optional integrations
pip install planfile[all] # Includes litellm, llx, and all PM backends
# Or install individually
pip install litellm llx PyGithub python-gitlab jira# For OpenAI (if using)
export OPENAI_API_KEY=sk-...
# For GitHub backend (if using)
export GITHUB_TOKEN=ghp_...
# For OpenRouter (free LLM validation)
export OPENROUTER_API_KEY=sk-or-v1-...Each example has its own folder with README and run.sh script:
# Quick start (beginners)
cd quick-start && ./run.sh
# Integrated functionality (complete overview)
cd integrated-functionality && ./run.sh
# CLI commands (command-line interface)
cd cli-commands && ./run.sh
# External tools (code2llm, vallm, redup)
cd external-tools && ./run.sh
# Advanced usage (power users)
cd advanced-usage && ./run.sh# Test all examples with LLM validation
python test_all_examples.py
# Or use the shell runner
./run_all_tests.shDemonstrates the complete ecosystem flow:
- Generate strategy with planfile
- Analyze with LLX
- Route through Proxy for cost optimization
- Track progress
./ecosystem/01_full_workflow.shShows how planfile can be used as MCP tools by LLM agents:
planfile_generate: Create strategies from project analysisplanfile_apply: Execute strategies and create ticketsplanfile_review: Track progress and validate completion
python ecosystem/02_mcp_integration.pyDemonstrates smart model routing through Proxy:
- Task-based model selection
- Cost optimization
- Budget tracking
- Fallback chains
python ecosystem/03_proxy_routing.pyShows metric-driven planning using LLX:
- Code analysis and metrics collection
- Optimal model selection based on complexity
- Task scope estimation
- Quality gate definition
python ecosystem/04_llx_integration.pyGet started with planfile in minutes! This example shows the basics:
- Generate strategy from files
- Create templates
- Load and analyze strategies
- Export to different formats
- Compare strategies
cd quick-start && ./run.shComprehensive demo of all new integrated features:
- File analysis without external scripts
- Template generation for different project types
- Strategy comparison and merging
- Multiple export formats
- Statistics and health checking
cd integrated-functionality && ./run.shShows how to use all new CLI commands:
planfile template- Generate templatesplanfile stats- View statisticsplanfile export- Export to various formatsplanfile compare- Compare strategiesplanfile health- Check project healthplanfile generate-from-files- Analyze and generate
cd cli-commands && ./run.shIntegration with external analysis tools:
- code2llm - Code complexity analysis
- vallm - Validation and linting
- redup - Code duplication detection
- Combined analysis with all tools
# Install tools first
pip install code2llm vallm redup
cd external-tools && ./run.shAdvanced patterns and workflows:
- Custom file patterns
- Focus-specific strategies
- Iterative strategy refinement
- Batch processing multiple directories
- Custom metrics integration
- CI/CD workflow automation
cd advanced-usage && ./run.shThe examples include automated validation using LLX:
# Validate all generated files
./validate_with_llx.sh
# Or use Python validator
python llx_validator.pyFree LLM validation using OpenRouter:
# Set your OpenRouter API key
export OPENROUTER_API_KEY=sk-or-v1-...
# Run tests with LLM validation
python test_all_examples.pyThe validation checks:
- YAML Structure: Valid strategy format
- Code Quality: Python syntax and best practices
- Logic Validation: Task priorities and estimates
- Security: Basic security checks
Tests the CLI commands shown in the README file:
./readme-tests/test_readme_examples.shTests planfile.yaml generation with various project structures:
./bash-generation/test_planfile_generation.shValidates generated planfile.yaml files for correctness:
./bash-generation/verify_planfile.shPython-based test:
./interactive-tests/test_interactive_mode.pyExpect-based test (requires expect):
./interactive-tests/test_interactive_expect.shThe examples test:
- README Examples: All CLI commands demonstrated in the README
- Planfile Generation:
- Default generation
- Custom configuration
- Complex project structures
- Generation consistency
- Planfile Verification:
- YAML syntax validation
- Required sections check
- Content structure validation
- Interactive Mode:
- Basic interactive input
- Custom data input
- Repeatable generation
- Error handling
- Ecosystem Integration:
- LLX metric-driven planning
- Proxy smart routing
- MCP tool integration
- Full workflow automation
- planfile command installed (
pip install -e .from project root) - Python 3.10+
- Optional: expect (for interactive tests)
- Optional: LLX (for advanced validation)
- Optional: OpenRouter API key (for LLM validation)
Install optional dependencies:
# LLX for code analysis
pip install llx
# Expect for interactive tests
# Ubuntu/Debian: sudo apt-get install expect
# macOS: brew install expect
# RHEL/CentOS: sudo yum install expectEach test generates:
- Console output with test progress
- Log files in respective test directories
- Generated planfile.yaml examples
- Validation reports (test-results.json)
# Generate template
planfile template web ecommerce
# Generate from files
planfile generate-from-files . --focus quality
# View statistics
planfile stats strategy.yaml
# Export formats
planfile export strategy.yaml --format html
planfile export strategy.yaml --format csv
# Compare strategies
planfile compare old.yaml new.yaml
# Health check
planfile health .from planfile import Strategy
from planfile.analysis.generator import generator
# Generate from analysis
strategy = generator.generate_from_current_project(".")
# Create template
from planfile.cli.extra_commands import generate_template
template = generate_template("web", "ecommerce")
# Load and analyze
s = Strategy.load("strategy.yaml")
stats = s.get_stats()
# Compare
comparison = s1.compare(s2)
# Export
yaml_data = s.export("yaml")
json_data = s.export("json")Each example folder generates its own set of files:
quick-start/
quick-start.yaml- Basic generated strategyweb-template.yaml- Web project templateweb-template.json- Template in JSON format
integrated-functionality/
generated-from-examples.yaml- Strategy from file analysistemplate-*.yaml- Project templates (web, mobile, ml)strategy-export.*- Various export formatsmerged-strategy.yaml- Combined strategy
cli-commands/
cli-example-*.yaml- Generated strategiescli-example-*.json- JSON exportscli-example.html- HTML report
external-tools/
*.toon.yaml- External tool outputs (if tools installed)external-tools-generated.yaml- Strategy from external analysisquality-focused.yaml- Quality-focused strategy
advanced-usage/
custom-patterns-strategy.yaml- Custom analysis strategyfocus-*-strategy.yaml- Focus-specific strategiesiterative-*.yaml- Strategy versionsbatch-*-strategy.yaml- Batch processing resultsci-workflow.sh- Generated CI/CD script
- Start with
cd quick-start && ./run.shfor basics - Use
cd integrated-functionality && ./run.shfor complete overview - Install external tools for deeper analysis:
pip install code2llm vallm redup - Each example has its own README with detailed information
- Check generated YAML files to understand structure
- Use
./run.shin each folder for easy execution
project:
name: "my-project"
focus: "complexity"
metrics:
total_files: 25
avg_cc: 6.2
max_cc: 18
sprints:
- id: sprint-1
name: "Critical Fixes"
goal: "Reduce complexity in god modules"
task_patterns:
- name: "Split god module (CC=18)"
task_type: "refactor"
priority: "critical"
model_hints:
planning: "premium"
implementation: "balanced"
quality_gates:
- name: "Complexity Gate"
metric: "avg_cc"
threshold: 3.0
operator: "<="If tests fail:
- Check that planfile is installed:
which planfile - Verify Python version:
python3 --version - Check test log files for detailed errors
- Run individual tests to isolate issues
- For LLM validation, check OpenRouter API key
-
LLX not found
pip install llx
-
Proxy not running
docker run -p 4000:4000 proxym/proxy
-
OpenRouter API key
- Get free key at: https://openrouter.ai/keys
- Set environment variable:
export OPENROUTER_API_KEY=...
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Planfile │────▶│ LLX │────▶│ Proxy │
│ │ │ │ │ │
│ - Strategy │ │ - Analysis │ │ - Routing │
│ - Tasks │ │ - Metrics │ │ - Budget │
│ - Gates │ │ - Models │ │ - Cache │
└─────────────┘ └─────────────┘ └─────────────┘
Each tool plays a specific role:
- Planfile: Strategy definition and orchestration
- LLX: Code analysis and model selection
- Proxy: Smart routing and cost optimization