mcp-ssh-manager 4.2.0 → 4.3.0

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/docs/MIGRATION.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Upgrading from 3.8 to 4.0
2
2
 
3
- **4.0 is released, on npm and as a desktop application**; the latest is 4.2.0 ([release](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.2.0)).
3
+ **4.0 is released, on npm and as a desktop application**; the latest is 4.3.0 ([release](https://github.com/bvisible/mcp-ssh-manager/releases/tag/v4.3.0)).
4
4
  The last 3.8 release is 3.8.7, for anyone who pins the 3.8 line.
5
5
 
6
6
  The upgrade path preserves headless npm/CLI use. The application, vault import
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-ssh-manager",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "mcpName": "io.github.bvisible/mcp-ssh-manager",
5
5
  "description": "MCP server for SSH: let AI agents (Claude Code, Codex, any MCP client) run commands, transfer files and manage servers over SSH, with human approval, an encrypted vault and a live audit trail.",
6
6
  "main": "src/index.js",
@@ -14,7 +14,7 @@
14
14
  "setup": "npm install && pip install -r tools/requirements.txt",
15
15
  "configure": "python tools/server-manager.py",
16
16
  "test-connection": "python tools/test-connection.py",
17
- "test": "npm run test:lockfile && npm run test:sudostdin && npm run test:vault && npm run test:recovery && npm run test:upgrade && npm run test:notify && npm run test:commands && npm run test:commandlog && npm run test:portability && npm run test:approval && npm run test:controlplane && npm run test:terminal && npm run test:files && npm run test:livestream && npm run test:skills && npm run test:redaction && npm run test:profiles && npm run test:aliases && npm run test:hooks && npm run test:tools && npm run test:policy && npm run test:policynames && npm run test:auditsuccess && npm run test:ping && npm run test:config && npm run test:fieldnames && npm run test:groups && npm run test:agentforward && npm run test:agentkey && npm run test:certpath && npm run test:agentannounce && npm run test:autherrors && npm run test:envchoice && npm run test:lifecycle && npm run test:tunnel && npm run test:sync && npm run test:sync-path && npm run test:dbquoting && npm run test:dbinjection && npm run test:quoteprops && npm run test:backupinjection && npm run test:dbrowcount && npm run test:dbclientcmds && npm run test:migration && npm run test:security && npm run test:hostkeys && npm run test:proxy && npm run test:working-directory && npm run test:groups-persistence && npm run test:release && npm run test:cli-experience && npm run test:desktop-install && npm run test:agent-clients && npm run test:appupdate && npm run test:preview && npm run test:desktop-smoke && npm run test:local-shell && npm run test:cli-edit && npm run test:timeoutwrap && npm run test:downloadstats && npm run test:remotetunnel && npm run test:connsharing && npm run test:auditcoverage && npm run test:background && npm run test:quietstderr && npm run test:sshguard && npm run test:locale && npm run test:healthdisks && npm run test:backupintegrity && npm run test:clienvlines && npm run test:clicodex",
17
+ "test": "npm run test:lockfile && npm run test:sudostdin && npm run test:vault && npm run test:recovery && npm run test:upgrade && npm run test:notify && npm run test:commands && npm run test:commandlog && npm run test:portability && npm run test:approval && npm run test:controlplane && npm run test:terminal && npm run test:files && npm run test:livestream && npm run test:skills && npm run test:redaction && npm run test:profiles && npm run test:aliases && npm run test:hooks && npm run test:tools && npm run test:policy && npm run test:policynames && npm run test:auditsuccess && npm run test:ping && npm run test:config && npm run test:fieldnames && npm run test:groups && npm run test:agentforward && npm run test:agentkey && npm run test:certpath && npm run test:agentannounce && npm run test:autherrors && npm run test:envchoice && npm run test:lifecycle && npm run test:tunnel && npm run test:sync && npm run test:sync-path && npm run test:dbquoting && npm run test:dbinjection && npm run test:quoteprops && npm run test:backupinjection && npm run test:dbrowcount && npm run test:dbclientcmds && npm run test:migration && npm run test:security && npm run test:hostkeys && npm run test:proxy && npm run test:working-directory && npm run test:groups-persistence && npm run test:release && npm run test:cli-experience && npm run test:desktop-install && npm run test:agent-clients && npm run test:appupdate && npm run test:preview && npm run test:desktop-smoke && npm run test:local-shell && npm run test:cli-edit && npm run test:timeoutwrap && npm run test:downloadstats && npm run test:remotetunnel && npm run test:connsharing && npm run test:auditcoverage && npm run test:background && npm run test:quietstderr && npm run test:sshguard && npm run test:locale && npm run test:langtool && npm run test:healthdisks && npm run test:backupintegrity && npm run test:clienvlines && npm run test:clicodex",
18
18
  "test:lockfile": "node tests/test-lockfile.js",
19
19
  "test:sudostdin": "node tests/test-sudo-stdin.js",
20
20
  "test:vault": "node tests/test-secret-store.js",
@@ -92,6 +92,8 @@
92
92
  "test:local-shell": "node tests/test-local-shell.js",
93
93
  "test:policynames": "node tests/test-policy-name-resolution.js",
94
94
  "test:locale": "node tests/test-locale.js",
95
+ "test:langtool": "node tests/test-language-tool.js",
96
+ "lang": "node scripts/language.mjs",
95
97
  "test:healthdisks": "node tests/test-health-disks.js",
96
98
  "test:backupintegrity": "node tests/test-backup-integrity.js",
97
99
  "test:clienvlines": "node tests/test-cli-env-lines.js",
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env node
2
+ // Languages of the interface and of the desktop application.
3
+ //
4
+ // npm run lang -- add <code> [--name "Français"] [--label "Langue"]
5
+ // Creates the three catalogues of a new language from the English text and,
6
+ // when the Windows installer has a page for it, lists that page too.
7
+ // npm run lang -- status
8
+ // Shows, per language, how many entries are still the English text.
9
+ //
10
+ // A language is three files, and nothing else names it: the interface and the desktop
11
+ // application find them by their names (ui/README.md, "Adding a language").
12
+ // ui/src/locales/<code>.json labels of the carried-over components, plus language.name / language.label
13
+ // ui/src/locales/messages.<code>.json the interface's sentences (keys are the English sentences)
14
+ // desktop/electron/native.<code>.json menus, tray and notifications of the desktop application
15
+ import fs from 'node:fs';
16
+ import path from 'node:path';
17
+ import { fileURLToPath } from 'node:url';
18
+
19
+ const repository = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
20
+
21
+ /**
22
+ * The page of the Windows installer for a language, by the code the installer's
23
+ * builder uses. A language that is not here still gets its catalogues; it only has no
24
+ * page of its own in the installer, which then shows its own languages' pages.
25
+ */
26
+ const INSTALLER_LOCALES = {
27
+ cs: 'cs_CZ', da: 'da_DK', de: 'de_DE', el: 'el_GR', es: 'es_ES', fi: 'fi_FI',fr: 'fr_FR', hu: 'hu_HU',
28
+ it: 'it_IT', ja: 'ja_JP', ko: 'ko_KR', nb: 'nb_NO', nl: 'nl_NL', pl: 'pl_PL', 'pt-BR': 'pt_BR', pt: 'pt_PT',
29
+ ro: 'ro_RO', ru: 'ru_RU', sv: 'sv_SE', tr: 'tr_TR', uk: 'uk_UA', vi: 'vi_VN', 'zh-CN': 'zh_CN', 'zh-TW': 'zh_TW',
30
+ };
31
+
32
+ /** The installer page code for a language code, or undefined when none is known. */
33
+ export function installerLocaleFor(code) {
34
+ return INSTALLER_LOCALES[code] ?? INSTALLER_LOCALES[code.split('-')[0]];
35
+ }
36
+
37
+ /** Language, optional script, optional region: `fr`, `pt-BR`, `zh-Hant-TW`, `es-419`. */
38
+ const CODE = /^[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}|[0-9]{3}))?$/;
39
+
40
+ const files = root => ({
41
+ locales: path.join(root, 'ui', 'src', 'locales'),
42
+ electron: path.join(root, 'desktop', 'electron'),
43
+ builder: path.join(root, 'desktop', 'electron', 'electron-builder.yml'),
44
+ });
45
+
46
+ /** Codes found in a folder from file names like `<prefix><code>.json`. */
47
+ function discover(folder, prefix) {
48
+ const pattern = new RegExp(`^${prefix}([A-Za-z0-9-]+)\\.json$`);
49
+ return fs.readdirSync(folder).map(name => pattern.exec(name)?.[1]).filter(Boolean).sort();
50
+ }
51
+
52
+ const readJson = file => JSON.parse(fs.readFileSync(file, 'utf8'));
53
+ /** `flag: 'wx'` creates the file and fails if it exists, in one step. */
54
+ const writeJson = (file, data, flag = 'w') => fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n', { flag });
55
+ /** The file's text, or undefined when it is not there: one read, so nothing can change between a check and the use. */
56
+ function readIfPresent(file) {
57
+ try { return fs.readFileSync(file, 'utf8'); } catch (error) { if (error.code === 'ENOENT') return undefined; throw error; }
58
+ }
59
+ const flatten = (object, prefix = '') => Object.entries(object)
60
+ .flatMap(([key, value]) => (value && typeof value === 'object' ? flatten(value, `${prefix}${key}.`) : [[`${prefix}${key}`, value]]));
61
+
62
+ /** The language written in itself ("fr" → "Français"), or the code when the platform has no name for it. */
63
+ function ownName(code) {
64
+ try {
65
+ const name = new Intl.DisplayNames([code], { type: 'language' }).of(code);
66
+ return name && name !== code ? name.charAt(0).toLocaleUpperCase(code) + name.slice(1) : code;
67
+ } catch { return code; }
68
+ }
69
+
70
+ /**
71
+ * Create the three catalogues of a new language, every value being the English text to
72
+ * translate. Returns what was written. Refuses a bad code, English, and a language that exists.
73
+ */
74
+ export function addLanguage(root, code, { name, label } = {}) {
75
+ const where = files(root);
76
+ if (code === 'en') throw new Error('English is the source language: it cannot be added');
77
+ const same = discover(where.locales, '').find(known => known.toLowerCase() === code.toLowerCase());
78
+ if (same) throw new Error(`the language ${same} already exists`);
79
+ if (!CODE.test(code)) throw new Error(`"${code}" is not a language code like fr, pt-BR or zh-Hant-TW`);
80
+
81
+ const english = readJson(path.join(where.locales, 'en.json'));
82
+ const sentences = readJson(path.join(where.locales, 'messages.en.json'));
83
+ const reference = discover(where.electron, 'native\\.')[0];
84
+ if (!reference) throw new Error('no desktop catalogue to take the menu sentences from');
85
+ const native = Object.fromEntries(Object.keys(readJson(path.join(where.electron, `native.${reference}.json`))).map(key => [key, key]));
86
+
87
+ const written = [
88
+ [path.join(where.locales, `${code}.json`), { ...english, language: { name: name || ownName(code), label: label || english.language?.label || 'Language' } }],
89
+ [path.join(where.locales, `messages.${code}.json`), sentences],
90
+ [path.join(where.electron, `native.${code}.json`), native],
91
+ ];
92
+ for (const [file, content] of written) writeJson(file, content, 'wx');
93
+
94
+ const installer = installerLocaleFor(code);
95
+ let installerAdded = false;
96
+ const text = installer ? readIfPresent(where.builder) : undefined;
97
+ if (text !== undefined) {
98
+ const line = /^(\s*installerLanguages:\s*\[)([^\]]*)(\])/m.exec(text);
99
+ if (line) {
100
+ const pages = line[2].split(',').map(page => page.trim()).filter(Boolean);
101
+ if (!pages.includes(installer)) {
102
+ fs.writeFileSync(where.builder, text.replace(line[0], `${line[1]}${[...pages, installer].join(', ')}${line[3]}`));
103
+ installerAdded = true;
104
+ }
105
+ }
106
+ }
107
+ return { files: written.map(([file]) => path.relative(root, file)), installer: installerAdded ? installer : undefined, installerKnown: Boolean(installer) };
108
+ }
109
+
110
+ /** Per language: entries (of each catalogue) that are still the English text. */
111
+ export function languageStatus(root) {
112
+ const where = files(root);
113
+ const english = Object.fromEntries(flatten(readJson(path.join(where.locales, 'en.json'))));
114
+ const result = [];
115
+ for (const code of discover(where.locales, '').filter(known => known !== 'en')) {
116
+ const labels = readJson(path.join(where.locales, `${code}.json`));
117
+ const labelEntries = flatten(labels).filter(([key]) => !key.startsWith('language.'));
118
+ const sentences = Object.entries(readJson(path.join(where.locales, `messages.${code}.json`)));
119
+ const nativeText = readIfPresent(path.join(where.electron, `native.${code}.json`));
120
+ const menus = nativeText === undefined ? [] : Object.entries(JSON.parse(nativeText));
121
+ result.push({
122
+ code,
123
+ name: labels.language?.name ?? code,
124
+ labels: { same: labelEntries.filter(([key, value]) => value === english[key]).length, total: labelEntries.length },
125
+ sentences: { same: sentences.filter(([key, value]) => value === key).length, total: sentences.length },
126
+ menus: { same: menus.filter(([key, value]) => value === key).length, total: menus.length },
127
+ });
128
+ }
129
+ return result;
130
+ }
131
+
132
+ function printStatus(rows) {
133
+ const cell = ({ same, total }) => `${same} of ${total}`;
134
+ const head = ['language', 'name', 'labels', 'sentences', 'desktop menus'];
135
+ const lines = [head, ...rows.map(row => [row.code, row.name, cell(row.labels), cell(row.sentences), cell(row.menus)])];
136
+ const widths = head.map((_, column) => Math.max(...lines.map(line => [...line[column]].length)));
137
+ console.log('Entries still identical to the English text (a few are right to be: names, "OK"):');
138
+ for (const line of lines) console.log(line.map((text, column) => text + ' '.repeat(widths[column] - [...text].length)).join(' ').trimEnd());
139
+ }
140
+
141
+ function main(argv) {
142
+ const options = {};
143
+ const rest = [];
144
+ for (let i = 0; i < argv.length; i++) {
145
+ if (['--name', '--label', '--root'].includes(argv[i])) options[argv[i].slice(2)] = argv[++i];
146
+ else rest.push(argv[i]);
147
+ }
148
+ const root = options.root ? path.resolve(options.root) : repository;
149
+ const [command, code] = rest;
150
+ try {
151
+ if (command === 'add' && code) {
152
+ const done = addLanguage(root, code, options);
153
+ console.log(`Added ${code}:`);
154
+ for (const file of done.files) console.log(` ${file}`);
155
+ if (done.installer) console.log(` desktop/electron/electron-builder.yml: installer page ${done.installer}`);
156
+ else if (!done.installerKnown) console.log(' (no Windows installer page known for this language: the catalogues work without one)');
157
+ console.log('\nEvery value starts as the English text. Translate the values; keep the keys of');
158
+ console.log('messages.<code>.json and native.<code>.json as they are, and keep every {{placeholder}}.');
159
+ console.log('Then: npm run test:locale, and npm run lang -- status.');
160
+ } else if (command === 'status') {
161
+ printStatus(languageStatus(root));
162
+ } else {
163
+ console.error('usage: npm run lang -- add <code> [--name "Français"] [--label "Langue"]\n npm run lang -- status');
164
+ process.exitCode = 2;
165
+ }
166
+ } catch (error) {
167
+ console.error(`lang: ${error.message}`);
168
+ process.exitCode = 1;
169
+ }
170
+ }
171
+
172
+ if (process.argv[1] && fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) main(process.argv.slice(2));
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/bvisible/mcp-ssh-manager",
7
7
  "source": "github"
8
8
  },
9
- "version": "4.2.0",
9
+ "version": "4.3.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "mcp-ssh-manager",
14
- "version": "4.2.0",
14
+ "version": "4.3.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },
@@ -2325,6 +2325,11 @@ export class ControlPlane {
2325
2325
  localShell: Boolean(this.localShell),
2326
2326
  // Whether /api/desktop exists: true only under `ssh-manager control`.
2327
2327
  offerDesktop: Boolean(this.offerDesktop),
2328
+ // Whether this process can see an SSH agent. A server that names an agent key
2329
+ // (agentPublicKeyPath) needs one; the form says so when there is none. It is
2330
+ // this process's environment, which is the engine's inside the desktop
2331
+ // application and a good hint for an engine started by an AI tool.
2332
+ agentSocket: Boolean(process.env.SSH_AUTH_SOCK),
2328
2333
  });
2329
2334
  }
2330
2335