mcp-ssh-manager 4.0.0 → 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.
- package/.gitattributes +3 -3
- package/CHANGELOG.md +62 -0
- package/CLAUDE.md +4 -0
- package/CODE_OF_CONDUCT.md +18 -0
- package/CONTRIBUTING.md +30 -0
- package/Formula/ssh-manager.rb +2 -2
- package/README.md +48 -8
- package/desktop/electron/main.js +108 -13
- package/desktop/electron/package-lock.json +2 -2
- package/desktop/electron/package.json +1 -1
- package/desktop/electron/prepare-engine.mjs +5 -3
- package/desktop/electron/smoke-test.mjs +12 -0
- package/dist/ui/app.css +1 -1
- package/dist/ui/app.js +124 -109
- package/docs/DISTRIBUTION.md +2 -2
- package/docs/MIGRATION.md +1 -1
- package/docs/TESTING-V4.md +6 -4
- package/package.json +29 -29
- package/scripts/build-interface.mjs +73 -0
- package/scripts/requirements-dev.in +12 -0
- package/scripts/requirements-dev.txt +424 -0
- package/scripts/setup-hooks.sh +7 -13
- package/server.json +3 -3
- package/src/control-plane.js +78 -4
- package/src/desktop-install.js +8 -0
- package/src/shell-quote.js +9 -2
package/.gitattributes
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# The
|
|
2
|
-
#
|
|
1
|
+
# The interface sources are checked out with LF on Windows too: the build must
|
|
2
|
+
# reproduce byte for byte on every system (mixed CRLF input and LF injections
|
|
3
|
+
# from Vite would otherwise change index.html).
|
|
3
4
|
ui/** text=auto eol=lf
|
|
4
|
-
dist/ui/** text=auto eol=lf
|
|
5
5
|
*.woff2 -text
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,68 @@ All notable changes to MCP SSH Manager will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [4.0.1] - 2026-10-26
|
|
11
|
+
|
|
12
|
+
**The application tells you about updates, and nothing changes in the engine.**
|
|
13
|
+
Everything below is in the interface, the packaging and the metadata: the MCP
|
|
14
|
+
engine behaves exactly as in 4.0.0 (the release pipeline upgrades 3.8.5, 3.8.6,
|
|
15
|
+
3.8.7 and 4.0.0 from the registry to this version and back). The desktop app
|
|
16
|
+
updates itself from 4.0.0 and from the 4.0.0 betas.
|
|
17
|
+
|
|
18
|
+
The Windows installer is **not Authenticode-signed** in this release either,
|
|
19
|
+
for the same reason as 4.0.0 (the public certificate waits on the company's
|
|
20
|
+
registration): Windows shows *"Windows protected your PC"*, *More info → Run
|
|
21
|
+
anyway*, and `ssh-manager app` checks the installer against the SHA-256 in
|
|
22
|
+
`release-manifest-win32.json`. macOS builds are signed and notarized.
|
|
23
|
+
|
|
24
|
+
### The application shows its updates
|
|
25
|
+
|
|
26
|
+
- **Options → Updates** (desktop application only): the version running and its
|
|
27
|
+
channel (a preview build is offered newer previews and the stable release), the
|
|
28
|
+
version on offer, *Check now*, *Download*, download progress, *Restart to
|
|
29
|
+
update*, the time of the last check, a link to the release notes, and the reason
|
|
30
|
+
when a check fails. If commands are waiting for your decision when you restart,
|
|
31
|
+
it says they will be refused.
|
|
32
|
+
- **The sidebar says so too**: an *Update available* (or *Restart to update*)
|
|
33
|
+
mark above Options, and a dot on the Options icon when the rail is collapsed.
|
|
34
|
+
A native notification is posted once per version, not at every launch.
|
|
35
|
+
- *Help → Check for Updates…*, and the menu-bar entry, are kept; the window and
|
|
36
|
+
the menu show the same state.
|
|
37
|
+
- A browser tab (`ssh-manager control`) and the npm engine see none of it: the
|
|
38
|
+
endpoints do not exist there, and nothing about updates is drawn.
|
|
39
|
+
|
|
40
|
+
### Fixes
|
|
41
|
+
|
|
42
|
+
- **Servers**: the grid/list switch sits beside the search field instead of
|
|
43
|
+
wrapping onto a line of its own below the group filters, which left a band of
|
|
44
|
+
empty space when there were many groups.
|
|
45
|
+
- The primary button's hover state no longer drops white-on-orange text below
|
|
46
|
+
the 4.5:1 AA contrast (it now moves toward the page's text colour).
|
|
47
|
+
|
|
48
|
+
### Easier to find
|
|
49
|
+
|
|
50
|
+
- The npm description and keywords, the MCP registry description and the GitHub
|
|
51
|
+
About box say what V4 is now (SSH for AI agents, with approval, a vault and an
|
|
52
|
+
audit trail) instead of the v3 pitch; the repository topics lose the ones that
|
|
53
|
+
had nothing to do with this project.
|
|
54
|
+
- The README opens by saying it is an MCP server for SSH and ends with the
|
|
55
|
+
questions people ask (is it safe, which clients, do I need Node, how is it
|
|
56
|
+
different).
|
|
57
|
+
- A code of conduct, issue forms and a pull request template (the project
|
|
58
|
+
already pointed to a code of conduct that did not exist).
|
|
59
|
+
|
|
60
|
+
### The interface is built when the package is made, not committed
|
|
61
|
+
|
|
62
|
+
`dist/ui` (the bundled control plane interface) is no longer in git. `prepack`
|
|
63
|
+
builds it into the npm package and the desktop app builds it when it is
|
|
64
|
+
assembled, so what users install is the same: the package and the app carry the
|
|
65
|
+
built interface and nothing compiles on their machine. In a source checkout, run
|
|
66
|
+
`npm run build:ui` once before `ssh-manager control`. CI builds it on three
|
|
67
|
+
systems and fails if anything generated is tracked; `release.yml` refuses a
|
|
68
|
+
tarball that does not carry it.
|
|
69
|
+
|
|
8
70
|
## [4.0.0] - 2026-10-25
|
|
9
71
|
|
|
10
72
|
**V4 is stable, on npm and as a desktop application** — [release](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.0).
|
package/CLAUDE.md
CHANGED
|
@@ -73,6 +73,8 @@ npm ci # Install the exact tree from pack
|
|
|
73
73
|
npm start # Start MCP server (requires stdin)
|
|
74
74
|
npm test # Run the full test suite
|
|
75
75
|
npm run typecheck # Type-check JSDoc with tsc (no build, nothing emitted)
|
|
76
|
+
npm run build:ui # Build the interface (ui/) into dist/ui: generated, git-ignored, run by `prepack`;
|
|
77
|
+
# needed before `ssh-manager control` from a checkout and before the browser tests
|
|
76
78
|
npm run test:all # Tests + typecheck + validation
|
|
77
79
|
./scripts/validate.sh # Run all validation checks
|
|
78
80
|
node --check src/index.js # Check JavaScript syntax
|
|
@@ -81,6 +83,8 @@ python -m py_compile tools/*.py # Check Python syntax
|
|
|
81
83
|
|
|
82
84
|
**Typecheck**: `tsconfig.json` runs TypeScript in `checkJs`/`noEmit` mode over the plain JS —
|
|
83
85
|
this project ships JavaScript straight from `src/` with no build step, and that must stay true.
|
|
86
|
+
The interface is the one generated thing: `dist/ui` is built from `ui/` when the package is packed and when the desktop
|
|
87
|
+
app is assembled, never committed (`scripts/build-interface.mjs`; CI fails if `dist/` is tracked).
|
|
84
88
|
The baseline is 0 errors and CI enforces it, so add JSDoc annotations (or a narrow
|
|
85
89
|
`/** @type {...} */` cast) rather than leaving new errors. `typescript` is pinned to `^6`
|
|
86
90
|
because knip 5 declares `peer typescript ">=5.0.4 <7"` — bumping one requires bumping the other.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
This project is for people who run commands on real servers and want to do it
|
|
4
|
+
safely. Taking part in it, in issues, discussions and pull requests, means:
|
|
5
|
+
|
|
6
|
+
- **Be kind and assume good faith.** Disagree with the code, the design or the
|
|
7
|
+
decision, never with the person.
|
|
8
|
+
- **Stay on topic and be concrete.** A reproducible report and a clear request
|
|
9
|
+
help everyone; so does saying what you tried.
|
|
10
|
+
- **No harassment, discrimination, personal attacks or unwelcome advances**, and
|
|
11
|
+
no publishing other people's private information.
|
|
12
|
+
- **Keep secrets out of public places.** Never paste passwords, keys or tokens,
|
|
13
|
+
and do not post the details of a vulnerability in a public issue: use the
|
|
14
|
+
private channel described in [SECURITY.md](SECURITY.md).
|
|
15
|
+
|
|
16
|
+
The maintainer may edit or remove comments, lock threads and block people who do
|
|
17
|
+
not follow this. To report a problem with someone's behaviour, write to the
|
|
18
|
+
contacts listed in [SECURITY.md](SECURITY.md); reports are treated privately.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -70,6 +70,10 @@ Enhancement suggestions are tracked as GitHub issues. When creating an enhanceme
|
|
|
70
70
|
|
|
71
71
|
4. Make your changes and test them
|
|
72
72
|
|
|
73
|
+
The interface (`ui/`) is built, not committed: `npm run build:ui` builds it
|
|
74
|
+
into the git-ignored `dist/ui`, which `ssh-manager control` serves from a
|
|
75
|
+
checkout. Changing `ui/` needs no build artifact in your pull request.
|
|
76
|
+
|
|
73
77
|
5. Commit your changes:
|
|
74
78
|
```bash
|
|
75
79
|
git add .
|
|
@@ -116,6 +120,32 @@ Before submitting a pull request:
|
|
|
116
120
|
CI installs with `npm ci` on Node 18, 20 and 22, and the `lint` job runs
|
|
117
121
|
ESLint and the JSDoc typecheck as blocking gates.
|
|
118
122
|
|
|
123
|
+
### Tests come with the change
|
|
124
|
+
|
|
125
|
+
New functionality and every bug fix arrive with automated tests, in the same
|
|
126
|
+
pull request: a test that fails without the change and passes with it. This is
|
|
127
|
+
the project's policy for any major new functionality, and reviewers ask for the
|
|
128
|
+
test before the code. Where the test is:
|
|
129
|
+
|
|
130
|
+
- `tests/test-*.js` for the engine (run by `npm test`; each file is also a
|
|
131
|
+
script of its own, `npm run test:<name>`),
|
|
132
|
+
- `ui/tests/*.spec.ts` for the interface (Playwright, `npm --prefix ui run
|
|
133
|
+
test:e2e`),
|
|
134
|
+
- `tests/test-shell-quote-properties.js` shows the property-based style
|
|
135
|
+
(`fast-check`) used where a bug class matters more than one example: anything
|
|
136
|
+
that builds a command for a remote shell must go through `shellQuote()` and be
|
|
137
|
+
covered by it.
|
|
138
|
+
|
|
139
|
+
Security fixes also add the exact input that broke the code as a regression
|
|
140
|
+
test (see `tests/test-backup-monitor-injection.js` for the pattern).
|
|
141
|
+
|
|
142
|
+
### Static analysis and warnings
|
|
143
|
+
|
|
144
|
+
ESLint, the JSDoc typecheck (`npm run typecheck`, zero errors) and CodeQL run on
|
|
145
|
+
every push and pull request, and OpenSSF Scorecard runs on `main`. Findings are
|
|
146
|
+
fixed rather than ignored; an alert that is a false positive is dismissed on
|
|
147
|
+
GitHub with a written reason.
|
|
148
|
+
|
|
119
149
|
## Documentation
|
|
120
150
|
|
|
121
151
|
- Update README.md if you change functionality
|
package/Formula/ssh-manager.rb
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
class SshManager < Formula
|
|
14
14
|
desc "SSH server management for AI agents, with approval and audit"
|
|
15
15
|
homepage "https://github.com/bvisible/mcp-ssh-manager"
|
|
16
|
-
url "https://registry.npmjs.org/mcp-ssh-manager/-/mcp-ssh-manager-
|
|
17
|
-
sha256 "
|
|
16
|
+
url "https://registry.npmjs.org/mcp-ssh-manager/-/mcp-ssh-manager-4.0.0.tgz"
|
|
17
|
+
sha256 "b898a742f36b713f829f62d519418ae77b3e7251142426122141d92f5fb273a0"
|
|
18
18
|
license "MIT"
|
|
19
19
|
|
|
20
20
|
depends_on "node"
|
package/README.md
CHANGED
|
@@ -12,19 +12,21 @@
|
|
|
12
12
|
<h1 align="center">You give your agents a shell,<br>and you see what they do with it.</h1>
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
|
-
Let <b>Claude Code</b> and <b>OpenAI Codex</b>
|
|
16
|
-
|
|
15
|
+
<b>An MCP server for SSH.</b> Let <b>Claude Code</b>, <b>Claude Desktop</b> and <b>OpenAI Codex</b> (or any MCP client)<br>
|
|
16
|
+
work on your real servers — run commands, move files, query databases, take backups, check health —<br>
|
|
17
|
+
and watch over their shoulder while they do it.
|
|
17
18
|
</p>
|
|
18
19
|
|
|
19
20
|
<div align="center">
|
|
20
21
|
|
|
21
22
|
[](https://www.npmjs.com/package/mcp-ssh-manager)
|
|
22
23
|
[](https://www.npmjs.com/package/mcp-ssh-manager)
|
|
23
|
-
[](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.1)
|
|
24
25
|
[](https://claude.ai/code)
|
|
25
26
|
[](https://openai.com/codex)
|
|
26
27
|
[](https://modelcontextprotocol.io)
|
|
27
28
|
[](https://scorecard.dev/viewer/?uri=github.com/bvisible/mcp-ssh-manager)
|
|
29
|
+
[](https://www.bestpractices.dev/projects/15950)
|
|
28
30
|
[](LICENSE)
|
|
29
31
|
|
|
30
32
|
</div>
|
|
@@ -52,17 +54,17 @@ An MCP SSH server is the most dangerous tool you can hand an agent: a shell on m
|
|
|
52
54
|
|
|
53
55
|
## Choose your workspace
|
|
54
56
|
|
|
55
|
-
**Desktop application (`4.0.
|
|
57
|
+
**Desktop application (`4.0.1`):** one installation with its own runtime,
|
|
56
58
|
terminal, file browser and server settings. No separate Node.js or npm
|
|
57
|
-
installation. [Download it](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.
|
|
59
|
+
installation. [Download it](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.1):
|
|
58
60
|
|
|
59
61
|
| Platform | File | Signature |
|
|
60
62
|
|---|---|---|
|
|
61
63
|
| macOS, Apple silicon / Intel | `…-arm64.dmg` / `…-x64.dmg` | **Signed and notarized by Apple** — opens normally |
|
|
62
|
-
| Windows x64 / arm64 | `…-setup.exe` | **Not code-signed in 4.0.
|
|
64
|
+
| Windows x64 / arm64 | `…-setup.exe` | **Not code-signed in 4.0.x.** Windows shows *"Windows protected your PC"*: *More info → Run anyway*. Check the file against the SHA-256 in `release-manifest-win32.json` on the release (`ssh-manager app` does it for you). Signing comes in a later release. |
|
|
63
65
|
| Linux x64 | `.deb`, `.AppImage` | Unsigned, as Linux packages usually are |
|
|
64
66
|
|
|
65
|
-
**Already using npm / the CLI?** `npm update -g mcp-ssh-manager` brings 4.0.
|
|
67
|
+
**Already using npm / the CLI?** `npm update -g mcp-ssh-manager` brings 4.0.1,
|
|
66
68
|
and the V4 engine runs without an interface, from your existing `.env`, TOML or
|
|
67
69
|
process variables — no automatic import, no forced wizard, no approval prompt
|
|
68
70
|
unless you enable one per server. The one behaviour that tightens is **SSH
|
|
@@ -88,7 +90,10 @@ variables, and takes effect when the tool next starts; switching back is the
|
|
|
88
90
|
same click.
|
|
89
91
|
|
|
90
92
|
**Updates.** The application checks for a new version at launch and every six
|
|
91
|
-
hours
|
|
93
|
+
hours and says so where you will see it: a mark on the sidebar, *Options →
|
|
94
|
+
Updates* (the running version, the one on offer, a *Check now* button, release
|
|
95
|
+
notes) and, once per version, a notification. Downloading is a click, and
|
|
96
|
+
installing is a second one (*Restart to update*) or happens when you quit. The
|
|
92
97
|
npm engine updates with npm, on its own schedule. A change to the interface
|
|
93
98
|
reaches npm users with the next npm release and application users with the next
|
|
94
99
|
application release.
|
|
@@ -140,6 +145,10 @@ cd cli && ./install.sh
|
|
|
140
145
|
claude mcp add ssh-manager node /absolute/path/to/mcp-ssh-manager/src/index.js
|
|
141
146
|
```
|
|
142
147
|
|
|
148
|
+
The MCP engine needs no build. To use the interface (`ssh-manager control`) from a
|
|
149
|
+
checkout, build it once: `npm run build:ui` (the published package and the desktop
|
|
150
|
+
app already carry it).
|
|
151
|
+
|
|
143
152
|
**Scopes** — `--scope project` writes an `.mcp.json` your team can commit; `--scope user` enables it everywhere for you.
|
|
144
153
|
|
|
145
154
|
**Prerequisites** — Node 18+, on Linux, macOS or Windows. `rsync` for `ssh_sync`, `sshpass` only if you sync with password auth (`brew install hudochenkov/sshpass/sshpass`, or `apt-get install sshpass`).
|
|
@@ -317,6 +326,35 @@ AES-256-GCM, master key in your OS keychain (a `0600` file where there is none
|
|
|
317
326
|
|
|
318
327
|
---
|
|
319
328
|
|
|
329
|
+
## Questions people ask
|
|
330
|
+
|
|
331
|
+
**Can I let an AI agent SSH into my servers safely?**
|
|
332
|
+
Yes, if you decide how far it can go. Per server you can make it read-only, allow only commands that match a pattern, or hold every request (or only the destructive ones) until you approve it in the control plane; credentials can live in an encrypted vault instead of a clear-text `.env`; and every command and decision is logged. See [Safe by default](#safe-by-default).
|
|
333
|
+
|
|
334
|
+
**How do I use Claude Code or Codex with SSH?**
|
|
335
|
+
`npm install -g mcp-ssh-manager`, add a server with `ssh-manager server add`, then `claude mcp add ssh-manager mcp-ssh-manager`. Codex is [set up here](#up-and-running-with-npm). Then ask in plain words: *"why is production slow?"*, *"tail the nginx error log on staging"*.
|
|
336
|
+
|
|
337
|
+
**Does it work with Cursor, Windsurf, Cline or another MCP client?**
|
|
338
|
+
It is a standard stdio MCP server, so any MCP client can run it. Claude Code, Claude Desktop and Codex are the clients documented and tested here. For another one, add what it expects, for example:
|
|
339
|
+
|
|
340
|
+
```json
|
|
341
|
+
{ "mcpServers": { "ssh-manager": { "command": "npx", "args": ["-y", "mcp-ssh-manager"] } } }
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**Do I need Node.js?**
|
|
345
|
+
With npm, yes (Node 18 or later). The desktop application carries its own runtime and engine: install it and connect your AI tools from *Options → AI tools*, with no Node and no npm.
|
|
346
|
+
|
|
347
|
+
**How is this different from other SSH MCP servers?**
|
|
348
|
+
Most hand the agent a shell. This one lets you choose per server how far it goes, can hold requests until you approve them, keeps an audit trail, and has a desktop app and a browser interface to see it all. It also runs without any of that, as a plain engine configured from a `.env` or a TOML file, if that is what you want.
|
|
349
|
+
|
|
350
|
+
**Where are my passwords and keys kept?**
|
|
351
|
+
Key files stay where they are. Saved passwords and passphrases can go into the encrypted vault (AES-256-GCM, with the key in your operating system's keychain) rather than a `.env`.
|
|
352
|
+
|
|
353
|
+
**Is it free?**
|
|
354
|
+
Yes, it is MIT-licensed. The source is here, the package is on [npm](https://www.npmjs.com/package/mcp-ssh-manager) and the desktop apps are on the [releases page](https://github.com/bvisible/mcp-ssh-manager/releases).
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
320
358
|
## Reference
|
|
321
359
|
|
|
322
360
|
<details>
|
|
@@ -647,6 +685,8 @@ The hero animation ships twice, light and dark, swapped by `<picture>` on `prefe
|
|
|
647
685
|
|
|
648
686
|
## What's new
|
|
649
687
|
|
|
688
|
+
**[4.0.1](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.1) — the application tells you about updates.** *Options → Updates*, a mark on the sidebar and a notification once per version, so a new release no longer goes unnoticed in a menu you never open; a tidier Servers toolbar; the interface is built when the package is made rather than committed (what you install is byte for byte the same); and the npm, registry and GitHub descriptions say what V4 is. No change to the engine's behaviour.
|
|
689
|
+
|
|
650
690
|
**[4.0.0](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.0.0) — the control plane.** See what an agent is running on your servers, with its output, and stop it before it runs. A desktop application for macOS, Windows and Linux, installed from the engine with `ssh-manager app`; an encrypted vault for credentials; human approval per server; a shell on your own machine alongside the remote ones. Everything new is opt-in — an npm install upgraded from 3.8.x keeps behaving as 3.8.x, which [a test installs from the registry and proves](docs/TESTING-V4.md). The Windows application is not code-signed in this release. [What changes and how to go back](docs/MIGRATION.md).
|
|
651
691
|
|
|
652
692
|
**v3.8.7 — a security release; upgrade.** Two advisories fixed: a partial server name or an alias escaped `readonly` and `restricted` mode ([GHSA-mq9f-5385-rjf4](https://github.com/bvisible/mcp-ssh-manager/security/advisories/GHSA-mq9f-5385-rjf4)), and `ssh_backup_restore`'s `backupId` ran commands on the server ([GHSA-2wjh-xm9c-7qf9](https://github.com/bvisible/mcp-ssh-manager/security/advisories/GHSA-2wjh-xm9c-7qf9)). See the [CHANGELOG](CHANGELOG.md#387---2026-10-25).
|
package/desktop/electron/main.js
CHANGED
|
@@ -168,8 +168,46 @@ let tray = null;
|
|
|
168
168
|
let trayState = '';
|
|
169
169
|
/** Requests already announced, so a queue that stays full is not announced twice. */
|
|
170
170
|
const announced = new Set();
|
|
171
|
-
/**
|
|
172
|
-
|
|
171
|
+
/**
|
|
172
|
+
* What the updater is doing. Shown in the menu bar, and handed to the control
|
|
173
|
+
* plane so the window can show it too (Options → Updates, the sidebar), because
|
|
174
|
+
* an update that is only visible in a menu most people never open is not an
|
|
175
|
+
* update anyone ever installs.
|
|
176
|
+
* @type {{status: 'idle'|'checking'|'available'|'downloading'|'ready'|'error', version: string|null, percent: number, checkedAt: string|null, error: string|null}}
|
|
177
|
+
*/
|
|
178
|
+
let update = { status: 'idle', version: null, percent: 0, checkedAt: null, error: null };
|
|
179
|
+
/** Whether the updater was started: a packaged build, and not a candidate preview. */
|
|
180
|
+
let updaterActive = false;
|
|
181
|
+
/** Who is told when `update` changes: the control plane, which tells the window. */
|
|
182
|
+
const updateListeners = new Set();
|
|
183
|
+
|
|
184
|
+
function updateSnapshot() {
|
|
185
|
+
return {
|
|
186
|
+
currentVersion: app.getVersion(),
|
|
187
|
+
status: update.status,
|
|
188
|
+
...(update.version ? { version: update.version } : {}),
|
|
189
|
+
...(update.status === 'downloading' || update.status === 'ready' ? { percent: update.percent } : {}),
|
|
190
|
+
...(update.checkedAt ? { checkedAt: update.checkedAt } : {}),
|
|
191
|
+
...(update.error ? { error: update.error } : {}),
|
|
192
|
+
// A preview build is offered newer previews as well as the stable release.
|
|
193
|
+
channel: app.getVersion().includes('-') ? 'preview' : 'stable',
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** What the control plane offers the window: see AppUpdates in control-plane.js. */
|
|
198
|
+
const appUpdates = {
|
|
199
|
+
snapshot: updateSnapshot,
|
|
200
|
+
check: async () => {
|
|
201
|
+
if (!updaterActive) throw new Error('Updates are turned off in this build');
|
|
202
|
+
await electronUpdater.autoUpdater.checkForUpdates();
|
|
203
|
+
},
|
|
204
|
+
download: async () => { await electronUpdater.autoUpdater.downloadUpdate(); },
|
|
205
|
+
install: () => electronUpdater.autoUpdater.quitAndInstall(),
|
|
206
|
+
subscribe: listener => {
|
|
207
|
+
updateListeners.add(listener);
|
|
208
|
+
return () => updateListeners.delete(listener);
|
|
209
|
+
},
|
|
210
|
+
};
|
|
173
211
|
|
|
174
212
|
async function startControlPlane() {
|
|
175
213
|
const root = engineRoot();
|
|
@@ -183,6 +221,9 @@ async function startControlPlane() {
|
|
|
183
221
|
// tree; the control plane resolves it relative to its own file, so nothing
|
|
184
222
|
// extra is needed here.
|
|
185
223
|
agents: ownInstallation(),
|
|
224
|
+
// Only a packaged build has a feed and a version to compare; a checkout run
|
|
225
|
+
// from source has nothing to update.
|
|
226
|
+
appUpdates: app.isPackaged ? appUpdates : null,
|
|
186
227
|
});
|
|
187
228
|
plane.setLocalShellProvider(localShellProvider());
|
|
188
229
|
return plane.start();
|
|
@@ -308,6 +349,10 @@ function buildMenu(url) {
|
|
|
308
349
|
],
|
|
309
350
|
},
|
|
310
351
|
{ role: 'windowMenu' },
|
|
352
|
+
{
|
|
353
|
+
role: 'help',
|
|
354
|
+
submenu: [{ label: 'Check for Updates…', click: () => void appUpdates.check().catch(() => { /* shown in Options → Updates */ }) }],
|
|
355
|
+
},
|
|
311
356
|
]));
|
|
312
357
|
}
|
|
313
358
|
|
|
@@ -490,9 +535,10 @@ function refreshTray() {
|
|
|
490
535
|
* release happened, or restarting under them while a transfer is running, are
|
|
491
536
|
* both worse than being a version behind for an afternoon.
|
|
492
537
|
*
|
|
493
|
-
* So: it checks, and
|
|
494
|
-
*
|
|
495
|
-
*
|
|
538
|
+
* So: it checks, and says so — in the window (Options → Updates, and a mark on
|
|
539
|
+
* the sidebar), in the menu bar, and once per version in a notification.
|
|
540
|
+
* Downloading is a click. Installing happens when the application is closed
|
|
541
|
+
* anyway, or when you choose to restart — never in the middle of something.
|
|
496
542
|
*/
|
|
497
543
|
function setupUpdater() {
|
|
498
544
|
// A candidate preview must keep the artifact the operator chose to test.
|
|
@@ -503,21 +549,32 @@ function setupUpdater() {
|
|
|
503
549
|
autoUpdater.autoDownload = false;
|
|
504
550
|
autoUpdater.autoInstallOnAppQuit = true;
|
|
505
551
|
autoUpdater.logger = null;
|
|
552
|
+
updaterActive = true;
|
|
506
553
|
|
|
507
554
|
const move = (status, extra = {}) => {
|
|
508
555
|
update = { ...update, status, ...extra };
|
|
509
556
|
trayState = ''; // force the menu to rebuild
|
|
510
557
|
refreshTray();
|
|
558
|
+
const snapshot = updateSnapshot();
|
|
559
|
+
for (const listener of updateListeners) listener(snapshot);
|
|
511
560
|
};
|
|
561
|
+
const now = () => new Date().toISOString();
|
|
512
562
|
|
|
513
|
-
autoUpdater.on('update
|
|
514
|
-
autoUpdater.on('update-
|
|
563
|
+
autoUpdater.on('checking-for-update', () => move('checking', { error: null }));
|
|
564
|
+
autoUpdater.on('update-available', info => {
|
|
565
|
+
move('available', { version: info.version, percent: 0, checkedAt: now(), error: null });
|
|
566
|
+
announceUpdate(info.version);
|
|
567
|
+
});
|
|
568
|
+
autoUpdater.on('update-not-available', () => move('idle', { version: null, checkedAt: now(), error: null }));
|
|
515
569
|
autoUpdater.on('download-progress', p => move('downloading', { percent: Math.round(p.percent) }));
|
|
516
|
-
autoUpdater.on('update-downloaded', info => move('ready', { version: info.version }));
|
|
517
|
-
autoUpdater.on('error',
|
|
518
|
-
// A failed check is not worth
|
|
519
|
-
//
|
|
520
|
-
|
|
570
|
+
autoUpdater.on('update-downloaded', info => move('ready', { version: info.version, percent: 100 }));
|
|
571
|
+
autoUpdater.on('error', error => {
|
|
572
|
+
// A failed background check is not worth an alert: the network is down, or
|
|
573
|
+
// GitHub is, and it will try again. The reason is kept for Options → Updates,
|
|
574
|
+
// where someone who asked to check can read it. A failed download goes back
|
|
575
|
+
// to "available", so it can be tried again.
|
|
576
|
+
const message = String(error?.message || error).split('\n')[0].slice(0, 200);
|
|
577
|
+
move(update.status === 'downloading' || update.status === 'ready' ? 'available' : 'idle', { checkedAt: now(), error: message });
|
|
521
578
|
});
|
|
522
579
|
|
|
523
580
|
const check = () => autoUpdater.checkForUpdates().catch(() => { /* see above */ });
|
|
@@ -526,10 +583,45 @@ function setupUpdater() {
|
|
|
526
583
|
timer.unref();
|
|
527
584
|
}
|
|
528
585
|
|
|
586
|
+
/**
|
|
587
|
+
* Say, once per version, that an update is on offer.
|
|
588
|
+
*
|
|
589
|
+
* The version is remembered on disk: a notification at every launch for an
|
|
590
|
+
* update somebody has already decided to leave for later is nagging, and
|
|
591
|
+
* the sidebar and the menu bar keep showing it anyway.
|
|
592
|
+
*
|
|
593
|
+
* @param {string} version
|
|
594
|
+
*/
|
|
595
|
+
function announceUpdate(version) {
|
|
596
|
+
const marker = path.join(app.getPath('userData'), 'last-update-notice');
|
|
597
|
+
try {
|
|
598
|
+
if (fs.readFileSync(marker, 'utf8').trim() === version) return;
|
|
599
|
+
} catch { /* nothing recorded yet */ }
|
|
600
|
+
try { fs.writeFileSync(marker, `${version}\n`); } catch { /* it will say it again next time; harmless */ }
|
|
601
|
+
if (!Notification.isSupported()) return;
|
|
602
|
+
const notification = new Notification({
|
|
603
|
+
title: `SSH Manager ${version} is available`,
|
|
604
|
+
body: 'Open Options → Updates to download it. Nothing is installed until you restart.',
|
|
605
|
+
silent: true,
|
|
606
|
+
});
|
|
607
|
+
notification.on('click', () => {
|
|
608
|
+
if (mainWindow) {
|
|
609
|
+
if (mainWindow.isMinimized()) mainWindow.restore();
|
|
610
|
+
mainWindow.show();
|
|
611
|
+
mainWindow.focus();
|
|
612
|
+
} else if (plane) {
|
|
613
|
+
createWindow(plane.url);
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
notification.show();
|
|
617
|
+
}
|
|
618
|
+
|
|
529
619
|
/** The menu-bar entry for whatever the updater is up to, or nothing. */
|
|
530
620
|
function updateMenuItems() {
|
|
531
621
|
const { autoUpdater } = electronUpdater;
|
|
532
622
|
switch (update.status) {
|
|
623
|
+
case 'checking':
|
|
624
|
+
return [{ label: 'Checking for updates…', enabled: false }, { type: 'separator' }];
|
|
533
625
|
case 'available':
|
|
534
626
|
return [{
|
|
535
627
|
label: `Update to ${update.version}`,
|
|
@@ -544,7 +636,10 @@ function updateMenuItems() {
|
|
|
544
636
|
click: () => autoUpdater.quitAndInstall(),
|
|
545
637
|
}, { type: 'separator' }];
|
|
546
638
|
default:
|
|
547
|
-
return
|
|
639
|
+
return updaterActive
|
|
640
|
+
? [{ label: 'Check for Updates…', click: () => void appUpdates.check().catch(() => { /* shown in Options → Updates */ }) },
|
|
641
|
+
{ type: 'separator' }]
|
|
642
|
+
: [];
|
|
548
643
|
}
|
|
549
644
|
}
|
|
550
645
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssh-manager-desktop",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "ssh-manager-desktop",
|
|
9
|
-
"version": "4.0.
|
|
9
|
+
"version": "4.0.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"electron-updater": "^6.8.9",
|
|
@@ -21,11 +21,13 @@ const out = path.join(here, 'engine');
|
|
|
21
21
|
fs.rmSync(out, { recursive: true, force: true });
|
|
22
22
|
fs.mkdirSync(out, { recursive: true });
|
|
23
23
|
|
|
24
|
-
// The interface
|
|
25
|
-
//
|
|
24
|
+
// The interface is generated, not committed: build it here, from the sources,
|
|
25
|
+
// so the app can never carry a stale or missing one. Without it the app would
|
|
26
|
+
// start and show the "not built" fallback, which is a strange thing to ship.
|
|
27
|
+
execFileSync(process.execPath, [path.join(repo, 'scripts', 'build-interface.mjs')], { cwd: repo, stdio: 'inherit' });
|
|
26
28
|
const ui = path.join(repo, 'dist', 'ui', 'index.html');
|
|
27
29
|
if (!fs.existsSync(ui)) {
|
|
28
|
-
console.error('dist/ui is missing
|
|
30
|
+
console.error('dist/ui is missing after the interface build.');
|
|
29
31
|
process.exit(1);
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -156,6 +156,18 @@ export async function runSmokeTest({ app, BrowserWindow, url, root, localShellPr
|
|
|
156
156
|
assert.equal(agents.engines.app.version, app.getVersion());
|
|
157
157
|
await verifyEngineAnswers(own, { stage });
|
|
158
158
|
}
|
|
159
|
+
// The window's own updates (Options → Updates, the mark on the rail): the
|
|
160
|
+
// packaged application hands the control plane its updater, which reports the
|
|
161
|
+
// version that is running. The updater itself stays off in a smoke test.
|
|
162
|
+
const updates = await fetch(`${base.origin}/api/app-update${base.search}`);
|
|
163
|
+
assert.equal(updates.status, 200, 'the packaged application reports its updates');
|
|
164
|
+
const snapshot = await updates.json();
|
|
165
|
+
assert.equal(snapshot.currentVersion, app.getVersion());
|
|
166
|
+
assert.equal(snapshot.status, 'idle');
|
|
167
|
+
assert.equal(snapshot.channel, app.getVersion().includes('-') ? 'preview' : 'stable');
|
|
168
|
+
// The progress file is written from what the application itself knows, never
|
|
169
|
+
// from what a response said (the check above is what proves they agree).
|
|
170
|
+
stage(`application updates reported (running ${app.getVersion()})`);
|
|
159
171
|
const groups = await import(pathToFileURL(path.join(root, 'src/server-groups.js')).href);
|
|
160
172
|
groups.createGroup('release_smoke', ['fixture']);
|
|
161
173
|
assert.equal(fs.existsSync(path.join(root, '.server-groups.json')), false, 'groups must not write inside the application');
|