YAML Export Strategy
This document defines how Traceo exports requirements data to YAML format for version control integration, backup, and interoperability.Overview
Traceo supports bidirectional synchronization between PostgreSQL (primary data store) and YAML files (git-friendly format). This enables:- Version Control: Track requirement changes in git
- Code Review: Review requirement changes in pull requests
- Backup: Human-readable backup format
- Interoperability: Import/export with other tools
- Offline Access: Work with requirements without database connection
Export Triggers
| Trigger | Mechanism | Use Case | Latency |
|---|---|---|---|
| On-Demand API | POST /api/export/yaml | Manual backup, migration | Immediate |
| Webhook | Database trigger → Engine | Real-time git sync | <1 second |
| Scheduled | Cron job | Periodic snapshots | Configurable |
| MCP Tool | export_to_yaml tool | AI agent workflows | Immediate |
File Structure
YAML Schema
Requirement File
Index File
Relationships File
Manifest File
API Endpoints
Export All Requirements
Export Single Requirement
Import from YAML
Webhook Configuration
Database Trigger (PostgreSQL)
Engine Webhook Handler
Git Integration
Auto-Commit Configuration
GitHub Actions Workflow
Import Workflow
Validation Pipeline
Import Options
| Option | Description | Default |
|---|---|---|
update_existing | Update existing requirements by external_id | true |
create_missing | Create requirements not in database | true |
delete_orphaned | Delete DB requirements not in YAML | false |
validate_only | Run validation without writing | false |
ignore_errors | Continue on validation errors | false |
Best Practices
1. Directory Structure
- Group by requirement type for easier navigation
- Use consistent naming:
{TYPE}-{CATEGORY}-{NUMBER}.yaml - Include index files for quick reference
2. Git Workflow
- Use feature branches for requirement changes
- Review requirement changes in PRs
- Tag releases with version numbers
3. Conflict Resolution
- Database is source of truth for live data
- YAML is source of truth for versioned snapshots
- Timestamps determine which version wins on conflict
4. Performance
- Export incrementally (only changed requirements)
- Use streaming for large exports
- Compress archives for download
5. Security
- Never include sensitive metadata in YAML
- Use workspace-scoped exports
- Validate input on import
MCP Tool Integration
Future Enhancements
- Real-time Sync: WebSocket-based live updates
- Diff View: Visual requirement diff in web UI
- Merge Tool: Three-way merge for conflicts
- Templates: Starter templates for common requirement types
- Validation Rules: Custom validation rules per workspace