feat(host): tokenpulse setup command + smarter serial autodetect#4
Merged
Conversation
- 'tokenpulse setup': one-shot registration into ~/.claude/settings.json. Detects the serial port, wraps the existing statusLine command as TOKENPULSE_INNER (passthrough preserved), backs up settings.json, idempotent (no-op if already configured). Flags: --yes, --serial, --settings. - autodetectSerial now prefers the TokenPulse board (serial 'TP_*') over a bare first /dev/cu.usbmodem* match, so a second usbmodem / ROM JTAG port in download mode isn't grabbed. - Fix Makefile host-install (go install named the binary 'host', not 'tokenpulse'). - README: document setup + autodetect. go test + vet pass; setup verified on a temp settings.json (idempotency + wrap).
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.
Answers two UX questions about the host tool.
1.
tokenpulse setup— register into settings.jsongo installhas no post-install hook, so "auto-prompt on install" isn't possible — instead, a one-shot command:tokenpulse setup # prompts before writing; --yes / --serial / --settings~/.claude/settings.json, wraps the existingstatusLinecommand asTOKENPULSE_INNER(passthrough preserved), sets statusLine totokenpulse statusline.settings.json→.bakbefore writing.2. Smarter serial autodetect
autodetectSerialalready globbed/dev/cu.usbmodem*and took the first match. Now it prefers the TokenPulse board (device serialTP_*) so a second usbmodem device — or the ROM USB-JTAG port when the board is in download mode — isn't grabbed by mistake. Falls back to first match.Also
Makefilehost-install(go install .named the binaryhost, nottokenpulse; nowgo build -o …/bin/tokenpulse).Verification
go vet+go testpass (new unit tests for buildStatusLineCommand / extract+setStatusLineCommand / autodetect preference / idempotency).setupexercised on a temp settings.json: idempotency (already-configured → no-op, no backup) and fresh wrap (existing command preserved as inner, port filled, permissions intact, backup written).