mcp-ssh-manager 3.8.7 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/.eslintignore +5 -0
  2. package/.gitattributes +5 -0
  3. package/CHANGELOG.md +371 -6
  4. package/CLAUDE.md +6 -0
  5. package/CODE_OF_CONDUCT.md +18 -0
  6. package/CONTRIBUTING.md +30 -0
  7. package/Formula/ssh-manager.rb +60 -0
  8. package/README.md +484 -964
  9. package/ROADMAP-V4.md +451 -0
  10. package/brand/README.md +43 -0
  11. package/brand/icon.svg +32 -0
  12. package/brand/mark.svg +18 -0
  13. package/brand/wordmark.svg +30 -0
  14. package/cli/app.js +230 -0
  15. package/cli/control.js +116 -0
  16. package/cli/lib/colors.sh +15 -0
  17. package/cli/lib/menu.sh +145 -96
  18. package/cli/portability.js +186 -0
  19. package/cli/ssh-manager +197 -91
  20. package/cli/ssh-manager.js +14 -0
  21. package/cli/style.js +17 -0
  22. package/cli/vault.js +411 -0
  23. package/desktop/ControlPlaneApp.swift +219 -0
  24. package/desktop/build.sh +58 -0
  25. package/desktop/electron/after-pack.cjs +39 -0
  26. package/desktop/electron/electron-builder.yml +148 -0
  27. package/desktop/electron/finalize-artifacts.mjs +83 -0
  28. package/desktop/electron/main.js +815 -0
  29. package/desktop/electron/package-lock.json +3656 -0
  30. package/desktop/electron/package.json +30 -0
  31. package/desktop/electron/prepare-engine.mjs +84 -0
  32. package/desktop/electron/resources/entitlements.mac.plist +22 -0
  33. package/desktop/electron/resources/icon.png +0 -0
  34. package/desktop/electron/resources/trayTemplate.png +0 -0
  35. package/desktop/electron/resources/trayTemplate@2x.png +0 -0
  36. package/desktop/electron/smoke-test.mjs +184 -0
  37. package/dist/ui/app.css +1 -0
  38. package/dist/ui/app.js +501 -0
  39. package/dist/ui/assets/Forum-Regular.woff2 +0 -0
  40. package/dist/ui/assets/JetBrainsMono-Bold.woff2 +0 -0
  41. package/dist/ui/assets/JetBrainsMono-Regular.woff2 +0 -0
  42. package/dist/ui/assets/Karla-Variable.woff2 +0 -0
  43. package/dist/ui/index.html +16 -0
  44. package/docs/DISTRIBUTION.md +136 -0
  45. package/docs/FINAL-TEST-V4.md +209 -0
  46. package/docs/MIGRATION.md +334 -0
  47. package/docs/TESTING-V4.md +119 -0
  48. package/docs/superpowers/specs/2026-10-08-desktop-from-npm-and-cli-design.md +187 -0
  49. package/docs/videos/control-plane.mp4 +0 -0
  50. package/package.json +61 -30
  51. package/scripts/build-interface.mjs +73 -0
  52. package/scripts/capture-screenshots.mjs +191 -0
  53. package/scripts/demo-env.mjs +461 -0
  54. package/scripts/frame-screenshots.py +176 -0
  55. package/scripts/macbook-mockup.py +296 -0
  56. package/scripts/make-tray-icon.py +61 -0
  57. package/scripts/preview-candidate.mjs +291 -0
  58. package/scripts/publish-desktop.mjs +46 -0
  59. package/scripts/record-demo.mjs +229 -0
  60. package/scripts/release-version.mjs +32 -0
  61. package/scripts/render-cli-menu.py +157 -0
  62. package/scripts/requirements-dev.in +12 -0
  63. package/scripts/requirements-dev.txt +424 -0
  64. package/scripts/run-ui-regression.mjs +48 -0
  65. package/scripts/setup-hooks.sh +7 -13
  66. package/scripts/smoke-desktop.mjs +80 -0
  67. package/scripts/test-drag-and-drop.mjs +114 -0
  68. package/scripts/test-first-run.mjs +5 -0
  69. package/scripts/test-import-ui.mjs +5 -0
  70. package/scripts/test-preferences-persist.mjs +5 -0
  71. package/scripts/test-upgrade-from-published.mjs +226 -0
  72. package/scripts/verify-mac-build.sh +153 -0
  73. package/scripts/verify-windows-build.ps1 +15 -0
  74. package/server.json +3 -3
  75. package/skills/README.md +42 -0
  76. package/skills/ssh-incident/SKILL.md +55 -0
  77. package/skills/ssh-operations/SKILL.md +62 -0
  78. package/skills/ssh-restricted/SKILL.md +57 -0
  79. package/src/agent-clients.js +482 -0
  80. package/src/approval.js +291 -0
  81. package/src/audit.js +11 -1
  82. package/src/command-log.js +162 -0
  83. package/src/config-loader.js +119 -4
  84. package/src/config-paths.js +101 -0
  85. package/src/control-plane.js +2730 -0
  86. package/src/desktop-install.js +747 -0
  87. package/src/index.js +179 -213
  88. package/src/live-stream.js +261 -0
  89. package/src/saved-commands.js +150 -0
  90. package/src/secret-store.js +573 -0
  91. package/src/server-aliases.js +8 -7
  92. package/src/server-config-manager.js +33 -7
  93. package/src/server-export.js +106 -0
  94. package/src/server-groups.js +82 -21
  95. package/src/server-import.js +477 -0
  96. package/src/shell-quote.js +9 -2
  97. package/src/ssh-connection.js +155 -0
  98. package/src/ssh-manager.js +186 -13
  99. package/src/tunnel-manager.js +79 -0
  100. package/src/vault-recovery.js +206 -0
  101. package/src/xlsx.js +322 -0
  102. package/docs/images/social-preview.png +0 -0
  103. package/docs/images/social-preview@2x.png +0 -0
  104. package/docs/images/ssh-manager-cli-menu.png +0 -0
