CLI and library for managing Roku device registry state, built on @danecodes/roku-odc.
Define named registry configurations (presets) and activate them with one call — like database fixtures but for Roku app state.
npm install @danecodes/roku-registryimport { RegistryManager } from '@danecodes/roku-registry';
const reg = new RegistryManager('192.168.0.30');const all = await reg.getAll(); // Record<string, Record<string, string>>
const section = await reg.getSection('auth'); // Record<string, string>
const value = await reg.get('auth', 'token'); // string | undefined// Save current registry state
await reg.snapshot('./snapshots/logged-in.json');
// Restore from a snapshot (clears existing, then sets)
await reg.restore('./snapshots/logged-in.json');Snapshot format is plain JSON:
{
"auth": { "token": "abc123", "refreshToken": "xyz" },
"settings": { "parentalControls": "true", "maxRating": "PG-13" },
"onboarding": { "completed": "true" }
}// Compare current device state to a snapshot
const diff = await reg.diff('./snapshots/expected.json');
// Compare two snapshots
const diff = await reg.diffSnapshots('./before.json', './after.json');
// Pretty-print
console.log(reg.formatDiff(diff));
// + auth.newKey = "value"
// - settings.removedKey = "old"
// ~ onboarding.step = "3" → "5"const reg = new RegistryManager('192.168.0.30', {
presets: {
'fresh-install': {},
'logged-in': {
auth: { token: 'test-token-123', userId: 'user_abc' },
onboarding: { completed: 'true' },
},
'premium-subscriber': {
auth: { token: 'test-token-123', userId: 'user_abc' },
subscription: { tier: 'premium', expires: '2099-01-01' },
onboarding: { completed: 'true' },
},
},
});
// Activate a preset (clears registry first)
await reg.activate('logged-in');
// Activate with overrides (deep-merged into the preset)
await reg.activate('logged-in', {
auth: { token: 'different-token' },
});
// List available presets
const names = await reg.listPresets(); // string[]
// Get preset data without activating
const data = await reg.getPreset('premium-subscriber');roku-registry get # full registry as JSON
roku-registry get auth # one section
roku-registry get auth.token # one valueroku-registry set auth.token abc123 # set a single key
roku-registry set auth '{"token":"abc","userId":"u1"}' # set entire sectionroku-registry clear # clear all sections
roku-registry clear auth # clear one section
roku-registry clear auth settings # clear multiple sectionsroku-registry snapshot ./state.json # save current state
roku-registry restore ./state.json # restore from fileroku-registry diff ./expected.json # compare device to file
roku-registry diff ./before.json ./after.json # compare two filesroku-registry presets # list available presets
roku-registry activate fresh-install # activate a preset
roku-registry activate logged-in --override auth.token=xyzroku-registry --device 192.168.0.30 # specify device IP
roku-registry --config ./my-presets.json # specify config file| Variable | Description |
|---|---|
ROKU_DEVICE_IP |
Default device IP when --device is not specified |
Presets are loaded from the first source found:
--configflagroku-registry.jsonin cwd.roku-registry.jsonin cwdroku-registrykey inpackage.json
{
"presets": {
"fresh-install": {},
"logged-in": {
"auth": { "token": "test-token-123", "userId": "user_abc" },
"onboarding": { "completed": "true" }
}
}
}MIT