dsh-golden-ward
Customization golden guardian for DSH hosts. When a frequently-customized file (e.g. the plugin-market web client) gets overwritten by a package upgrade, restore it whole-file from a captured golden copy — no manual re-patching, no reinstalling suites.
Install
dsh plugin add github:<owner>/dsh-golden-ward
Then insert into your profile patch (see cordis.patch.yml) and restart dsh.
Usage
- Customize your target file as usual.
- Capture the golden copy once:
curl -X POST "http://127.0.0.1:<port>/goldenward/api?act=init" - Check any time:
curl "http://127.0.0.1:<port>/goldenward/api?act=status" - Restore after an upgrade clobbers it:
curl -X POST "http://127.0.0.1:<port>/goldenward/api?act=restore"
Restore is guarded: it refuses when golden or target is missing, or when the
golden copy lacks the configured marker string (defaults to golden-ward;
set your own marker in config so it matches your customization).
Auto-heal (optional)
Pair with a simple watchdog loop (crontab * * * * * or a while true; sleep 60
shell) that calls act=status and act=restore when hasMarker is false,
then restarts dsh. With that in place, an upgrade-overwritten customization
heals within ~60 seconds with zero manual work.
Config
- id: golden-ward
name: "@local/dsh-golden-ward"
config:
target: ~/.dsh/profiles/web/node_modules/@dsh-market/plugin/lib/client.js
goldenDir: ~/.dsh/golden
marker: golden-ward
Design notes
- Whole-file restore over anchor re-patching: upgrades change code shape, so patch anchors rot; an intact golden copy does not.
initrefuses to capture a target that lacks the marker (never save a clobbered file as golden).- Restore writes via
tmp + rename(atomic on the same filesystem).
No comments yet. Be the first to write one.