@@ -0,0 +1,334 @@
1
+ # Upgrading from 3.8 to 4.0
2
+
3
+ **4.0 is released, on npm and as a desktop application**; the latest is 4.0.1 ([release](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.1)).
4
+ The last 3.8 release is 3.8.7, for anyone who pins the 3.8 line.
5
+
6
+ The upgrade path preserves headless npm/CLI use. The application, vault import
7
+ and approval settings are optional.
8
+
9
+ ## Getting 4.0
10
+
11
+ **The desktop application:** `ssh-manager app` installs the one matching your
12
+ engine, checked against the release, or download it from
13
+ [the release](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.0). The
14
+ macOS build is signed and notarized; the Windows installer is **not code-signed
15
+ in 4.0.0** (Windows warns: *More info → Run anyway*; its SHA-256 is in
16
+ `release-manifest-win32.json` on the release, which `ssh-manager app` checks);
17
+ Linux ships `.deb` and `.AppImage`.
18
+
19
+ **The npm engine and interface, side by side with your current install** —
20
+ nothing global changes, your MCP client keeps using 3.8.x:
21
+
22
+ ```bash
23
+ npm install --prefix ~/ssh-manager-v4 mcp-ssh-manager@4
24
+ ~/ssh-manager-v4/node_modules/.bin/ssh-manager control # prints a local URL
25
+ ```
26
+
27
+ It reads the same `.env`, TOML and `~/.ssh-manager` as your installation, and
28
+ behaves as 3.8.x until you adopt something new. To let an agent use it, add it
29
+ as a second MCP server and remove it when you are done:
30
+
31
+ ```bash
32
+ claude mcp add ssh-manager-v4 ~/ssh-manager-v4/node_modules/.bin/mcp-ssh-manager
33
+ claude mcp remove ssh-manager-v4
34
+ ```
35
+
36
+ ## From npm to the application, and back
37
+
38
+ Your AI tools start whichever ssh-manager their settings name. Installing the
39
+ desktop application changes none of them: they keep starting the npm engine,
40
+ and the application shows what that engine does (approvals, live output) as the
41
+ window on top of it.
42
+
43
+ To have a tool start the application's engine instead — say, to stop
44
+ maintaining Node and npm — open **Options → AI tools** in the application and
45
+ press *Use the app* for that tool. The same tab, opened from
46
+ `ssh-manager control`, works the other way. What it does:
47
+
48
+ | Tool | Where the entry lives | How it is changed |
49
+ |---|---|---|
50
+ | Claude Code | `~/.claude.json` (user scope) | `claude mcp remove` + `claude mcp add-json` when the command is installed; otherwise that one key of the file |
51
+ | Claude Desktop | its `claude_desktop_config.json` | That one key, **only while Claude Desktop is closed** (it rewrites the file when it quits) |
52
+ | Codex | `~/.codex/config.toml` (or `$CODEX_HOME`) | The `[mcp_servers.ssh-manager]` table, replaced where it stands; comments and other tables kept |
53
+
54
+ The entry's environment variables (`SSH_ENV_PATH`, `SSH_CONFIG_PATH`…) are kept,
55
+ so the same servers are read either way. The application's engine is the
56
+ application binary with `ELECTRON_RUN_AS_NODE=1` and its bundled
57
+ `resources/engine/src/index.js`: no Node needed. Restart the tool (or start a
58
+ new Claude Code session) afterwards. *Use npm* switches back.
59
+
60
+ Nothing is offered from an AppImage or from a disk image that was never copied
61
+ to Applications: their path changes on the next start, and an entry pointing
62
+ there would stop working.
63
+
64
+ ## How 4.0.0 reaches you
65
+
66
+ ```bash
67
+ npm update -g mcp-ssh-manager # crosses the major version: 3.8.x → 4.0.0
68
+ ```
69
+
70
+ Two ways it can reach you without that command, both covered by the upgrade test
71
+ below:
72
+
73
+ - **A routine `npm update -g`** updates every global package, and it does cross
74
+ major versions (verified). You will get 4.0.0 the first time you run it.
75
+ - **An MCP client configured with `npx mcp-ssh-manager`** and no version starts
76
+ the latest release each time. It picks up 4.0.0 at its next start.
77
+
78
+ To stay on 3.8 for now, pin it: `npm install -g mcp-ssh-manager@3`, or
79
+ `npx mcp-ssh-manager@3` in the client configuration.
80
+
81
+ Your `.env`, your TOML file, your environment variables, your security modes,
82
+ your groups remain supported. Starting the MCP engine does not start an
83
+ interface or create a vault, and nothing tells you about one: no invitation, no
84
+ banner, no hint in scripts, help, version output or MCP stdout. The interface and
85
+ the desktop application are there for whoever wants them (`ssh-manager control`,
86
+ `ssh-manager app`, key `a` in the menu) and silent for whoever does not.
87
+
88
+ `npm run test:published-upgrade` installs the actual published 3.8.5, upgrades
89
+ to this checkout's npm tarball, and rolls back. It compares the 37 MCP tool
90
+ schemas, server listings and all configured fields using `.env`, TOML and process
91
+ environment fixtures. Secrets are compared without being printed. See
92
+ [the test guide](TESTING-V4.md) for the remaining platform validation.
93
+
94
+ ## The one thing that behaves differently: host keys
95
+
96
+ 3.8.5 **never compared host keys**. Its check looked a host up in
97
+ `~/.ssh/known_hosts`, and accepted the connection whether or not the key the
98
+ server presented matched — so it could not tell your server from someone
99
+ pretending to be it. V4 compares the actual key, on every connection:
100
+
101
+ | The host is… | 3.8.5 | V4 |
102
+ |---|---|---|
103
+ | Not in `known_hosts` | Connected, recorded nothing | Connects, and **records its key** in `known_hosts` — trust on first use, what `StrictHostKeyChecking accept-new` does |
104
+ | In `known_hosts`, same key | Connected | Connects |
105
+ | In `known_hosts`, **different key** | Connected anyway | **Refused, before any credential is sent** |
106
+ | Marked `@revoked` | Connected anyway | Refused |
107
+
108
+ The refusal reads:
109
+
110
+ ```
111
+ SSH host key changed or is not trusted for prod.example.com:22; verify the
112
+ server identity before updating known_hosts
113
+ ```
114
+
115
+ **This is the one case where something that worked on 3.8.5 stops working**, and
116
+ it is deliberate: a changed key is exactly what an interception looks like. It
117
+ usually means the server was rebuilt or reinstalled. Plain `ssh` refuses the same
118
+ host with *REMOTE HOST IDENTIFICATION HAS CHANGED*, so if you also use `ssh`
119
+ directly you have likely met it already.
120
+
121
+ If the server was legitimately rebuilt, **check its new fingerprint through a
122
+ channel you trust** — the hosting provider's console, whoever rebuilt it — then
123
+ remove the old entry and reconnect:
124
+
125
+ ```bash
126
+ ssh-keygen -R prod.example.com # port 22
127
+ ssh-keygen -R '[prod.example.com]:2222' # any other port
128
+ ```
129
+
130
+ or **Options → Known hosts** in the application. The next connection records the
131
+ new key.
132
+
133
+ `SSH_MANAGER_KNOWN_HOSTS=/path/to/file` points V4 at a separate file, if you
134
+ would rather it did not add entries to the `known_hosts` your own `ssh` uses.
135
+
136
+ ## What is new, and optional
137
+
138
+ An **encrypted vault**. Instead of credentials sitting in clear text in a
139
+ `.env`, secrets are stored with AES-256-GCM under a key held in your OS
140
+ keychain. Hosts, ports, users and modes stay readable, so the file can still be
141
+ inspected and diffed — only the secrets are opaque.
142
+
143
+ The vault sits **above** your files, not in place of them:
144
+
145
+ ```
146
+ process environment ← connection settings (never approval)
147
+ └── vault ← wins for servers it holds
148
+ └── .env / TOML ← everything else, exactly as before
149
+ ```
150
+
151
+ A server in the vault is served from the vault. A server only in your `.env` is
152
+ served from your `.env`. Both at once is a normal state, not a broken one — you
153
+ can move servers over one at a time, or never.
154
+
155
+ ## Going further: the setup V4 makes possible
156
+
157
+ Nothing here is required, and none of it happens on its own. In the order that
158
+ keeps you able to go back at every step:
159
+
160
+ 1. **Move credentials out of the clear-text `.env`.** `ssh-manager vault import`,
161
+ or **Import it** from the banner in the application. The secrets are
162
+ encrypted with a key held in your OS keychain; your `.env` is not touched.
163
+ 2. **Make a recovery backup, and check it.** **Options → Vault → Create a
164
+ recovery backup**, or `ssh-manager vault backup <file>`, then
165
+ `ssh-manager vault status` (look for `Readable yes`). The vault's key never
166
+ leaves this machine; the backup, under a passphrase you choose, is what does.
167
+ 3. **Run something real against a server.** Only then, if you want to, remove
168
+ the secrets from your `.env`. Until you do, rolling back to 3.8.5 stays one
169
+ command.
170
+ 4. **Decide how far an agent can go on each server.** `readonly` refuses every
171
+ mutating tool; `restricted` runs only commands matching your allow patterns.
172
+ Both already existed in 3.8 — see [SECURITY_MODES.md](SECURITY_MODES.md).
173
+ 5. **Require your approval where it matters.** **Servers → the server →
174
+ Approval → destructive** (or **always**). The agent pauses until you decide,
175
+ seeing the command in full. When approval is required and the application is
176
+ not open, the request is **refused**, never let through.
177
+ 6. **Keep a record.** The **Activity** screen shows what ran and what you
178
+ decided; `AUDIT_LOG` per server writes it to a file as well.
179
+ 7. **Let your servers know an agent is driving.** `SSH_MANAGER_ANNOUNCE_AGENT=true`
180
+ (or `ANNOUNCE_AGENT=true` per server) sends `AI_AGENT=mcp-ssh-manager` with
181
+ every command; add `AcceptEnv AI_AGENT` to the server's `sshd_config` so it
182
+ keeps it. Off by default — see the README for why.
183
+
184
+ ## Moving a server into the vault
185
+
186
+ Either from the interface — `ssh-manager control` shows a banner naming the file
187
+ and the servers still in it — or from the command line:
188
+
189
+ ```bash
190
+ ssh-manager vault import # reads configured .env / TOML, encrypts, writes the vault
191
+ ```
192
+
193
+ **Your `.env` is not modified.** Not by `import`, not by the interface, not
194
+ ever. Removing secrets from it is a separate decision, and one to make only
195
+ after the next section.
196
+
197
+ For an existing npm setup, open `ssh-manager control` and choose **Import it**
198
+ from the banner. For a new setup, the illustrated welcome takes you directly to
199
+ **Add a server** or **Import servers**. Neither flow is shown by the headless engine.
200
+
201
+ ## Before you delete anything: the key does not travel
202
+
203
+ The vault's key lives in **this machine's** keychain. It is not in the vault
204
+ file, and it does not follow the vault to a backup, a sync folder or a new
205
+ laptop. Copy the vault to another machine and it is a file of ciphertext nobody
206
+ can open.
207
+
208
+ That is the right trade for a key — but it means that the moment your vault is
209
+ the *only* copy of a credential, one wiped keyring stands between you and a
210
+ locked-out afternoon.
211
+
212
+ From the application, use **Options → Vault → Create a recovery backup**.
213
+ Choose and confirm a passphrase, then save the encrypted download. Restore from
214
+ that same screen: choose the file, enter its passphrase, review the server names
215
+ and replacements, then confirm. A preview writes nothing; if another process
216
+ changes the vault, a fresh preview is required.
217
+
218
+ A recovery backup contains saved servers and credentials. It does **not** include
219
+ groups, preferences, host keys or your original configuration files. Back these up
220
+ separately. Private-key paths do not embed the SSH key files they point to.
221
+
222
+ From the CLI, in this order:
223
+
224
+ ```bash
225
+ # 1. A copy that does not depend on this machine
226
+ ssh-manager vault backup ~/ssh-manager-recovery.json
227
+
228
+ # 2. Confirm this machine can actually decrypt what it wrote
229
+ ssh-manager vault status # look for: Readable yes
230
+
231
+ # 3. Run something real against a server
232
+
233
+ # 4. Only now, if you want to, remove the secrets from your .env
234
+ ```
235
+
236
+ The recovery file is encrypted with a **passphrase you choose**, not with the
237
+ machine key. Keep it where you keep passwords — a password manager will hold it
238
+ as an attachment. Unlike the vault, it reveals nothing at all without the
239
+ passphrase, not even a hostname, because it is meant to be stored somewhere less
240
+ trusted.
241
+
242
+ There is no way to recover that passphrase. If you lose it, the file is noise.
243
+
244
+ ## On a new machine
245
+
246
+ ```bash
247
+ ssh-manager vault restore ~/ssh-manager-recovery.json
248
+ ```
249
+
250
+ It asks for the passphrase, tells you what the file holds before you type
251
+ anything, and warns before replacing a server that already exists.
252
+
253
+ ## If the vault is damaged or the key is gone
254
+
255
+ A vault you chose to use must not silently lose its protections. If it exists
256
+ but cannot be parsed or completely decrypted, MCP calls stop with a recovery
257
+ error instead of falling back to potentially less restrictive old files. This
258
+ also applies after a restart. The application can still open **Options → Vault**
259
+ to restore a recovery backup. An installation with no vault keeps its normal
260
+ 3.8.5 configuration path.
261
+
262
+
263
+ You will be told, plainly, rather than left to find out from a failed deploy:
264
+
265
+ ```
266
+ This vault cannot be read on this machine.
267
+
268
+ The vault at ~/.ssh-manager/vault.json is encrypted with a key this machine no
269
+ longer has. A new key was generated, which cannot read it. Nothing has been
270
+ overwritten.
271
+ ```
272
+
273
+ Three ways out, in order of preference:
274
+
275
+ 1. **A recovery file** — `ssh-manager vault restore <file>`.
276
+ 2. **The servers are still in a `.env` / TOML** — retain a separate copy of the
277
+ unreadable vault, move it aside, and run `ssh-manager vault import` again. This is why keeping the `.env` for a while
278
+ is a reasonable thing to do.
279
+ 3. **Neither** — the secrets in that vault are unrecoverable. Move the file
280
+ aside and re-add the servers. The hosts, ports and users are still readable
281
+ in it, so you are re-entering passwords, not rebuilding an inventory.
282
+
283
+ ## Where things live
284
+
285
+ | | Path | Contains |
286
+ |---|---|---|
287
+ | Vault | `~/.ssh-manager/vault.json` | servers; secrets encrypted |
288
+ | Key | OS keychain, or `~/.ssh-manager/vault.key` (0600) | the master key |
289
+ | Recovery file | wherever you put it | saved servers and credentials, under your passphrase |
290
+ | Groups | `~/.ssh-manager/groups.json` | shared by npm, CLI and desktop |
291
+ | Hooks, aliases, profile | `~/.ssh-manager/hooks.json`, `command-aliases.json`, `server-aliases.json`, `profile` | written only when you change one (since 3.8.6) |
292
+ | Logs | `~/.ssh-manager/ssh-manager.log`, `command-history.json`, `errors.log` (0600) | only when `~/.ssh-manager` exists; `SSH_LOG_FILE` / `SSH_HISTORY_FILE` override |
293
+
294
+ `SSH_MANAGER_HOME` overrides the state directory; `SSH_GROUPS_FILE` overrides
295
+ just the groups file. An existing package-local `.server-groups.json` is read
296
+ conservatively and copied to user state on the first successful edit. Keep a
297
+ copy before removing an older installation if it contains your only groups file.
298
+
299
+ Up to 3.8.5 the hook settings, the aliases, the active profile, the log and the
300
+ command history were written inside the installed package, so an upgrade lost
301
+ them. An old file there is still read until your next change writes the new one.
302
+
303
+ `SSH_MANAGER_KEY_SOURCE=file` skips the keychain entirely — needed in CI, in
304
+ containers, and over an SSH session with no desktop keyring.
305
+
306
+ ## Staying on `.env` forever
307
+
308
+ Entirely supported, and not a second-class path. `npm install mcp-ssh-manager`
309
+ with no vault, no `APPROVAL` setting and no control plane running behaves
310
+ exactly like 3.8. The control plane is a separate command you run when you want
311
+ it; the engine never starts one.
312
+
313
+ ## Which `.env` is read
314
+
315
+ `SSH_ENV_PATH` names the file explicitly. When it is not set, V4 also honours
316
+ `SSH_MANAGER_ENV` — the CLI's variable, which 3.8.x's engine never read. A
317
+ profile that still exports `SSH_MANAGER_ENV` towards a file that no longer
318
+ exists is skipped with a warning, so the usual discovery (`~/.ssh-manager/.env`,
319
+ then the working directory, then your home) applies as it did in 3.8.x. A missing
320
+ file named by `SSH_ENV_PATH` stays the choice and is reported at startup, in
321
+ `ssh_list_servers` and in "server not found".
322
+
323
+ ## Rolling back to 3.8.7
324
+
325
+ ```bash
326
+ npm install -g mcp-ssh-manager@3.8.7
327
+ ```
328
+
329
+ 3.8.7 reads the original `.env` / TOML / process environment. V4 does not edit
330
+ those files during vault import, so keeping them makes rollback possible.
331
+ Changes made only in the V4 vault are **not** understood by 3.8.7: retain an
332
+ appropriate original configuration and backup before adopting vault-only changes.
333
+ An older CLI may also use its older package-local groups file. Do not expect it
334
+ to read V4's new user-state groups file automatically.
@@ -0,0 +1,119 @@
1
+ # V4 validation and release gates
2
+
3
+ The npm engine and the desktop application share one engine. Both paths must
4
+ remain usable: upgrading an npm installation must not launch a UI, create a
5
+ vault automatically, or require a human approval unless the user enabled it.
6
+
7
+ ## Contributor commands
8
+
9
+ Use a disposable checkout/test home for the full legacy suite. Browser and
10
+ published-package tests create temporary homes themselves; they use loopback
11
+ fixtures, not your SSH hosts, credentials or keychain.
12
+
13
+ ```sh
14
+ npm ci
15
+ npm test # 52 engine, migration, security, release and preview suites
16
+ npm run lint
17
+ npm run typecheck
18
+ npx knip
19
+ ./scripts/validate.sh
20
+
21
+ npm ci --prefix ui
22
+ npm run build --prefix ui
23
+ cd ui
24
+ npx playwright install --with-deps chromium
25
+ npm run test:e2e
26
+ cd ..
27
+ npm run test:published-upgrade # needs network: actual npm 3.8.5 → V4 → 3.8.5
28
+ ```
29
+
30
+ `dist/ui` is generated, not committed: `prepack` builds it into the npm tarball
31
+ (`npm run build:ui` does the same by hand), and the desktop app builds it when it
32
+ is assembled. CI builds it on three systems, fails if anything generated is
33
+ tracked by git, and release.yml refuses a tarball that does not carry it. Browser
34
+ tests exercise that compiled interface against the real local ControlPlane
35
+ HTTP/SSE server. Playwright reports, traces and failure screenshots are retained in CI.
36
+
37
+ For focused work, run `npm run test:migration`, `test:security`, `test:hostkeys`,
38
+ `test:proxy`, `test:working-directory`, `test:groups-persistence`, `test:release`,
39
+ `test:preview`, `test:desktop-smoke`, `test:cli-experience` or `test:agent-clients`. Existing `test:upgrade`, `test:vault`, `test:recovery`,
40
+ `test:controlplane`, `test:terminal` and `test:files` cover adjacent behavior.
41
+
42
+ `npm run test:preview` checks the disposable candidate profile, real local
43
+ SSH/SFTP fixture, simulated remote commands, restart persistence and cleanup
44
+ without opening a GUI. For an interactive review of the npm tarball or packaged
45
+ application, follow [the final V4 test](FINAL-TEST-V4.md).
46
+
47
+ The old `scripts/test-first-run.mjs`, `scripts/test-import-ui.mjs` and
48
+ `scripts/test-preferences-persist.mjs` entry points now delegate to isolated
49
+ Playwright tests. `--help` explains their arguments; they no longer connect to a
50
+ manually supplied URL or a user's running application.
51
+
52
+ ## Regression coverage
53
+
54
+ | Area | Executable proof |
55
+ | --- | --- |
56
+ | Headless upgrade and rollback | Actual registry 3.8.5, current packed V4, then 3.8.5 again; `.env`, TOML and process env; 37 unchanged tool schemas and server listings, all configured fields, unchanged source files, no UI listener/vault/prompt |
57
+ | Vault and live configuration | Vault creation/edit/deletion reloads; env precedence preserves approval; partial edits preserve secrets, accounts, proxies and restrictions; lost-key and external recovery cases; unreadable vault blocks remote operations while local inspection, cleanup and graphical recovery remain available; strict decryption; stale preview/concurrent restore refusal; confirmed recovery repairs a corrupt key file |
58
+ | Approval boundary | Previously bypassed remote tools, aliases/partial names, exactly one prompt, opt-in fail-closed behavior, in-flight identity snapshot and pooled-connection invalidation |
59
+ | SSH transport | Real local ssh2 host-key handshake and changed-key refusal before authentication; revoked and hashed known hosts; multi-hop ProxyJump and ProxyCommand; working-directory injection canaries |
60
+ | CLI adoption | No invitation at all; nothing on commands, help, version, pipes, CI or MCP stdout; the desktop app named in the menu's status line only when installed |
61
+ | AI tools engine switch | Claude Code (through `claude mcp` and by file), Claude Desktop (refused while running) and Codex (table replaced in place, comments kept) switched between npm and the application and back; other settings and the entry's environment kept; unparsable files refused untouched; AppImage and disk-image paths never offered; the written configuration starts a real engine over MCP; Options → AI tools in the browser, with axe; the packaged application's own engine started over MCP on all three platforms |
62
+ | Interface | First-server creation, direct import, legacy import/edit preservation, keyboard focus/Escape, axe accessibility, narrow viewport, reduced motion, connection loss, preferences across a new port, encrypted backup/preview/restore including files above 1 MB |
63
+ | Groups and distribution | Legacy groups migrated into shared user state, write failures preserved; signed application unchanged by edits; version/channel/commit/hash checks, tampered artifacts rejected, RC isolation |
64
+ | Candidate preview | Disposable home and file-backed key; encrypted fixture credentials; real SFTP confined to scratch files; simulated remote commands; same-profile control-plane restart; older desktop artifacts refused; orderly cleanup |
65
+
66
+ Accessibility automation covers the welcome dialog and the vault panel. It is
67
+ not a claim of a complete screen-reader or WCAG audit of every application view.
68
+ Recovery through the interface is limited to 16 MB encrypted files; larger
69
+ vaults use the CLI. Backup refuses an oversized download so it never offers a
70
+ file that its own restore screen cannot accept.
71
+
72
+ ## CI and release conditions
73
+
74
+ - Engine tests: Linux on Node 18, 20, 22 and 24. Existing required check names
75
+ remain intact. Packaging/tooling uses Node 24 independently of the engine's
76
+ supported Node range.
77
+ - Interface and actual published-package upgrade: macOS, Windows and Linux.
78
+ - Desktop: packaged smoke tests, real Electron/terminal startup, user-state
79
+ persistence and platform signature checks before publishing final metadata.
80
+ - Linux: install the generated `.deb`, then run its packaged UI and terminal as
81
+ an unprivileged user under Xvfb. The installer configures its AppArmor profile
82
+ and Chromium sandbox; AppImage startup remains a separate platform test.
83
+ - macOS: Developer ID + notarization/stapling on the final application and
84
+ distribution image; hashes/blockmaps regenerated afterward.
85
+ - Windows stable: valid Authenticode required. Unsigned dry runs/RCs do not count
86
+ as evidence of a signed production release.
87
+ - RC: npm `next` and GitHub prerelease; no stable Homebrew/MCP Registry update.
88
+ - Stable: final tested commit/tag, all artifact manifests validated, platform
89
+ checks green and explicit release decision. See [DISTRIBUTION.md](DISTRIBUTION.md).
90
+
91
+ ## Verified locally on 2026-09-24, for 4.0.0-beta.1
92
+
93
+ On the preview commit, macOS, Node 25.8.2: `npm test` (46 suites),
94
+ lint and JSDoc typecheck pass; the actual registry upgrade/rollback
95
+ (`npm run test:published-upgrade`) passes all eight checks; `npm audit
96
+ --omit=dev` is clean for the engine, desktop shell and interface. The AI_AGENT
97
+ announcement was additionally checked against a real OpenSSH with
98
+ `AcceptEnv AI_AGENT`: absent by default, present on exec, interactive shell and
99
+ ssh+SendEnv once enabled, absent under a per-server `false` and for control-plane
100
+ actions. CI repeats the engine suites on Node 18, 20, 22 and 24.
101
+
102
+ ## Verified locally on 2026-09-07
103
+
104
+ The engine suites, lint, JSDoc typecheck and knip passed on macOS with Node 25.8.2.
105
+ The new preview suite also passed; `npm test` now contains 44 suites, including a desktop terminal smoke regression that accepts VT output but rejects input echo alone. Latest
106
+ focused results include seven security checks and nine recovery checks. The
107
+ actual registry upgrade/rollback passed all eight checks. Eleven Chromium flows
108
+ cover the UI paths above. An isolated macOS arm64 packaged application passed
109
+ Electron startup, UI rendering, native terminal, group persistence and strict
110
+ ad hoc signature verification before and after use during implementation. The
111
+ final release artifacts must repeat these checks after the branch is integrated.
112
+
113
+ Targeted upgrade (10 checks), migration (13) and the earlier six-check security
114
+ suite also passed on Node 18.20.8 and Node 24.20.0, using isolated homes. The added
115
+ seventh security check covers local cleanup with an unreadable vault.
116
+
117
+ No Windows/Linux runner or production signing/notarization run was executed
118
+ locally. Those are release gates, not inferred successes. The V4 production
119
+ release has not been published.
@@ -0,0 +1,187 @@
1
+ # From npm to the desktop app in one step, and a CLI worth looking at
2
+
3
+ Date: 2026-10-08 · Status: design approved in conversation, spec awaiting review · Target: 4.0.0-beta.3
4
+
5
+ ## Why
6
+
7
+ Someone who installed mcp-ssh-manager from npm has the engine their agents use, the `ssh-manager` CLI and,
8
+ since V4, a browser interface (`ssh-manager control`). The desktop application — menu bar, native
9
+ notifications, updates itself — exists, but nothing in the npm product leads to it: today it is a GitHub page
10
+ to find, a file to pick for the right architecture, an installer to run by hand. The maintainer's ask:
11
+ "from npm, switch to the interface easily — one click, and it installs". The browser interface should say the
12
+ application exists and offer to move to it. And the CLI, which has looked the same since 3.1, should look like
13
+ the product it belongs to.
14
+
15
+ What stays true:
16
+
17
+ - **The application does not replace the npm engine.** Claude Code, Codex and Claude Desktop keep launching the
18
+ npm engine; the application is the window on top of it, as it is today.
19
+ - **Nothing happens unless asked.** No `postinstall` script, no download without a click or a command, no new
20
+ prompt in a command people already script. Direct commands, pipes and CI stay silent (the existing
21
+ `suggestDesktop` rules).
22
+ - **Every existing CLI command and menu number keeps its meaning.**
23
+
24
+ Success: on a Mac with the npm package only, `ssh-manager app` — or one click in the browser interface — leaves
25
+ the signed application installed and open, its integrity proven, with the agents still on the npm engine; the
26
+ CLI opens on a screen that says where things stand.
27
+
28
+ ## 1. Getting the application: `src/desktop-install.js`
29
+
30
+ One module, used by the CLI command and by the control plane. No new dependency.
31
+
32
+ ### Which file, from where
33
+
34
+ - The engine installs the application of **its own version**: `package.json` `version`, release tag
35
+ `v<version>`. A 4.0.0 engine never installs 4.1.0, and a beta engine installs its beta.
36
+ - The release publishes, per platform, `release-manifest-<platform>.json` (`darwin`, `win32`, `linux`): every
37
+ artifact with its `size` and `sha256`. The release workflow already checks every uploaded file against these
38
+ manifests, so they are the reference. JSON, so no YAML parser is needed.
39
+ - Artifact per platform, chosen from the manifest by name pattern:
40
+
41
+ | Platform | Artifact | Install |
42
+ |---|---|---|
43
+ | macOS arm64 / x64 | `SSH-Manager-<v>-<arch>.zip` | unpack with `ditto -x -k`, verify, move to `/Applications` (or `~/Applications` when `/Applications` is not writable) |
44
+ | Windows x64 / arm64 | `SSH-Manager-<v>-setup.exe` | run it with `/S` (silent, per user, no administrator rights) |
45
+ | Linux x64 | `SSH-Manager-<v>-amd64.deb` | `sudo apt-get install -y <file>`, in the terminal only (the password is asked there) |
46
+ | Linux x64 without apt | `SSH-Manager-<v>-x86_64.AppImage` | `~/Applications/SSH-Manager.AppImage`, mode 0755 |
47
+ | anything else (Linux arm64, …) | — | not offered: the message names the releases page |
48
+
49
+ - URLs: `https://github.com/bvisible/mcp-ssh-manager/releases/download/v<v>/<file>`, HTTPS only, following
50
+ GitHub's redirect to its asset host. The base URL is a parameter of the module's functions for tests; the CLI
51
+ and the control plane always use the real one, and there is no environment override.
52
+
53
+ ### Verification — nothing is installed unless all of it holds
54
+
55
+ 1. The downloaded file's size and SHA-256 equal the manifest's. Computed while downloading, into a private
56
+ temporary directory (`mkdtemp`, 0700).
57
+ 2. macOS: after unpacking, `codesign --verify --deep --strict` passes, the signature's `TeamIdentifier` is
58
+ `BT249938WK` (bVisible Sarl, the release's Developer ID), and `spctl --assess --type execute` accepts it
59
+ (notarized). Windows builds are not code-signed yet: the hash is the check, and the release notes say so.
60
+ 3. Any failure removes the temporary directory and installs nothing.
61
+
62
+ The trust anchor is the release itself, served over HTTPS: the hash catches a truncated or mismatched download,
63
+ and the Apple signature catches anything not built and notarized by us.
64
+
65
+ ### Already installed
66
+
67
+ Detected at the usual places — macOS `/Applications/SSH Manager.app` then `~/Applications/…` (version from its
68
+ `Info.plist`); Windows `%LOCALAPPDATA%\Programs\SSH Manager\SSH Manager.exe`; Linux `ssh-manager-desktop` on the
69
+ `PATH`, then the AppImage above. When found, the command **opens** it and downloads nothing: keeping it current is
70
+ the application's own auto-update. When the installed version is older than the engine, the message says the
71
+ application will offer its update.
72
+
73
+ ### API
74
+
75
+ ```
76
+ desktopStatus({ platform, arch, env }) -> { supported, installed, path, version, method }
77
+ installDesktop({ version, platform, arch, baseUrl, onProgress, run })
78
+ -> { path, version } // throws, having installed nothing
79
+ openDesktop({ path, platform, run }) -> void // detached
80
+ ```
81
+
82
+ `method` is `"auto"` (macOS, Windows, Linux AppImage) or `"terminal"` (Linux `.deb`, which needs `sudo`).
83
+ `onProgress({ phase, received, total })` with phases `manifest`, `download`, `verify`, `install`, `open`.
84
+ `run` (the command runner) is injectable so tests never touch the real system.
85
+
86
+ ## 2. The CLI command: `ssh-manager app`
87
+
88
+ A native Node command (`cli/app.js`, registered in `nativeCommands`), so it works on Windows without Bash.
89
+
90
+ ```
91
+ $ ssh-manager app
92
+
93
+ SSH Manager — desktop application
94
+
95
+ ↓ SSH-Manager-4.0.0-arm64.zip 128 MB ████████████ 100%
96
+ ✓ SHA-256 matches release v4.0.0
97
+ ✓ signed and notarized by Apple (bVisible Sarl)
98
+ ✓ installed in /Applications/SSH Manager.app
99
+ → opening…
100
+
101
+ Your agents keep using this npm engine; the app shows what they do
102
+ and lets you decide.
103
+ ```
104
+
105
+ - `ssh-manager app --status` prints the state in one line (used by the menu, below).
106
+ - Exit codes: 0 opened, 1 failed (nothing installed), 2 not available for this platform.
107
+ - When an `ssh-manager control` is already running, the command says that the application takes over the
108
+ approval socket and that the browser control plane can be stopped.
109
+
110
+ ## 3. The browser interface
111
+
112
+ - **A banner**, only when the interface runs in a browser tab (`inDesktopApp` is false) and the control plane
113
+ offers it: "SSH Manager is also a desktop app: menu bar, native notifications, updates itself."
114
+ **[Install the app]** · **[Not now]**. "Not now" is remembered per browser (`localStorage`). When the
115
+ application is already installed, the button reads **[Open the app]**. On Linux with the `.deb` route, the
116
+ banner shows `ssh-manager app` with a copy button instead, since a click cannot type a `sudo` password.
117
+ - The click calls the control plane, which runs `installDesktop` then `openDesktop`; progress arrives on the
118
+ existing event stream (`{ type: 'desktop', phase, received, total }`), drawn as a progress bar in the banner.
119
+ - **Hand-over.** Once the application is open, the browser control plane says "Continued in the desktop app —
120
+ you can close this tab" and stops itself a few seconds later, freeing the approval socket for the
121
+ application. Without this, the application would take the socket and leave the browser control plane running
122
+ with nobody able to reach it.
123
+ - **Endpoints**, token-protected like the rest, offered only when the control plane is started by
124
+ `ssh-manager control` (`offerDesktop: true`), never inside the application:
125
+ - `GET /api/desktop` → `desktopStatus()` plus `{ installing, phase, error }`
126
+ - `POST /api/desktop/install` → 202, runs once at a time (409 while running)
127
+ - `POST /api/desktop/open` → opens the installed application, then the hand-over
128
+ - `ssh-manager control` adds one line to its start-up text: "Prefer a window? `ssh-manager app` installs and
129
+ opens the desktop app" (or "opens it" when installed).
130
+
131
+ ## 4. The CLI's look
132
+
133
+ **Home screen** (the interactive menu), in the application's orange (`#c04500` ≈ 256-colour 166, falling back to
134
+ bold where colours are off), no emoji:
135
+
136
+ ```
137
+ ▲ SSH Manager 4.0.0
138
+ 63 servers · ~/.ssh-manager/.env · desktop app 4.0.0 installed
139
+
140
+ SERVERS FILES
141
+ 1 List, test, add, edit 3 Sync (rsync)
142
+ 2 Connect (SSH session) 4 Tunnels
143
+ 6 Run a command
144
+ 5 Health AGENTS
145
+ 9 Watch what they run
146
+ SETTINGS a Desktop app (open / install)
147
+ 7 Configuration
148
+ t MCP tools
149
+ v Encrypted vault
150
+ i Import servers ? Help q Quit
151
+
152
+ › _
153
+ ```
154
+
155
+ - Every existing number keeps its meaning (1 servers … 9 control plane, 0 exit); letters are added (`a` desktop
156
+ app, `t` tools, `v` vault, `i` import, `?` help, `q` quit). `0` still quits and `8` still opens the help, though
157
+ the screen shows `?` and `q` for them.
158
+ - The status line: server count and the configuration file in use (`~` for the home), and the application's
159
+ state from `ssh-manager app --status`. Each part degrades to nothing rather than slowing or breaking the menu.
160
+ - Two columns when the terminal is at least 72 columns wide, one column below.
161
+ - Sub-menus and `--help` use the same palette and headings. `--help` is rewritten in sections — servers, files,
162
+ agents and the interface, settings — with aligned columns and a few common examples; every current command
163
+ stays listed, `app` is added.
164
+ - The one-time invitation (`suggestDesktop`) now points to `ssh-manager app` instead of the releases page.
165
+ - Non-interactive output (direct commands, pipes, `NO_COLOR`, `TERM=dumb`) is not restyled beyond honouring
166
+ `NO_COLOR`.
167
+
168
+ ## 5. Tests
169
+
170
+ - `tests/test-desktop-install.js`, against a local HTTP server standing in for the release, with an injected
171
+ command runner: success path (each step called in order, the app "opened"); wrong hash, wrong size, missing
172
+ manifest (404), unsupported platform — each leaves no file behind and installs nothing; already installed →
173
+ opens without downloading; macOS signature checks failing (wrong team, `spctl` refusal) → nothing installed.
174
+ - Control plane: `GET /api/desktop`, `POST /api/desktop/install` with an injected installer (progress events on
175
+ the stream, 409 when busy), endpoints absent when `offerDesktop` is false, hand-over stops the plane.
176
+ - Interface: a Playwright flow — banner present in a browser tab, absent with `?shell=macos`, "Not now"
177
+ remembered, install drives the progress bar against a mocked endpoint.
178
+ - CLI: `--help` lists `app`; the home screen rendered with a fake home (status line, keys, one and two columns);
179
+ the invitation mentions `ssh-manager app`; direct commands and pipes stay silent.
180
+ - A real run on this Mac before release: remove `/Applications/SSH Manager.app`, `ssh-manager app` installs and
181
+ opens the published beta; then the browser button after removing it again.
182
+
183
+ ## Out of scope
184
+
185
+ - Updating an installed application from npm (the application updates itself).
186
+ - Code-signing Windows builds (needs an Authenticode certificate).
187
+ - Rewriting the CLI's sub-menus or moving it off Bash.
Binary file