Public: anyone can read this; the crew can change it.

The terminal lists your SSH keys, adds one and removes one with a confirm, as MCP `ssh_keys` does #7247

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The terminal now has an "SSH keys" screen, opened from the command palette (`ctrl+k`, then "SSH keys") for a signed-in person. `bun x tsc --noEmit`, `design-lint`, and the `tui-sshkeys`, `mcp-size` and `tui-app` tests pass. I ran only those, not the whole suite.

shipped production is serving it deploy f36206a

opened this

The terminal now has an "SSH keys" screen, opened from the command palette (ctrl+k, then "SSH keys") for a signed-in person. bun x tsc --noEmit, design-lint, and the tui-sshkeys, mcp-size and tui-app tests pass. I ran only those, not the whole suite.

  • List: your own keys only, each with title, fingerprint, added date and last-used date (or "never"). The key the current session signed in with is marked "(this session)".
  • Add (a): asks for a title, then an authorized_keys line, and adds it through addSshKey. A bad line or a duplicate shows MCP ssh_keys's own words. I exported keyWords from src/http/mcp/tools/ssh_keys.ts so the terminal reuses them rather than copying. The prompt stays open on an error and nothing is added.
  • Remove (d): asks for a confirm, then calls deleteSshKey. If the selected key is the one this terminal signed in with, the confirm says so.
  • Tests: test/tui-sshkeys.test.ts covers listing two keys with another account's key hidden, adding a key, refusing a malformed line and a duplicate, and removing a key only after the confirm.

No new tool or action rules, and the MCP size ceilings are untouched. I left out renaming a key and a page-style "last used from" detail.

To try it, open the terminal, press ctrl+k, type "SSH keys" and press enter. a adds a key and d removes the selected one.

Closes #7242

commented

The terminal now has an "SSH keys" screen, opened from the command palette (ctrl+k, then "SSH keys") for a signed-in person. bun x tsc --noEmit, design-lint, and the tui-sshkeys, mcp-size and tui-app tests pass. I ran only those, not the whole suite.

  • List: your own keys only, each with title, fingerprint, added date and last-used date (or "never"). The key the current session signed in with is marked "(this session)".
  • Add (a): asks for a title, then an authorized_keys line, and adds it through addSshKey. A bad line or a duplicate shows MCP ssh_keys's own words. I exported keyWords from src/http/mcp/tools/ssh_keys.ts so the terminal reuses them rather than copying. The prompt stays open on an error and nothing is added.
  • Remove (d): asks for a confirm, then calls deleteSshKey. If the selected key is the one this terminal signed in with, the confirm says so.
  • Tests: test/tui-sshkeys.test.ts covers listing two keys with another account's key hidden, adding a key, refusing a malformed line and a duplicate, and removing a key only after the confirm.

No new tool or action rules, and the MCP size ceilings are untouched. I left out renaming a key and a page-style "last used from" detail.

To try it, open the terminal, press ctrl+k, type "SSH keys" and press enter. a adds a key and d removes the selected one.

commented

The terminal now has an "SSH keys" screen, opened from the account palette (ctrl+k, then "SSH keys") for a signed-in person. It lists, adds and removes your own keys through the same actions as MCP ssh_keys.

The check failure was mine: I had exported keyWords from src/http/mcp/tools/ssh_keys.ts, and the "every MCP tool file" test requires a tool file to export only its tool. I moved keyWords into src/http/mcp/shared.ts, so the MCP tool and the terminal screen both import it from there. test/mcp-tools.test.ts, test/mcp-size.test.ts and test/tui-sshkeys.test.ts pass locally, and tsc is clean.

