depsonar 4.0.0 → 4.1.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/README.md +18 -3
- package/bin/supervise.cjs +447 -0
- package/bin/update.json +15 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/services/audit.d.ts +11 -1
- package/dist/services/audit.d.ts.map +1 -1
- package/dist/services/audit.js +64 -41
- package/dist/services/audit.js.map +1 -1
- package/dist/services/formatter.d.ts +2 -0
- package/dist/services/formatter.d.ts.map +1 -1
- package/dist/services/formatter.js +27 -8
- package/dist/services/formatter.js.map +1 -1
- package/dist/services/osv.d.ts +7 -0
- package/dist/services/osv.d.ts.map +1 -1
- package/dist/services/osv.js +109 -55
- package/dist/services/osv.js.map +1 -1
- package/dist/services/project.d.ts +21 -0
- package/dist/services/project.d.ts.map +1 -1
- package/dist/services/project.js +121 -30
- package/dist/services/project.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +51 -45
- package/dist/tools/index.js.map +1 -1
- package/dist/update-notice.d.ts +11 -0
- package/dist/update-notice.d.ts.map +1 -0
- package/dist/update-notice.js +66 -0
- package/dist/update-notice.js.map +1 -0
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<sub>Scan · Audit · Update · Migrate — 9 languages, 23 tools, one MCP server</sub>
|
|
7
7
|
</p>
|
|
8
8
|
<p align="center">
|
|
9
|
+
<img src="https://img.shields.io/npm/v/depsonar?color=60a5fa&label=npm"/>
|
|
9
10
|
<img src="https://img.shields.io/badge/languages-9-34d399"/>
|
|
10
11
|
<img src="https://img.shields.io/badge/tools-23-60a5fa"/>
|
|
11
12
|
<img src="https://img.shields.io/badge/CVE_scanner-live-f59e0b"/>
|
|
@@ -14,6 +15,8 @@
|
|
|
14
15
|
|
|
15
16
|
<p align="center">
|
|
16
17
|
<a href="cursor://anysphere.cursor-deeplink/mcp/install?name=depsonar&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRlcHNvbmFyQGxhdGVzdCJdfQ=="><img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor" /></a>
|
|
18
|
+
|
|
19
|
+
<a href="https://soflutionltd.github.io/BrandCheck/install.html?name=depsonar&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImRlcHNvbmFyQGxhdGVzdCJdfQ=="><img src="https://img.shields.io/badge/Install_via-Web-60a5fa?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjIiPjxwYXRoIGQ9Ik0xMiAyYTEwIDEwIDAgMSAwIDAgMjAgMTAgMTAgMCAwIDAgMC0yMHoiLz48cGF0aCBkPSJNMiAxMmgyMCIvPjxwYXRoIGQ9Ik0xMiAyYTEwIDEwIDAgMCAxIDggOCAxMCAxMCAwIDAgMS04IDgiLz48cGF0aCBkPSJNMTIgMmExMCAxMCAwIDAgMC04IDggMTAgMTAgMCAwIDAgOCA4Ii8+PC9zdmc+" alt="Install via Web" /></a>
|
|
17
20
|
</p>
|
|
18
21
|
|
|
19
22
|
**depsonar** is an MCP server that keeps your projects' dependencies up to date, scans for vulnerabilities, detects framework migrations, and audits your entire dev infrastructure — directly from Cursor, Claude, or any MCP-compatible AI assistant.
|
|
@@ -71,12 +74,18 @@ Add to `~/.cursor/mcp.json`:
|
|
|
71
74
|
"mcpServers": {
|
|
72
75
|
"depsonar": {
|
|
73
76
|
"command": "npx",
|
|
74
|
-
"args": ["-y", "depsonar"]
|
|
77
|
+
"args": ["-y", "depsonar@latest"]
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
```
|
|
79
82
|
|
|
83
|
+
### Automatic updates
|
|
84
|
+
|
|
85
|
+
Every install below keeps itself up to date, without restarting Claude or Cursor. The MCP client talks to a small supervisor (`bin/supervise.cjs`) that stays connected while the server runs behind it. At start-up and every 6 hours it asks npm for the latest `depsonar`, installs it in the background in `~/.soflution/mcp/depsonar/`, and switches over as soon as no request is in flight (the client is told the tool list may have changed). A version that fails to start is rolled back at once and never picked again on that machine. npm checks the integrity of every download, and releases are published from GitHub Actions with provenance.
|
|
86
|
+
|
|
87
|
+
The only network call is that version check to `registry.npmjs.org`; nothing about your machine or your use is sent. Turn it off with `NO_UPDATE_NOTIFIER=1` (or `SOFLUTION_AUTO_UPDATE=0`). Started directly with `node dist/...`, depsonar does not update itself and only mentions a newer version in its first tool result.
|
|
88
|
+
|
|
80
89
|
### Option 2: Global install
|
|
81
90
|
|
|
82
91
|
```bash
|
|
@@ -96,7 +105,7 @@ npm install -g depsonar
|
|
|
96
105
|
### Option 3: Clone
|
|
97
106
|
|
|
98
107
|
```bash
|
|
99
|
-
git clone https://github.com/
|
|
108
|
+
git clone https://github.com/Soflutionltd/depsonar.git
|
|
100
109
|
cd depsonar && npm install && npm run build
|
|
101
110
|
```
|
|
102
111
|
|
|
@@ -105,7 +114,7 @@ cd depsonar && npm install && npm run build
|
|
|
105
114
|
"mcpServers": {
|
|
106
115
|
"depsonar": {
|
|
107
116
|
"command": "node",
|
|
108
|
-
"args": ["/path/to/depsonar/
|
|
117
|
+
"args": ["/path/to/depsonar/bin/supervise.cjs"]
|
|
109
118
|
}
|
|
110
119
|
}
|
|
111
120
|
}
|
|
@@ -242,6 +251,12 @@ depsonar --help # List all 23 tools
|
|
|
242
251
|
|
|
243
252
|
---
|
|
244
253
|
|
|
254
|
+
## Also by Soflution
|
|
255
|
+
|
|
256
|
+
- **[brandcheck](https://github.com/Soflutionltd/BrandCheck)** — Check brand name availability across 27 platforms in one shot. Domains, social media, app stores, trademarks.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
245
260
|
## License
|
|
246
261
|
|
|
247
262
|
MIT — [Soflution Ltd](https://soflution.com)
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
// Soflution MCP supervisor: keeps the server up to date without restarting Claude or Cursor.
|
|
4
|
+
//
|
|
5
|
+
// Same model as McpHub. The MCP client (Claude, Cursor...) talks to this small process, which
|
|
6
|
+
// stays connected; the real server runs behind it as a child process. In the background the
|
|
7
|
+
// supervisor asks npm for the latest version and installs it next to the current one, in
|
|
8
|
+
// ~/.soflution/mcp/<package>/<version> (npm checks the package integrity). As soon as no request
|
|
9
|
+
// is in flight, it starts the new version, replays the MCP handshake to it, switches over and
|
|
10
|
+
// tells the client the tool list may have changed. If the new version fails to start, the
|
|
11
|
+
// current one keeps running and that version is never picked automatically again on this machine.
|
|
12
|
+
//
|
|
13
|
+
// Network: one GET to registry.npmjs.org at start-up and every 6 hours. Nothing else is sent.
|
|
14
|
+
// NO_UPDATE_NOTIFIER=1 or SOFLUTION_AUTO_UPDATE=0: no check, no install, no switch.
|
|
15
|
+
// Modes that are not MCP over stdio (setup, --http, --dashboard...) run the server directly.
|
|
16
|
+
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const os = require('os');
|
|
19
|
+
const path = require('path');
|
|
20
|
+
const { spawn } = require('child_process');
|
|
21
|
+
const { pathToFileURL } = require('url');
|
|
22
|
+
|
|
23
|
+
const ROOT = path.join(__dirname, '..');
|
|
24
|
+
const cfg = JSON.parse(fs.readFileSync(path.join(__dirname, 'update.json'), 'utf8')); // { package, server, passthrough }
|
|
25
|
+
const OWN_VERSION = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')).version;
|
|
26
|
+
const OFF = Boolean(process.env.NO_UPDATE_NOTIFIER) || process.env.SOFLUTION_AUTO_UPDATE === '0' || Boolean(process.env.CI);
|
|
27
|
+
const HOME = path.join(os.homedir(), '.soflution', 'mcp', cfg.package);
|
|
28
|
+
const STATE = path.join(HOME, 'state.json');
|
|
29
|
+
const CHECK_EVERY_MS = 6 * 3600 * 1000;
|
|
30
|
+
const HEALTHY_AFTER_MS = 120 * 1000;
|
|
31
|
+
const MAX_BOOTS = 3;
|
|
32
|
+
const SWAP_ID = '__soflution_swap__';
|
|
33
|
+
|
|
34
|
+
const log = (m) => process.stderr.write(`[${cfg.package} supervisor] ${m}\n`);
|
|
35
|
+
|
|
36
|
+
// ---------- versions and state ----------
|
|
37
|
+
|
|
38
|
+
function parse(v) {
|
|
39
|
+
const m = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(String(v || '').trim());
|
|
40
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
|
|
41
|
+
}
|
|
42
|
+
function isNewer(a, b) {
|
|
43
|
+
const x = parse(a), y = parse(b);
|
|
44
|
+
if (!x || !y) return false;
|
|
45
|
+
for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] > y[i];
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
function readState() {
|
|
49
|
+
try {
|
|
50
|
+
const s = JSON.parse(fs.readFileSync(STATE, 'utf8'));
|
|
51
|
+
return { installed: s.installed || null, rejected: Array.isArray(s.rejected) ? s.rejected : [], boots: s.boots | 0, healthy: !!s.healthy };
|
|
52
|
+
} catch {
|
|
53
|
+
return { installed: null, rejected: [], boots: 0, healthy: false };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function writeState(s) {
|
|
57
|
+
try {
|
|
58
|
+
fs.mkdirSync(HOME, { recursive: true });
|
|
59
|
+
const tmp = `${STATE}.${process.pid}.tmp`;
|
|
60
|
+
fs.writeFileSync(tmp, JSON.stringify(s, null, 2));
|
|
61
|
+
fs.renameSync(tmp, STATE);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
log(`state not saved: ${e.message}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function reject(version) {
|
|
67
|
+
const s = readState();
|
|
68
|
+
if (!s.rejected.includes(version)) s.rejected.push(version);
|
|
69
|
+
if (s.installed && s.installed.version === version) s.installed = null;
|
|
70
|
+
s.boots = 0;
|
|
71
|
+
s.healthy = false;
|
|
72
|
+
writeState(s);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const serverIn = (dir) => path.join(dir, 'node_modules', cfg.package, cfg.server);
|
|
76
|
+
const OWN = { version: OWN_VERSION, entry: path.join(ROOT, cfg.server) };
|
|
77
|
+
|
|
78
|
+
/** The version to start with: an installed update newer than this package, unless it keeps crashing. */
|
|
79
|
+
function pickStart() {
|
|
80
|
+
if (OFF) return OWN;
|
|
81
|
+
const s = readState();
|
|
82
|
+
const inst = s.installed;
|
|
83
|
+
if (!inst || !isNewer(inst.version, OWN_VERSION) || s.rejected.includes(inst.version) || !fs.existsSync(serverIn(inst.dir))) return OWN;
|
|
84
|
+
if (!s.healthy && s.boots >= MAX_BOOTS) {
|
|
85
|
+
log(`${inst.version} failed to start ${s.boots} times, back to ${OWN_VERSION}`);
|
|
86
|
+
reject(inst.version);
|
|
87
|
+
return OWN;
|
|
88
|
+
}
|
|
89
|
+
if (!s.healthy) {
|
|
90
|
+
s.boots += 1;
|
|
91
|
+
writeState(s);
|
|
92
|
+
}
|
|
93
|
+
return { version: inst.version, entry: serverIn(inst.dir) };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ---------- passthrough modes ----------
|
|
97
|
+
|
|
98
|
+
const args = process.argv.slice(2);
|
|
99
|
+
if (args.some((a) => (cfg.passthrough || []).includes(a))) {
|
|
100
|
+
const target = pickStart();
|
|
101
|
+
process.argv[1] = target.entry;
|
|
102
|
+
import(pathToFileURL(target.entry).href).catch((e) => {
|
|
103
|
+
log(e && e.stack ? e.stack : String(e));
|
|
104
|
+
process.exit(1);
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ---------- line framing ----------
|
|
110
|
+
|
|
111
|
+
function lines(stream, onLine) {
|
|
112
|
+
let buf = '';
|
|
113
|
+
stream.setEncoding('utf8');
|
|
114
|
+
stream.on('data', (chunk) => {
|
|
115
|
+
buf += chunk;
|
|
116
|
+
let i;
|
|
117
|
+
while ((i = buf.indexOf('\n')) >= 0) {
|
|
118
|
+
const line = buf.slice(0, i).replace(/\r$/, '');
|
|
119
|
+
buf = buf.slice(i + 1);
|
|
120
|
+
if (line.trim()) onLine(line);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function tryJson(line) {
|
|
125
|
+
try {
|
|
126
|
+
return JSON.parse(line);
|
|
127
|
+
} catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const idKey = (id) => JSON.stringify(id);
|
|
132
|
+
const toClient = (line) => process.stdout.write(line + '\n');
|
|
133
|
+
|
|
134
|
+
// ---------- supervision ----------
|
|
135
|
+
|
|
136
|
+
let current = null; // { child, version, entry, onLine }
|
|
137
|
+
let swapping = false;
|
|
138
|
+
let shuttingDown = false;
|
|
139
|
+
const queue = []; // client lines held during a switch
|
|
140
|
+
const clientPending = new Set(); // requests from the client awaiting the server's answer
|
|
141
|
+
const serverPending = new Map(); // requests from the server awaiting the client's answer, with their time
|
|
142
|
+
let initRequest = null; // the client's initialize request, replayed to a new version
|
|
143
|
+
let initAnswered = false;
|
|
144
|
+
let initializedSeen = false;
|
|
145
|
+
let lastActivity = Date.now();
|
|
146
|
+
|
|
147
|
+
function start(target) {
|
|
148
|
+
const child = spawn(process.execPath, [target.entry, ...args], {
|
|
149
|
+
stdio: ['pipe', 'pipe', 'inherit'],
|
|
150
|
+
env: { ...process.env, SOFLUTION_SUPERVISED: '1' },
|
|
151
|
+
windowsHide: true,
|
|
152
|
+
});
|
|
153
|
+
const proc = { child, version: target.version, entry: target.entry, startedAt: Date.now(), handler: null };
|
|
154
|
+
lines(child.stdout, (line) => proc.handler && proc.handler(line));
|
|
155
|
+
child.stdin.on('error', () => {});
|
|
156
|
+
return proc;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function attach(proc) {
|
|
160
|
+
current = proc;
|
|
161
|
+
proc.handler = (line) => {
|
|
162
|
+
lastActivity = Date.now();
|
|
163
|
+
const msg = tryJson(line);
|
|
164
|
+
if (msg && msg.id !== undefined && msg.method === undefined) {
|
|
165
|
+
clientPending.delete(idKey(msg.id));
|
|
166
|
+
if (initRequest && idKey(msg.id) === idKey(initRequest.id)) initAnswered = true;
|
|
167
|
+
} else if (msg && msg.id !== undefined && msg.method !== undefined) {
|
|
168
|
+
serverPending.set(idKey(msg.id), Date.now());
|
|
169
|
+
}
|
|
170
|
+
toClient(line);
|
|
171
|
+
};
|
|
172
|
+
proc.child.on('exit', (code, signal) => onExit(proc, code, signal));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function onExit(proc, code, signal) {
|
|
176
|
+
if (proc !== current || shuttingDown) return;
|
|
177
|
+
const early = Date.now() - proc.startedAt < 30 * 1000;
|
|
178
|
+
if (early && proc.version !== OWN_VERSION) {
|
|
179
|
+
log(`${proc.version} stopped at start-up (${signal || code}), back to ${OWN_VERSION}`);
|
|
180
|
+
reject(proc.version);
|
|
181
|
+
swapping = true; // hold client messages until the bundled version is up
|
|
182
|
+
clientPending.clear();
|
|
183
|
+
serverPending.clear();
|
|
184
|
+
const next = start(OWN);
|
|
185
|
+
replayInit(next).then(() => {
|
|
186
|
+
attach(next);
|
|
187
|
+
swapping = false;
|
|
188
|
+
flush();
|
|
189
|
+
}).catch((e) => {
|
|
190
|
+
log(`restart failed: ${e.message}`);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
});
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
process.exit(code === null ? 1 : code);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Replays the client's handshake to a freshly started server. */
|
|
199
|
+
function replayInit(proc) {
|
|
200
|
+
return new Promise((resolve, reject) => {
|
|
201
|
+
if (!initRequest) return resolve();
|
|
202
|
+
// If the client is still waiting for its own initialize answer, the new server gives it.
|
|
203
|
+
const ownAnswer = !initAnswered;
|
|
204
|
+
const id = ownAnswer ? initRequest.id : SWAP_ID;
|
|
205
|
+
const timer = setTimeout(() => reject(new Error('no answer to initialize')), 30 * 1000);
|
|
206
|
+
proc.handler = (line) => {
|
|
207
|
+
const msg = tryJson(line);
|
|
208
|
+
if (msg && msg.id !== undefined && idKey(msg.id) === idKey(id) && msg.method === undefined) {
|
|
209
|
+
clearTimeout(timer);
|
|
210
|
+
if (msg.error) return reject(new Error(msg.error.message || 'initialize failed'));
|
|
211
|
+
if (ownAnswer) {
|
|
212
|
+
initAnswered = true;
|
|
213
|
+
clientPending.delete(idKey(initRequest.id));
|
|
214
|
+
toClient(line);
|
|
215
|
+
}
|
|
216
|
+
if (initializedSeen) proc.child.stdin.write(JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }) + '\n');
|
|
217
|
+
return resolve();
|
|
218
|
+
}
|
|
219
|
+
// Anything else before the handshake completes (logs) goes to the client as usual.
|
|
220
|
+
toClient(line);
|
|
221
|
+
};
|
|
222
|
+
proc.child.once('exit', () => {
|
|
223
|
+
clearTimeout(timer);
|
|
224
|
+
reject(new Error('stopped during initialize'));
|
|
225
|
+
});
|
|
226
|
+
proc.child.stdin.write(JSON.stringify({ ...initRequest, id }) + '\n');
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function flush() {
|
|
231
|
+
while (queue.length && !swapping) send(queue.shift());
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function send(line) {
|
|
235
|
+
const msg = tryJson(line);
|
|
236
|
+
if (msg) {
|
|
237
|
+
if (msg.method === 'initialize' && msg.id !== undefined) {
|
|
238
|
+
initRequest = msg;
|
|
239
|
+
initAnswered = false;
|
|
240
|
+
}
|
|
241
|
+
if (msg.method === 'notifications/initialized') initializedSeen = true;
|
|
242
|
+
if (msg.id !== undefined && msg.method !== undefined) clientPending.add(idKey(msg.id));
|
|
243
|
+
if (msg.id !== undefined && msg.method === undefined) serverPending.delete(idKey(msg.id));
|
|
244
|
+
}
|
|
245
|
+
current.child.stdin.write(line + '\n');
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
lines(process.stdin, (line) => {
|
|
249
|
+
lastActivity = Date.now();
|
|
250
|
+
if (swapping) queue.push(line);
|
|
251
|
+
else send(line);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
function shutdown(code) {
|
|
255
|
+
if (shuttingDown) return;
|
|
256
|
+
shuttingDown = true;
|
|
257
|
+
if (current) {
|
|
258
|
+
// Let the server answer what it already received, as when it runs without the supervisor.
|
|
259
|
+
const child = current.child;
|
|
260
|
+
try { child.stdin.end(); } catch {}
|
|
261
|
+
child.once('exit', () => process.exit(code));
|
|
262
|
+
setTimeout(() => child.kill('SIGTERM'), 3000).unref();
|
|
263
|
+
setTimeout(() => process.exit(code), 6000).unref();
|
|
264
|
+
} else {
|
|
265
|
+
process.exit(code);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
process.stdin.on('end', () => shutdown(0));
|
|
269
|
+
process.stdin.on('close', () => shutdown(0));
|
|
270
|
+
process.on('SIGTERM', () => shutdown(0));
|
|
271
|
+
process.on('SIGINT', () => shutdown(0));
|
|
272
|
+
|
|
273
|
+
// ---------- hot switch ----------
|
|
274
|
+
|
|
275
|
+
async function switchTo(target) {
|
|
276
|
+
if (swapping || !current || current.version === target.version) return;
|
|
277
|
+
swapping = true;
|
|
278
|
+
log(`switching from ${current.version} to ${target.version}`);
|
|
279
|
+
const next = start(target);
|
|
280
|
+
try {
|
|
281
|
+
await replayInit(next);
|
|
282
|
+
} catch (e) {
|
|
283
|
+
log(`${target.version} did not start (${e.message}), staying on ${current.version}`);
|
|
284
|
+
reject(target.version);
|
|
285
|
+
next.child.kill('SIGKILL');
|
|
286
|
+
swapping = false;
|
|
287
|
+
flush();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const old = current;
|
|
291
|
+
attach(next);
|
|
292
|
+
swapping = false;
|
|
293
|
+
try { old.child.stdin.end(); } catch {}
|
|
294
|
+
old.child.kill('SIGTERM');
|
|
295
|
+
setTimeout(() => { try { old.child.kill('SIGKILL'); } catch {} }, 5000).unref();
|
|
296
|
+
if (initializedSeen) toClient(JSON.stringify({ jsonrpc: '2.0', method: 'notifications/tools/list_changed' }));
|
|
297
|
+
flush();
|
|
298
|
+
setTimeout(() => {
|
|
299
|
+
const s = readState();
|
|
300
|
+
if (s.installed && s.installed.version === target.version) {
|
|
301
|
+
s.healthy = true;
|
|
302
|
+
s.boots = 0;
|
|
303
|
+
writeState(s);
|
|
304
|
+
}
|
|
305
|
+
}, HEALTHY_AFTER_MS).unref();
|
|
306
|
+
log(`now running ${target.version}`);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function switchWhenIdle(target) {
|
|
310
|
+
let quiet = 0;
|
|
311
|
+
const t = setInterval(() => {
|
|
312
|
+
// A server request the client never answers (unsupported by that client) stops counting after a minute.
|
|
313
|
+
for (const [k, t0] of serverPending) if (Date.now() - t0 > 60 * 1000) serverPending.delete(k);
|
|
314
|
+
const idle = clientPending.size === 0 && serverPending.size === 0 && !swapping && Date.now() - lastActivity > 2000;
|
|
315
|
+
quiet = idle ? quiet + 1 : 0;
|
|
316
|
+
if (quiet >= 2) {
|
|
317
|
+
clearInterval(t);
|
|
318
|
+
switchTo(target);
|
|
319
|
+
}
|
|
320
|
+
}, 1000);
|
|
321
|
+
t.unref();
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// ---------- background install ----------
|
|
325
|
+
|
|
326
|
+
function findNpm() {
|
|
327
|
+
const win = process.platform === 'win32';
|
|
328
|
+
const name = win ? 'npm.cmd' : 'npm';
|
|
329
|
+
const dirs = [path.dirname(process.execPath), ...(process.env.PATH || '').split(path.delimiter)];
|
|
330
|
+
if (!win) dirs.push('/opt/homebrew/bin', '/usr/local/bin', '/usr/bin');
|
|
331
|
+
for (const d of dirs) {
|
|
332
|
+
const p = path.join(d, name);
|
|
333
|
+
try {
|
|
334
|
+
fs.accessSync(p, fs.constants.X_OK);
|
|
335
|
+
return p;
|
|
336
|
+
} catch {}
|
|
337
|
+
}
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function lock() {
|
|
342
|
+
const file = path.join(HOME, 'install.lock');
|
|
343
|
+
try {
|
|
344
|
+
fs.mkdirSync(HOME, { recursive: true });
|
|
345
|
+
try {
|
|
346
|
+
if (Date.now() - fs.statSync(file).mtimeMs > 15 * 60 * 1000) fs.unlinkSync(file);
|
|
347
|
+
} catch {}
|
|
348
|
+
fs.writeFileSync(file, String(process.pid), { flag: 'wx' });
|
|
349
|
+
return () => { try { fs.unlinkSync(file); } catch {} };
|
|
350
|
+
} catch {
|
|
351
|
+
return null; // another instance is installing
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function cleanup(keep) {
|
|
356
|
+
try {
|
|
357
|
+
for (const name of fs.readdirSync(HOME)) {
|
|
358
|
+
const p = path.join(HOME, name);
|
|
359
|
+
if (parse(name) && !keep.includes(name) && fs.statSync(p).isDirectory()) fs.rmSync(p, { recursive: true, force: true });
|
|
360
|
+
}
|
|
361
|
+
} catch {}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
async function checkForUpdate() {
|
|
365
|
+
let latest;
|
|
366
|
+
try {
|
|
367
|
+
const res = await fetch(`${process.env.SOFLUTION_REGISTRY || 'https://registry.npmjs.org'}/${encodeURIComponent(cfg.package)}/latest`, {
|
|
368
|
+
headers: { accept: 'application/json' },
|
|
369
|
+
signal: AbortSignal.timeout(5000),
|
|
370
|
+
});
|
|
371
|
+
if (!res.ok) return;
|
|
372
|
+
latest = (await res.json()).version;
|
|
373
|
+
} catch {
|
|
374
|
+
return; // offline
|
|
375
|
+
}
|
|
376
|
+
if (!current || !isNewer(latest, current.version)) return;
|
|
377
|
+
const s = readState();
|
|
378
|
+
if (s.rejected.includes(latest)) return;
|
|
379
|
+
|
|
380
|
+
// Already installed by another instance: just switch.
|
|
381
|
+
if (s.installed && s.installed.version === latest && fs.existsSync(serverIn(s.installed.dir))) {
|
|
382
|
+
switchWhenIdle({ version: latest, entry: serverIn(s.installed.dir) });
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const npm = findNpm();
|
|
386
|
+
if (!npm) {
|
|
387
|
+
log(`${latest} is available, but npm was not found to install it`);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const unlock = lock();
|
|
391
|
+
if (!unlock) return;
|
|
392
|
+
const dir = path.join(HOME, latest);
|
|
393
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
394
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
395
|
+
log(`installing ${latest} in the background`);
|
|
396
|
+
const env = { ...process.env, PATH: [path.dirname(process.execPath), process.env.PATH || ''].join(path.delimiter) };
|
|
397
|
+
await new Promise((resolve) => {
|
|
398
|
+
const child = spawn(npm, ['install', '--prefix', dir, '--omit=dev', '--no-audit', '--no-fund', '--loglevel=error', `${cfg.package}@${latest}`], {
|
|
399
|
+
env,
|
|
400
|
+
stdio: ['ignore', 'ignore', 'ignore'],
|
|
401
|
+
shell: process.platform === 'win32',
|
|
402
|
+
windowsHide: true,
|
|
403
|
+
});
|
|
404
|
+
child.on('error', (e) => {
|
|
405
|
+
unlock();
|
|
406
|
+
log(`install failed: ${e.message}`);
|
|
407
|
+
resolve();
|
|
408
|
+
});
|
|
409
|
+
child.on('exit', (code) => {
|
|
410
|
+
unlock();
|
|
411
|
+
if (code !== 0 || !fs.existsSync(serverIn(dir))) {
|
|
412
|
+
log(`install of ${latest} failed (npm exit ${code}), retried at the next check`);
|
|
413
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
414
|
+
return resolve();
|
|
415
|
+
}
|
|
416
|
+
const st = readState();
|
|
417
|
+
st.installed = { version: latest, dir };
|
|
418
|
+
st.healthy = false;
|
|
419
|
+
st.boots = 0;
|
|
420
|
+
writeState(st);
|
|
421
|
+
cleanup([latest, current ? current.version : '']);
|
|
422
|
+
log(`${latest} installed`);
|
|
423
|
+
switchWhenIdle({ version: latest, entry: serverIn(dir) });
|
|
424
|
+
resolve();
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// ---------- go ----------
|
|
430
|
+
|
|
431
|
+
const first = start(pickStart());
|
|
432
|
+
attach(first);
|
|
433
|
+
if (first.version !== OWN_VERSION) {
|
|
434
|
+
setTimeout(() => {
|
|
435
|
+
const s = readState();
|
|
436
|
+
if (s.installed && s.installed.version === first.version && current === first) {
|
|
437
|
+
s.healthy = true;
|
|
438
|
+
s.boots = 0;
|
|
439
|
+
writeState(s);
|
|
440
|
+
}
|
|
441
|
+
}, HEALTHY_AFTER_MS).unref();
|
|
442
|
+
}
|
|
443
|
+
if (!OFF) {
|
|
444
|
+
const run = () => checkForUpdate().catch((e) => log(`update check failed: ${e.message}`));
|
|
445
|
+
setTimeout(run, Number(process.env.SOFLUTION_FIRST_CHECK_MS) || 10 * 1000).unref();
|
|
446
|
+
setInterval(run, CHECK_EVERY_MS).unref();
|
|
447
|
+
}
|
package/bin/update.json
ADDED
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const SERVER_NAME = "depsonar";
|
|
2
|
-
export declare const SERVER_VERSION = "4.
|
|
2
|
+
export declare const SERVER_VERSION = "4.1.0";
|
|
3
3
|
export declare const CHARACTER_LIMIT = 25000;
|
|
4
4
|
export declare const COMMAND_TIMEOUT = 120000;
|
|
5
5
|
export declare const ECOSYSTEM_GROUPS: Record<string, RegExp>;
|
package/dist/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const SERVER_NAME = "depsonar";
|
|
2
|
-
export const SERVER_VERSION = "4.
|
|
2
|
+
export const SERVER_VERSION = "4.1.0";
|
|
3
3
|
export const CHARACTER_LIMIT = 25_000;
|
|
4
4
|
export const COMMAND_TIMEOUT = 120_000;
|
|
5
5
|
// ─── Ecosystem Grouping (for display) ──────────────────────────────────
|
package/dist/index.js
CHANGED
|
@@ -114,7 +114,9 @@ else {
|
|
|
114
114
|
version: SERVER_VERSION,
|
|
115
115
|
});
|
|
116
116
|
registerTools(server);
|
|
117
|
-
const
|
|
117
|
+
const { attachUpdateNotice, startUpdateCheck } = await import("./update-notice.js");
|
|
118
|
+
const transport = attachUpdateNotice(new StdioServerTransport());
|
|
119
|
+
startUpdateCheck("depsonar", SERVER_VERSION, "https://github.com/Soflutionltd/depsonar");
|
|
118
120
|
await server.connect(transport);
|
|
119
121
|
console.error(`${SERVER_NAME} v${SERVER_VERSION} running on stdio`);
|
|
120
122
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACpD,mDAAmD;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;AAChD,CAAC;KAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IAC/D,yCAAyC;IACzC,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACjC,CAAC;KAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,C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,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,KAAK,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC9C,CAAC,CAAC;AACH,CAAC;KAAM,CAAC;IACN,2BAA2B;IAC3B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,yCAAyC,CAAC,CAAC;IAC9E,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAAC,2CAA2C,CAAC,CAAC;IAC3F,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAE3D,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IAEH,aAAa,CAAC,MAAM,CAAC,CAAC;IAEtB,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACpF,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACjE,gBAAgB,CAAC,UAAU,EAAE,cAAc,EAAE,0CAA0C,CAAC,CAAC;IACzF,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,KAAK,cAAc,mBAAmB,CAAC,CAAC;AACtE,CAAC"}
|
package/dist/services/audit.d.ts
CHANGED
|
@@ -18,7 +18,17 @@ export interface AuditResult {
|
|
|
18
18
|
auditCommand: string;
|
|
19
19
|
error: string | null;
|
|
20
20
|
}
|
|
21
|
-
export
|
|
21
|
+
export interface AuditOptions {
|
|
22
|
+
/** Node only: skip devDependencies (`npm audit --omit=dev`, `pnpm audit --prod`). Other languages audit everything. */
|
|
23
|
+
production?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reads `npm audit --json` (v7+: `vulnerabilities`, one entry per package) and
|
|
27
|
+
* `pnpm audit --json` (`advisories`, one entry per advisory, no `total`).
|
|
28
|
+
* Counts come from `metadata.vulnerabilities`, as each tool reports them.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseNodeAudit(raw: string, projectName: string, auditCmd: string): AuditResult;
|
|
31
|
+
export declare function auditProject(projectPath: string, projectName: string, language: string, options?: AuditOptions): AuditResult;
|
|
22
32
|
export declare function auditAllProjects(projects: Array<{
|
|
23
33
|
name: string;
|
|
24
34
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/services/audit.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,iBAAiB,EAAE,CAAC;IACrC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/services/audit.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAi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