Skip to content

Focus view, copy/paste, safety checks, saved passwords and auto-reconnect (Phases 4–5) - #4

Merged
RileyBeenders merged 8 commits into
mainfrom
phase-4-focus
Oct 18, 2026
Merged

RileyBeenders merged 8 commits into
mainfrom
phase-4-focus

Conversation

@RileyBeenders

Copy link
Copy Markdown
Owner

Stacked PR 4 of 5. Based on phase-3-mirror (#3). Merge #1–#3 first. This PR has two commits, one per phase; each typechecks and passes its tests on its own.

Phase 4: focus view and copy/paste (97d5e3f)

  • Focus view shows one device full size, using the same xterm instance, so the device gets the new size and scrollback is kept. Toggle it with the tile button, a double-click on the header, or Ctrl+Shift+F; Ctrl+PageUp/PageDown step through devices.
  • Entering focus view turns mirroring off; leaving restores the earlier setting (as the plan specifies).
  • Copy/paste follows Windows Terminal / PuTTY: Ctrl+Shift+C/V, Ctrl+Insert/Shift+Insert, and right-click to copy or paste. Ctrl+C copies only when text is selected, so ^C still interrupts. Plain Ctrl+V is left to the device.
  • All shortcut and clipboard keys live in src/shared/keys.ts, with tests.
  • Permission handler: the renderer may use the clipboard and nothing else (no camera, microphone, location, …).
  • Dev SSH server: tui, a full-screen test program standing in for vim/top: alternate screen, redraw on resize, 16/256/truecolour, arrow keys, cursor-position query.

Phase 5: safety and polish (306f53d)

  • Confirmation for risky commands, both broadcasts and Enter typed while mirroring. The patterns in src/shared/danger.ts cover rm -r, reboot/shutdown, mkfs, dd, recursive chmod, firewall flush, interface down, user/password changes, package removal, and network-gear reload/erase. They match only in command position, so grep -r reboot is fine. The dialog lists every target device, and Cancel has the focus. While mirroring, a per-device LineTracker rebuilds the typed line from raw keystrokes.
  • Saved passwords, opt-in "Remember": stored only as Electron safeStorage ciphertext (DPAPI-protected on Windows). The renderer only learns whether a device has a saved secret. A saved secret the device rejects is deleted, and the edit form has "Forget it".
  • Auto-reconnect when a connection drops: 5 tries at 2/5/10/20/30 s, with the password kept in memory only. It stops on auth or host-key problems, Disconnect cancels it, and there's a setting to turn it off.
  • Broadcast command history (Up/Down, memory only) and export of a tile's scrollback or a broadcast's results to a text file.
  • Renderer-crash recovery: the main process reloads the page, and live SSH sessions reappear through session:list.

For reviewers

  • The renderer-crash handling exists because, twice during testing, a launch crashed the renderer and the network service together. That couldn't be reproduced in 18 more launches and looks environmental, so the app now survives it instead.
  • isAppShortcut and clipboardAction intentionally leave plain Ctrl+V, Ctrl+F and Ctrl+M to the device, since shells and editors need them.

Testing

  • npm test: 174 tests (89 at the Phase 4 commit).
  • Focus view in the built app: the device went from 57×18 in the grid to 120×40 in focus and back. The tui test program drew correctly (alternate screen, colours, arrows, cursor report) and redrew on resize (120×40 → 120×13). Typing in focus reached only the focused device. Drag-select plus right-click copied the exact text; right-click and Ctrl+Shift+V pasted.
  • Safety: sudo reboot and a mirrored reboot + Enter were both held for confirmation; Cancel stopped them and confirming sent to all 3. A saved password survived an app restart, and after Remember the password appears nowhere in plain text across all 61 files in the app-data folder (UTF-8 and UTF-16 checked). drop triggered a successful auto-reconnect, and Page.crash brought tiles back connected and usable.
  • Not covered here: real vim/top on a real device, and driving the native Save dialog for export (the export format is unit-tested).

🤖 Generated with Claude Code

- Electron + React + TypeScript app built with electron-vite
- Secure window: context isolation, sandbox, no Node in renderer, CSP
- Preload bridge exposed as window.bulkssh (app version over IPC)
- Placeholder layout: device list, grid area, broadcast bar
- Shared paging helpers (default 6 devices per page) with Vitest tests
- electron-builder config for Windows NSIS installer and portable exe
- .gitignore keeps device lists, settings and SSH keys out of git
- Project plan in .projectPlan/PLAN.md, CLAUDE.md, project skills
- .claude/launch.json: single "dev" config running npm run dev on port 5173
- Pin the electron-vite renderer dev server to 5173 with strictPort
- Make window.bulkssh optional so the renderer loads in a plain browser
- Document the preview setup in CLAUDE.md
- Transport interface with an ssh2-based SshTransport (password,
  keyboard-interactive and private key auth, encrypted key passphrases)
- Session manager: one session per device, readable connection errors,
  re-prompts on wrong password or passphrase
- Host key trust-on-first-use: native dialog for unknown and changed keys,
  trusted keys stored in known_hosts.json
- Device store (devices.json in userData) with shared validation; secrets
  are never written to disk
- IPC handlers validate every argument and reject unknown senders
- Renderer: device list, add/edit form, password prompt, xterm.js terminal
  with fit-to-size and resize forwarding
- npm run dev:ssh: local SSH server with a fake shell for manual testing
- Tests: device validation, stores, and session manager against an
  in-process ssh2 server (34 tests)
- Update CLAUDE.md and the project plan
Runs npm ci --ignore-scripts, typecheck and Vitest on windows-latest (Node 24) for pull requests and pushes to main.
- Paged grid of live terminal tiles for open devices, ordered by device
  number; tiles stay after a disconnect until closed
- Grid shape from min(page size, open devices) so every page has the same
  tile size and page switches never resize terminals
- Pager with numbered pages, Ctrl+PageUp/PageDown (kept from reaching the
  device), and clicking a device row jumps to its tile
- Connect all / Disconnect all; password prompts are queued, with an
  option to reuse one password for the other waiting devices
- Settings dialog and settings.json for devices per page (1-36, default 6)
- Host-key dialogs queued in the main process so bulk connects never
  stack them
- Tests for grid shape, page clamping and settings (48 total)
- Update CLAUDE.md and the project plan
- "Send to" checkbox per device with All / None / Invert
- Mirror mode (button or Ctrl+Shift+M): input typed into a tile also goes
  to every other checked, connected device via one writeMany IPC call;
  source and mirrored tiles are badged and outlined
- Terminal replies (cursor/attribute reports, focus and mouse events,
  OSC/DCS replies) are never mirrored
- Broadcast runs a command on checked devices over SSH exec channels in
  parallel, with per-device output, exit code and duration; output capped
  at 64 KB; per-device timeout setting (default 30 s)
- One failing, slow or disconnected device never affects the others
- Dev SSH server: exec support plus sleep, fail and fail-on commands
- Tests for mirror targets, the report filter, writeMany and exec
  (84 total)
- Update CLAUDE.md and the project plan
- Focus view: one device full size using the same xterm instance, so the
  device gets the new size and scrollback is kept; toggle with the tile
  button, a double-click on the tile header, or Ctrl+Shift+F
- In focus view, Ctrl+PageUp/PageDown step to the previous/next device
- Entering focus turns mirroring off; leaving restores the earlier setting
  unless mirroring was turned on again in focus
- Copy/paste: Ctrl+Shift+C/V, Ctrl+Insert / Shift+Insert, Ctrl+C copies
  only when text is selected (otherwise ^C), right-click copies or pastes;
  pastes are bracketed-paste aware and mirrored like typing
- Shortcut and clipboard keys defined and tested in src/shared/keys.ts
- Permission handler: the renderer may use the clipboard and nothing else
- Dev SSH server: `tui`, a full-screen test program (alternate screen,
  resize redraw, colours, arrow keys, cursor-position query)
- Update CLAUDE.md and the project plan
- Confirmation before risky commands reach several devices: broadcasts
  matching src/shared/danger.ts (rm -r, reboot/shutdown, mkfs, dd,
  recursive chmod, firewall flush, interface down, user changes, package
  removal, network-gear reload/erase), and Enter typed while mirroring,
  using a per-device LineTracker; the dialog lists every target device
- Opt-in "Remember" for passwords and key passphrases, stored only as
  Electron safeStorage ciphertext (DPAPI on Windows); the renderer never
  receives saved secrets; a rejected saved secret is deleted; "Forget it"
  in the device form
- Auto-reconnect when a connection drops (setting, default on): 5 tries
  with growing delays, password kept in memory only, stops on auth or
  host-key problems, cancelled by Disconnect
- Broadcast command history (Up/Down, memory only) and export of a tile's
  scrollback or a broadcast's results to a text file
- Renderer crash recovery: the window reloads and re-adopts live sessions
- Dev SSH server: --password option and `drop` command
- Tests for danger rules, line tracking, credential store, saved-secret
  logins, reconnect and export formatting (174 total)
- Update CLAUDE.md and the project plan
@RileyBeenders
RileyBeenders changed the base branch from phase-3-mirror to main October 18, 2026 01:55
@RileyBeenders
RileyBeenders merged commit 306f53d into main Oct 18, 2026
1 check passed
@RileyBeenders
RileyBeenders deleted the phase-4-focus branch October 18, 2026 02:06
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