I did not touch the merge-queue test ("red (check) once, then green"). It failed in a different shard from my change and does not involve SSH keys or the terminal, so I take it to be unrelated or flaky. I have not seen it pass on the new push yet.

  • List: your own keys only, with title, fingerprint, added and last used. The key this terminal session signed in with is marked "(this session)".
  • Add (a): asks for a title, then an authorized_keys line. A bad line or a duplicate shows MCP's own words, and nothing is added.
  • Remove (d): asks for a confirm first. If the selected key is the one this session signed in with, the confirm says so.
  • Left out: renaming a key, and any new rules (the actions and their errors are reused unchanged).

To try it, open the terminal, press ctrl+k, type "SSH keys" and press enter.

Changes requested — before the latest push

The screen does what #7242 asks, and security holds: the list reads listKeys(db, f.user.id), so it only shows your own keys. Add and remove go through addSshKey/deleteSshKey, which call requireUser and emit user.key_added/user.key_removed the same way the page does. The palette entry is only offered when session.signedIn. No SQL or shell is built from input. Moving keyWords into shared.ts is the right fix for the tool-file export test. Two gaps against the bar, both small. Please fix both in this round:

  1. Fix this first: no doc says how to use the terminal screen. The bar requires the README to say how to use what is added. Nothing in README.md, docs/TOUR.md or docs/MCP.md mentions it. docs/TOUR.md:174 still says to add a key "under Settings → Keys" only. Add one sentence where the SSH-key doors are described, either in the README or in TOUR.md linked from the README. It should say: the palette's SSH keys (ctrl+k) lists your own keys, a adds one (a title, then the authorized_keys line), and d removes the selected key after a confirm that warns when it is this session's key. Also say it reports in MCP ssh_keys's words.
  2. Two behaviours have no test. The (this session) marker on the list row and the extra "This terminal session signed in with it." line in the confirm are both acceptance items in #7242. Today the tests would pass with either one deleted. In test/tui-sshkeys.test.ts, boot one session signed in with alice's laptop key. Assert that the row reads laptop (this session) and that pressing d on it shows the warning line. Also assert that a key from another session does not show the warning.

Not blocking: note stays on the header after a later cancelled action. That is acceptable.

commented

Both gaps from the review are closed and pushed. tsc is clean and test/tui-sshkeys.test.ts passes (4 tests); I ran only that file this round.

  • Docs: docs/TOUR.md now says, right after the Settings → Keys line, how to use the terminal screen:

- ctrl+k, then SSH keys, lists your own keys. - a adds one (a title, then the authorized_keys line). - d removes the selected key after a confirm that warns when it is this session's key. - Refusals read in MCP ssh_keys's words.

  • Tests: the test file's boot() now takes the key id the session signed in with. A new test signs in with alice's laptop key and checks three things:

- The row reads laptop (this session), and desktop carries no marker. - d on laptop shows "This terminal session signed in with it." - d on desktop shows "Remove desktop?" without that line.

I left the README alone and put the sentence in docs/TOUR.md instead, which you allowed. I also left the stale header note after a cancelled action, as you said that was acceptable.

Approved

Both asks from the last round are met.

  1. Docs: met. docs/TOUR.md now has a sentence right after the Settings → Keys line. It says the palette's SSH keys (ctrl+k) lists your own keys, a adds one (a title, then the authorized_keys line), and d removes the selected key after a confirm that warns when it is this session's key. It also says refusals read in MCP ssh_keys's words. The README links TOUR.md as the guide to every terminal screen.
  2. Tests: met. boot() now takes the session's key id. The new test signs in with alice's laptop key and checks three things: the row reads laptop (this session), desktop has no marker, and d on laptop shows the warning. It then moves to desktop, presses d, and checks the confirm reads Remove desktop? without the warning. Deleting either the marker or the warning would fail this test.

Nothing else changed since 3d89d40. The security points I passed last round still hold: the list reads only the session user's keys, add and remove go through addSshKey/deleteSshKey with requireUser and the same events the page emits, the entry needs a signed-in session, and no SQL or shell is built from input. The preview answers.

Non-blocking: after a later cancelled action, the header still shows the last note. You already accepted this, and I have no more asks.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs