Status: Future Vision
Priority: High (Revolutionary)
Category: Document Processing, Unix Philosophy
Enable XSLT-style transformations using the filesystem as the transformation medium. Decompose hierarchical documents (XML, JSON, YAML) into flat files with dot notation, transform using Unix tools, and recompose back to structured format.
Philosophy: "Everything is a file. Everything is composable."
Transforming hierarchical documents (XML configs, API schemas, build manifests) is common but painful:
Current approach (XSLT):
- Complex syntax, steep learning curve
- Non-composable (can't use grep/sed/awk)
- Hard to debug intermediate states
- Format-specific (XML needs XSLT, JSON needs jq, YAML needs yq)
Decompose → Transform → Recompose:
xml-to-recur config.xml # Decompose: XML → files
sed -i 's/localhost/prod/' ** # Transform: Unix tools
recur-to-xml config # Recompose: files → XMLResult: XSLT-level power with Unix simplicity.
{format}-to-recur- Decompose documents to filesrecur-to-{format}- Recompose files to documentsrecur transform- High-level transformation wrapper
Input (config.xml):
<config>
<database>
<host>localhost</host>
<port>5432</port>
</database>
</config>Decompose:
xml-to-recur config.xml -d temp/
# Creates:
# temp/config.database.host.txt = "localhost"
# temp/config.database.port.txt = "5432"Transform:
sed -i 's/localhost/production-db/' temp/config.database.host.txtRecompose:
recur-to-xml temp/config > production-config.xmlEnvironment Promotion:
# Merge base + prod overrides
recur merge \
<(recur tree config -d base/ --json) \
<(recur tree config -d prod/ --json) \
--base config | recur-to-xmlDetect Breaking Changes:
openapi-to-recur v1.yaml -d v1/
openapi-to-recur v2.yaml -d v2/
recur merge <(recur tree api -d v1/ --json) \
<(recur tree api -d v2/ --json) \
--base api --show-sep | \
grep "\[v1\]" | grep -v "\[v2\]" # Removed endpoints = breaking!# Update all timeout values to 60
recur files "**.timeout" | xargs sh -c 'echo "60" > "$1"' _| Feature | XSLT | Recur Transform |
|---|---|---|
| Learning curve | Steep | Shallow (Unix tools) |
| Composability | No | Yes (pipes!) |
| Debuggability | Hard | Easy (files visible) |
| Format support | XML only | XML, JSON, YAML, any |
| Version control | Opaque diffs | Line-by-line diffs |
Phase 1: XML support (xml-to-recur, recur-to-xml)
Phase 2: JSON support
Phase 3: YAML support
Phase 4: Transform wrapper (recur transform)
Phase 5: Advanced features (streaming, validation)
<server host="localhost"/>Store as: server.@attr.host.txt = "localhost"
{"items": ["a", "b"]}Store as: items.0.txt = "a", items.1.txt = "b"
Store metadata: value.@meta.type.txt = "integer"
- ✅ Lossless round-trip (decompose → compose == original)
- ✅ Works with real configs (K8s, Terraform, Maven)
- ✅ Faster than XSLT for common transforms
- ✅ Fully composable with Unix tools
"XSLT is painful. XML is powerful. Unix is composable."
This enables:
- Transform documents using grep/sed/awk instead of XSLT
- Format-agnostic transformations
- Debuggable intermediate states (files!)
- Git-friendly line-by-line diffs
- Composable with any Unix tool
Dennis Ritchie's philosophy applied to documents: Everything is a file.
- README.CORE.IMPROVEMENT13.md - Configuration management patterns
- docs/main.command.merge.readme.md - Merge command