How kendroger/io-snapshot works
io-snapshot is a behavior-preservation tool for refactoring: it instruments exported functions, records real inputs and outputs through a local daemon, restores original files, then replays snapshots against refactored code and reports output drift. Its principal workflow is CLI record → instrumentation → application use and capture → stop/restore → CLI test and verification. The graph also shows the reusable recorder, configuration, and backup support. Source excerpts establish the main calls and data transfers; other README-described capabilities are included where implementation details were not shown.
Main entry points: cli.js Command CLI · transformer.js Inject and restore · daemon.js Capture daemon · verifier.js Replay and diff
Components 13
CLI workflow
- Command CLI
bin/cli.js - Config loading
lib/config.js - Logging
lib/logger.js
Instrumentation and backups
- Inject and restore
lib/transformer.js - Injected recorder
lib/recorder-inline.js - Session paths
lib/paths.js - Source backups
Capture runtime
- Recorder API
lib/recorder.js - Capture daemon
lib/daemon.js - Snapshot log
Snapshot verification
- Replay and diff
lib/verifier.js
Other components
- Developer
- Application functions
Connections 18
- Developer → Command CLI: runs commands
README.md - Command CLI → Inject and restore: injects or restores
bin/cli.js - Command CLI → Replay and diff: starts verification
bin/cli.js - Command CLI → Capture daemon: controls over HTTP
bin/cli.js - Command CLI → Config loading: loads settings
bin/cli.js - Command CLI → Logging: reports status
bin/cli.js - Capture daemon → Config loading: loads settings
lib/daemon.js - Inject and restore → Injected recorder: embeds recorder
lib/transformer.js - Inject and restore → Session paths: gets backup paths
lib/transformer.js - Inject and restore → Source backups: writes and restores
lib/transformer.js - Session paths → Source backups: resolves locations
lib/paths.js - Inject and restore → Application functions: instruments files
README.md - Application functions → Injected recorder: calls wrapped functions
- Injected recorder → Capture daemon: posts telemetry
lib/recorder-inline.js - Recorder API → Capture daemon: posts telemetry
lib/recorder.js - Capture daemon → Snapshot log: appends telemetry
lib/daemon.js - Replay and diff → Snapshot log: reads recorded cases
lib/verifier.js - Replay and diff → Application functions: imports and replays
lib/verifier.js