Skip to content

feat(host): tokenpulse setup command + smarter serial autodetect#4

Merged
yuchou87 merged 1 commit into
mainfrom
feat/host-setup
Jun 20, 2026
Merged

feat(host): tokenpulse setup command + smarter serial autodetect#4
yuchou87 merged 1 commit into
mainfrom
feat/host-setup

Conversation

@yuchou87

Copy link
Copy Markdown
Owner

Answers two UX questions about the host tool.

1. tokenpulse setup — register into settings.json

go install has 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
  • Auto-detects the serial port.
  • Reads ~/.claude/settings.json, wraps the existing statusLine command as TOKENPULSE_INNER (passthrough preserved), sets statusLine to tokenpulse statusline.
  • Backs up settings.json.bak before writing.
  • Idempotent: no-op if already configured.

2. Smarter serial autodetect

autodetectSerial already globbed /dev/cu.usbmodem* and took the first match. Now it prefers the TokenPulse board (device serial TP_*) 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

  • Fix Makefile host-install (go install . named the binary host, not tokenpulse; now go build -o …/bin/tokenpulse).
  • README documents both.

Verification

  • go vet + go test pass (new unit tests for buildStatusLineCommand / extract+setStatusLineCommand / autodetect preference / idempotency).
  • setup exercised 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).

- '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).
@yuchou87 yuchou87 merged commit 600e5ed into main Jun 20, 2026
2 checks passed
@yuchou87 yuchou87 deleted the feat/host-setup branch June 20, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant