device: add rename subcommand - #94
Merged
Merged
Conversation
Rename a configured device offline, in place: host, apiKey, topicID, and list position (default status) are untouched. Matches by name (case-insensitive) or host URL like remove/default, so unnamed legacy entries can be given a name. Rejects names already used by a different device. Previously the only rename paths were 'device add --host --name' (needs the host) or remove+add (silently drops apiKey/topicID and default ordering).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
ff-cli device rename <name> <new-name>— renames a configured FF1 device as a pure offline config edit. Host,apiKey,topicID, and list position (and therefore default status) are untouched.Why
There was no direct way to rename a device. The workarounds are both bad:
device add --host <host> --name <new>works but requires knowing the host URL (or having the device reachable for mDNS discovery).device remove+device addsilently drops the storedapiKey/topicIDand loses default ordering.Names are the primary handle everywhere (
-d office,device default office), and the friendly-name prompt invites labels that change when a frame physically moves.Behavior
device remove/device default— so unnamed legacy entries can be given a name for the first time.Testing
tests/device-rename.test.ts— unit tests for the pure helper (10 cases).tests/device-rename-cli.test.ts— CLI integration against a tempconfig.json, modeled on thedevice defaultintegration test (4 cases).npm run checkgreen: 392 tests, format, lint, copy lint.