Exporting and Applying Patches
Exporting a Patch
Export decisions from your current branch:
$ deciduous diff export --branch feature/auth -o .deciduous/patches/alice-auth.json Exported 12 nodes and 11 edges to .deciduous/patches/alice-auth.json
Export Options
| Option | Purpose |
|---|---|
-o, --output |
Output file path (required) |
-b, --branch |
Filter nodes by branch |
-n, --nodes |
Specific node IDs (e.g., "47-52" or "47,48,51") |
--author |
Author name for the patch |
Examples
# Export by branch $ deciduous diff export --branch feature/auth -o .deciduous/patches/auth.json # Export specific nodes $ deciduous diff export --nodes 47-52 -o .deciduous/patches/rate-limiting.json # Export with author $ deciduous diff export --nodes 47-52 --author alice -o .deciduous/patches/alice-feature.json # Auto-name based on branch and user $ deciduous diff export \ --branch $(git rev-parse --abbrev-ref HEAD) \ -o .deciduous/patches/$(whoami)-$(git rev-parse --abbrev-ref HEAD).json
Patch File Format
Patches are JSON files:
{
"version": "1.0",
"author": "alice",
"branch": "feature/auth",
"exported_at": "2024-01-15T10:30:00Z",
"nodes": [
{
"change_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"node_type": "goal",
"title": "Add user authentication",
"description": null,
"status": "active",
"confidence": 90,
"metadata_json": "{\"branch\":\"feature/auth\",\"prompt\":\"...\"}"
}
],
"edges": [
{
"from_change_id": "a1b2c3d4-...",
"to_change_id": "e5f6g7h8-...",
"edge_type": "leads_to",
"rationale": "Need to decide approach"
}
]
}
Applying Patches
Apply patches from teammates:
$ deciduous diff apply .deciduous/patches/bob-refactor.json Applied 8 nodes (3 new, 5 existing) Applied 7 edges (4 new, 3 existing)
Apply Multiple Patches
$ deciduous diff apply .deciduous/patches/*.json Applied alice-auth.json: 12 nodes, 11 edges Applied bob-refactor.json: 8 nodes, 7 edges Applied carol-perf.json: 5 nodes, 4 edges
Dry Run (Preview)
Preview what would happen without actually applying:
$ deciduous diff apply --dry-run .deciduous/patches/bob-refactor.json Would apply: - 8 nodes (3 new, 5 already exist) - 7 edges (4 new, 3 already exist) No changes made (dry run)
Checking Available Patches
$ deciduous diff status Available patches in .deciduous/patches/: alice-auth.json 12 nodes, exported 2024-01-15 bob-refactor.json 8 nodes, exported 2024-01-14 carol-perf.json 5 nodes, exported 2024-01-13
Where to Store Patches
The convention is .deciduous/patches/:
.deciduous/
├── deciduous.db # gitignored
├── config.toml
└── patches/ # committed to git
├── alice-auth.json
├── bob-refactor.json
└── carol-perf.json
The patches/ directory is tracked in git; the database is not.