@snutils/snu 0.2.3 → 0.2.5
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/dist/cli/attachment.d.ts +60 -0
- package/dist/cli/attachment.d.ts.map +1 -0
- package/dist/cli/attachment.js +52 -0
- package/dist/cli/attachment.js.map +1 -0
- package/dist/cli/daemon.d.ts +63 -0
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/daemon.js +163 -0
- package/dist/cli/daemon.js.map +1 -1
- package/dist/cli/doctor.d.ts +155 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +394 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/index.d.ts +23 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +164 -18
- package/dist/cli/index.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +44 -5
- package/dist/client.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +44 -25
- package/dist/mcp/index.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +26 -5
- package/dist/registry.js.map +1 -1
- package/dist/server/dispatcher.d.ts +7 -6
- package/dist/server/dispatcher.d.ts.map +1 -1
- package/dist/server/dispatcher.js +109 -30
- package/dist/server/dispatcher.js.map +1 -1
- package/dist/server/httpBridge.d.ts.map +1 -1
- package/dist/server/httpBridge.js +2 -1
- package/dist/server/httpBridge.js.map +1 -1
- package/dist/server/scopeResolver.d.ts +85 -0
- package/dist/server/scopeResolver.d.ts.map +1 -0
- package/dist/server/scopeResolver.js +116 -0
- package/dist/server/scopeResolver.js.map +1 -0
- package/dist/server/scopeVectors.d.ts +30 -0
- package/dist/server/scopeVectors.d.ts.map +1 -0
- package/dist/server/scopeVectors.js +90 -0
- package/dist/server/scopeVectors.js.map +1 -0
- package/dist/server/standalone.d.ts +7 -0
- package/dist/server/standalone.d.ts.map +1 -1
- package/dist/server/standalone.js +20 -4
- package/dist/server/standalone.js.map +1 -1
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `snu doctor` — one bundle that explains why the bridge is not behaving,
|
|
4
|
+
* without leaking anything.
|
|
5
|
+
*
|
|
6
|
+
* Two rules shape this file.
|
|
7
|
+
*
|
|
8
|
+
* Redaction is an ALLOWLIST. Every field in the report is named here
|
|
9
|
+
* explicitly; anything not named is dropped. A blocklist would be the obvious
|
|
10
|
+
* design and the wrong one: the port descriptor carries an auth token, health
|
|
11
|
+
* responses may grow fields, and instance settings hold session material — with
|
|
12
|
+
* a blocklist, every future field leaks by default and the mistake is invisible
|
|
13
|
+
* until someone pastes a diagnostic into an issue. Here the failure mode is a
|
|
14
|
+
* missing field, which is loud and harmless.
|
|
15
|
+
*
|
|
16
|
+
* Collection is INJECTED. The report shape and the redaction are pure, so they
|
|
17
|
+
* can be tested against token-shaped fixtures without a bridge, processes or
|
|
18
|
+
* a network.
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33
|
+
}) : function(o, v) {
|
|
34
|
+
o["default"] = v;
|
|
35
|
+
});
|
|
36
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
37
|
+
var ownKeys = function(o) {
|
|
38
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
39
|
+
var ar = [];
|
|
40
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
return ownKeys(o);
|
|
44
|
+
};
|
|
45
|
+
return function (mod) {
|
|
46
|
+
if (mod && mod.__esModule) return mod;
|
|
47
|
+
var result = {};
|
|
48
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
49
|
+
__setModuleDefault(result, mod);
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.safeCommand = void 0;
|
|
55
|
+
exports.scrubFreeText = scrubFreeText;
|
|
56
|
+
exports.buildDoctorReport = buildDoctorReport;
|
|
57
|
+
exports.deriveFindings = deriveFindings;
|
|
58
|
+
exports.formatDoctorReport = formatDoctorReport;
|
|
59
|
+
exports.collectDoctorSources = collectDoctorSources;
|
|
60
|
+
/** Origin only: a full instance URL can carry a path, query or session hints. */
|
|
61
|
+
function toOrigin(value) {
|
|
62
|
+
if (typeof value !== 'string' || !value.trim())
|
|
63
|
+
return null;
|
|
64
|
+
try {
|
|
65
|
+
return new URL(value).origin;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function asNumber(value) {
|
|
72
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
73
|
+
}
|
|
74
|
+
function asString(value) {
|
|
75
|
+
return typeof value === 'string' && value ? value : null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Scrub free text — command lines and error messages.
|
|
79
|
+
*
|
|
80
|
+
* This is the one place an allowlist cannot be used: the content is arbitrary
|
|
81
|
+
* strings produced elsewhere, so there are no fields to enumerate. Treat it as
|
|
82
|
+
* defence in depth rather than a guarantee, and keep the surface small by
|
|
83
|
+
* truncating hard.
|
|
84
|
+
*
|
|
85
|
+
* Three shapes are removed: credential-ish key/value pairs with or without
|
|
86
|
+
* leading dashes, bearer tokens, and any long hex or base64-looking run, which
|
|
87
|
+
* is what this codebase's 32-character tokens actually look like. The first
|
|
88
|
+
* version of this only matched dashed flags, and the redaction test caught a
|
|
89
|
+
* token in `token=<value>` sailing straight through.
|
|
90
|
+
*/
|
|
91
|
+
function scrubFreeText(value, max = 120) {
|
|
92
|
+
const text = typeof value === 'string' ? value : '';
|
|
93
|
+
const scrubbed = text
|
|
94
|
+
.replace(/((?:--?)?(?:token|password|passwd|secret|key|pat|authorization|cookie|g_ck|jsessionid)(?:\s*[=:]\s*|\s+))\S+/gi, '$1<redacted>')
|
|
95
|
+
.replace(/\bBearer\s+\S+/gi, 'Bearer <redacted>')
|
|
96
|
+
.replace(/\b[A-Fa-f0-9]{24,}\b/g, '<redacted>')
|
|
97
|
+
.replace(/\b[A-Za-z0-9+/]{40,}={0,2}\b/g, '<redacted>');
|
|
98
|
+
return scrubbed.length > max ? `${scrubbed.slice(0, max - 3)}...` : scrubbed;
|
|
99
|
+
}
|
|
100
|
+
/** Back-compat alias: command lines are just one kind of free text. */
|
|
101
|
+
exports.safeCommand = scrubFreeText;
|
|
102
|
+
/**
|
|
103
|
+
* Build the report. Every output field is constructed explicitly from a named
|
|
104
|
+
* input; nothing is spread, copied wholesale, or passed through.
|
|
105
|
+
*/
|
|
106
|
+
function buildDoctorReport(sources, now = null) {
|
|
107
|
+
const health = sources.health || null;
|
|
108
|
+
const descriptors = sources.descriptors.map((entry) => {
|
|
109
|
+
const data = entry.data;
|
|
110
|
+
return {
|
|
111
|
+
path: entry.path,
|
|
112
|
+
present: !!data,
|
|
113
|
+
pid: asNumber(data?.pid),
|
|
114
|
+
port: asNumber(data?.port),
|
|
115
|
+
hostKind: asString(data?.hostKind),
|
|
116
|
+
workspaceRoot: asString(data?.workspaceRoot),
|
|
117
|
+
// The token's PRESENCE is diagnostic; its value never is.
|
|
118
|
+
carriesToken: typeof data?.token === 'string' && data.token.length > 0,
|
|
119
|
+
...(entry.error ? { error: entry.error } : {}),
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
const listeners = sources.listeners
|
|
123
|
+
.filter((l) => !!l)
|
|
124
|
+
.map((l) => ({ port: l.port, pid: l.pid, kind: l.kind, command: scrubFreeText(l.command) }));
|
|
125
|
+
const instances = sources.instances.map((i) => ({
|
|
126
|
+
name: i.name,
|
|
127
|
+
origin: toOrigin(i.url),
|
|
128
|
+
hasSettings: i.hasSettings,
|
|
129
|
+
}));
|
|
130
|
+
const auth = (sources.auth || []).map((a) => ({
|
|
131
|
+
instance: a.instance,
|
|
132
|
+
state: asString(a.state) || 'AUTH_UNKNOWN',
|
|
133
|
+
ok: a.ok === true,
|
|
134
|
+
lastValidatedAt: asNumber(a.lastValidatedAt),
|
|
135
|
+
}));
|
|
136
|
+
const capabilities = sources.capabilities
|
|
137
|
+
? {
|
|
138
|
+
tier: asString(sources.capabilities.tier),
|
|
139
|
+
proFeatures: typeof sources.capabilities.proFeatures === 'boolean' ? sources.capabilities.proFeatures : null,
|
|
140
|
+
commandReview: typeof sources.capabilities?.capabilities?.commandReview === 'number'
|
|
141
|
+
? sources.capabilities.capabilities.commandReview === 1
|
|
142
|
+
: null,
|
|
143
|
+
}
|
|
144
|
+
: null;
|
|
145
|
+
const report = {
|
|
146
|
+
generatedAt: now,
|
|
147
|
+
versions: {
|
|
148
|
+
cli: sources.cliVersion,
|
|
149
|
+
extension: asString(health?.extensionVersion),
|
|
150
|
+
bridgeApi: asNumber(health?.apiVersion),
|
|
151
|
+
node: sources.nodeVersion,
|
|
152
|
+
platform: sources.platform,
|
|
153
|
+
},
|
|
154
|
+
bridge: {
|
|
155
|
+
reachable: !!health,
|
|
156
|
+
hostKind: asString(health?.hostKind),
|
|
157
|
+
pid: asNumber(health?.pid),
|
|
158
|
+
workspaceRoot: asString(health?.workspaceRoot),
|
|
159
|
+
startedAt: asNumber(health?.startedAt),
|
|
160
|
+
commandCount: Array.isArray(health?.commands) ? health.commands.length : null,
|
|
161
|
+
},
|
|
162
|
+
ownership: {
|
|
163
|
+
leasePresent: !!sources.lease,
|
|
164
|
+
leasePid: asNumber(sources.lease?.pid),
|
|
165
|
+
leaseEditorKind: asString(sources.lease?.editorKind),
|
|
166
|
+
leaseWorkspaceRoot: asString(sources.lease?.workspaceRoot),
|
|
167
|
+
leaseHeartbeatAt: asNumber(sources.lease?.lastHeartbeatAt),
|
|
168
|
+
},
|
|
169
|
+
descriptors,
|
|
170
|
+
listeners,
|
|
171
|
+
instances,
|
|
172
|
+
auth,
|
|
173
|
+
capabilities,
|
|
174
|
+
findings: [],
|
|
175
|
+
recentErrors: (sources.recentErrors || []).map((e) => scrubFreeText(e, 300)),
|
|
176
|
+
};
|
|
177
|
+
report.findings = deriveFindings(report);
|
|
178
|
+
return report;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Turn the collected facts into the sentences a reader actually needs. A dump
|
|
182
|
+
* that leaves the diagnosis to the reader is not a diagnostic.
|
|
183
|
+
*/
|
|
184
|
+
function deriveFindings(report) {
|
|
185
|
+
const findings = [];
|
|
186
|
+
if (!report.bridge.reachable) {
|
|
187
|
+
findings.push('No bridge answered a health check on the known ports.');
|
|
188
|
+
if (report.listeners.length) {
|
|
189
|
+
findings.push(`Something is listening on the bridge ports but not serving: ${report.listeners
|
|
190
|
+
.map((l) => `PID ${l.pid} on ${l.port} (${l.kind})`)
|
|
191
|
+
.join(', ')}. This is the "alive but not answering" case — it can be taken over.`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// A descriptor naming a different process than the one actually serving is
|
|
195
|
+
// how a healthy bridge becomes undiscoverable.
|
|
196
|
+
for (const d of report.descriptors) {
|
|
197
|
+
if (d.present && report.bridge.pid && d.pid && d.pid !== report.bridge.pid) {
|
|
198
|
+
findings.push(`${d.path} names PID ${d.pid}, but the bridge answering is PID ${report.bridge.pid}. That descriptor is stale.`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (report.bridge.reachable && !report.descriptors.some((d) => d.present)) {
|
|
202
|
+
findings.push('The bridge is healthy but has no port descriptor, so it is undiscoverable from other directories.');
|
|
203
|
+
}
|
|
204
|
+
if (report.ownership.leasePresent && report.bridge.pid && report.ownership.leasePid !== report.bridge.pid) {
|
|
205
|
+
findings.push(`The owner lease names PID ${report.ownership.leasePid} while PID ${report.bridge.pid} is serving — ownership and reality disagree.`);
|
|
206
|
+
}
|
|
207
|
+
// Multiple workspace roots claiming the bridge is the two-window case.
|
|
208
|
+
const roots = new Set([report.bridge.workspaceRoot, report.ownership.leaseWorkspaceRoot, ...report.descriptors.map((d) => d.workspaceRoot)]
|
|
209
|
+
.filter((r) => !!r));
|
|
210
|
+
if (roots.size > 1) {
|
|
211
|
+
findings.push(`More than one workspace claims the bridge: ${Array.from(roots).join(', ')}.`);
|
|
212
|
+
}
|
|
213
|
+
const expired = report.auth.filter((a) => a.state === 'AUTH_EXPIRED');
|
|
214
|
+
if (expired.length) {
|
|
215
|
+
findings.push(`ServiceNow rejected the session for ${expired.map((a) => a.instance).join(', ')}. Run /token in the browser for those instances.`);
|
|
216
|
+
}
|
|
217
|
+
const unchecked = report.auth.filter((a) => a.state === 'HELPER_DISCONNECTED');
|
|
218
|
+
if (unchecked.length) {
|
|
219
|
+
findings.push('The SN Utils helper tab is not connected, so no session could be verified.');
|
|
220
|
+
}
|
|
221
|
+
// A probe that did not return a verdict is not a passing probe. Saying
|
|
222
|
+
// nothing about it and then declaring "session checks passed" is the same
|
|
223
|
+
// over-claim this diagnostic exists to catch.
|
|
224
|
+
const unknown = report.auth.filter((a) => a.state === 'AUTH_UNKNOWN' || a.state === 'AUTH_UNSUPPORTED');
|
|
225
|
+
if (unknown.length) {
|
|
226
|
+
findings.push(`The session could not be verified for ${unknown.map((a) => a.instance).join(', ')} — the probe returned no verdict. Retry before treating those instances as usable.`);
|
|
227
|
+
}
|
|
228
|
+
// Never-connected instances are normal, not broken. Worth stating so the
|
|
229
|
+
// difference between "no session yet" and "session rejected" is visible.
|
|
230
|
+
const missing = report.auth.filter((a) => a.state === 'AUTH_MISSING');
|
|
231
|
+
if (missing.length) {
|
|
232
|
+
findings.push(`No session yet for ${missing.map((a) => a.instance).join(', ')}. That is expected until the instance is opened in the browser and /token is run.`);
|
|
233
|
+
}
|
|
234
|
+
if (!findings.length) {
|
|
235
|
+
const verified = report.auth.filter((a) => a.ok).length;
|
|
236
|
+
findings.push(report.auth.length
|
|
237
|
+
? `No problems found: a bridge is serving, its registration matches, and all ${verified} instance session${verified === 1 ? '' : 's'} verified.`
|
|
238
|
+
: 'No problems found: a bridge is serving and its registration matches. No instance sessions were checked.');
|
|
239
|
+
}
|
|
240
|
+
return findings;
|
|
241
|
+
}
|
|
242
|
+
/** Human-readable summary. The JSON form carries everything; this carries the point. */
|
|
243
|
+
function formatDoctorReport(report) {
|
|
244
|
+
const lines = [];
|
|
245
|
+
const yn = (v) => (v ? 'yes' : 'no');
|
|
246
|
+
lines.push('');
|
|
247
|
+
lines.push('SN Utils bridge diagnostic');
|
|
248
|
+
lines.push('');
|
|
249
|
+
lines.push(` CLI ${report.versions.cli}`);
|
|
250
|
+
lines.push(` Extension ${report.versions.extension ?? 'not reported'}`);
|
|
251
|
+
lines.push(` Bridge API ${report.versions.bridgeApi ?? 'unknown'}`);
|
|
252
|
+
lines.push(` Node/platform ${report.versions.node} on ${report.versions.platform}`);
|
|
253
|
+
lines.push('');
|
|
254
|
+
lines.push(` Bridge ${report.bridge.reachable ? 'answering' : 'not answering'}`);
|
|
255
|
+
if (report.bridge.reachable) {
|
|
256
|
+
lines.push(` host ${report.bridge.hostKind ?? 'unknown'} (PID ${report.bridge.pid ?? '?'})`);
|
|
257
|
+
lines.push(` workspace ${report.bridge.workspaceRoot ?? 'not reported'}`);
|
|
258
|
+
lines.push(` commands ${report.bridge.commandCount ?? '?'}`);
|
|
259
|
+
}
|
|
260
|
+
lines.push(` Owner lease ${yn(report.ownership.leasePresent)}${report.ownership.leasePid ? ` (PID ${report.ownership.leasePid}, ${report.ownership.leaseEditorKind ?? 'unknown editor'})` : ''}`);
|
|
261
|
+
if (report.descriptors.length) {
|
|
262
|
+
lines.push('');
|
|
263
|
+
lines.push(' Port descriptors');
|
|
264
|
+
for (const d of report.descriptors) {
|
|
265
|
+
lines.push(` ${d.present ? '✓' : '✗'} ${d.path}${d.present ? ` — PID ${d.pid ?? '?'}, port ${d.port ?? '?'}` : ''}`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (report.listeners.length) {
|
|
269
|
+
lines.push('');
|
|
270
|
+
lines.push(' Listening on bridge ports');
|
|
271
|
+
for (const l of report.listeners) {
|
|
272
|
+
lines.push(` ${l.port} PID ${l.pid} [${l.kind}] ${l.command}`);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (report.auth.length) {
|
|
276
|
+
lines.push('');
|
|
277
|
+
lines.push(' Instance sessions');
|
|
278
|
+
for (const a of report.auth) {
|
|
279
|
+
lines.push(` ${a.ok ? '✓' : '✗'} ${a.instance} ${a.state}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
lines.push('');
|
|
283
|
+
lines.push(' Findings');
|
|
284
|
+
for (const f of report.findings)
|
|
285
|
+
lines.push(` • ${f}`);
|
|
286
|
+
lines.push('');
|
|
287
|
+
lines.push(' No tokens, session material or settings files are included in this report.');
|
|
288
|
+
lines.push('');
|
|
289
|
+
return lines.join('\n');
|
|
290
|
+
}
|
|
291
|
+
// ---------------------------------------------------------------------------
|
|
292
|
+
// Collection. Everything below reads the machine; nothing below decides what
|
|
293
|
+
// is safe to print — that is buildDoctorReport's job, and keeping the two
|
|
294
|
+
// apart is what makes the redaction testable.
|
|
295
|
+
// ---------------------------------------------------------------------------
|
|
296
|
+
const fs = __importStar(require("fs"));
|
|
297
|
+
const os = __importStar(require("os"));
|
|
298
|
+
const path = __importStar(require("path"));
|
|
299
|
+
const client_js_1 = require("../client.js");
|
|
300
|
+
const portReclaim_js_1 = require("./portReclaim.js");
|
|
301
|
+
function readJsonIfPresent(file) {
|
|
302
|
+
try {
|
|
303
|
+
if (!fs.existsSync(file))
|
|
304
|
+
return { path: file, data: null };
|
|
305
|
+
return { path: file, data: JSON.parse(fs.readFileSync(file, 'utf8')) };
|
|
306
|
+
}
|
|
307
|
+
catch (err) {
|
|
308
|
+
return { path: file, data: null, error: `unreadable: ${err?.message || err}` };
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/** Gather everything a diagnosis needs, tolerating every part being absent. */
|
|
312
|
+
async function collectDoctorSources(options) {
|
|
313
|
+
const httpPort = options.httpPort ?? 1977;
|
|
314
|
+
const wsPort = options.wsPort ?? 1978;
|
|
315
|
+
const descriptorPaths = [(0, client_js_1.findWorkspacePortFile)(options.cwd), (0, client_js_1.getGlobalPortFilePath)()]
|
|
316
|
+
.filter((p) => !!p);
|
|
317
|
+
const descriptors = descriptorPaths.map(readJsonIfPresent);
|
|
318
|
+
const leaseFile = path.join(os.homedir(), '.sn-scriptsync', 'bridge-owner.json');
|
|
319
|
+
const lease = readJsonIfPresent(leaseFile).data;
|
|
320
|
+
let health;
|
|
321
|
+
try {
|
|
322
|
+
health = await (0, client_js_1.checkHealth)(httpPort);
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
// A descriptor may point at an ephemeral port instead of the fixed one.
|
|
326
|
+
for (const d of descriptors) {
|
|
327
|
+
const port = d.data?.port;
|
|
328
|
+
if (typeof port === 'number' && port !== httpPort) {
|
|
329
|
+
try {
|
|
330
|
+
health = await (0, client_js_1.checkHealth)(port);
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
catch { /* keep looking */ }
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
const listeners = await Promise.all([httpPort, wsPort].map(async (port) => {
|
|
338
|
+
const listener = await (0, portReclaim_js_1.findPortListener)(port);
|
|
339
|
+
return listener
|
|
340
|
+
? { port, pid: listener.pid, command: listener.command, kind: (0, portReclaim_js_1.classifyListener)(listener.command) }
|
|
341
|
+
: null;
|
|
342
|
+
}));
|
|
343
|
+
// Instances and per-instance session state need a working bridge; without
|
|
344
|
+
// one these stay empty rather than failing the whole diagnostic.
|
|
345
|
+
let instances = [];
|
|
346
|
+
let auth = [];
|
|
347
|
+
let capabilities;
|
|
348
|
+
if (health) {
|
|
349
|
+
const client = new client_js_1.ScriptSyncClient({ cwd: options.cwd });
|
|
350
|
+
try {
|
|
351
|
+
const listed = await client.execute({ command: 'list_instances', params: {} }, 5_000);
|
|
352
|
+
instances = (listed.result?.instances || []).map((i) => ({
|
|
353
|
+
name: i.name,
|
|
354
|
+
url: i.url ?? null,
|
|
355
|
+
hasSettings: i.hasSettings !== false,
|
|
356
|
+
}));
|
|
357
|
+
}
|
|
358
|
+
catch { /* no instances is itself a finding */ }
|
|
359
|
+
for (const instance of instances) {
|
|
360
|
+
try {
|
|
361
|
+
const probe = await client.execute({ command: 'auth_status', instance: instance.name, params: {} }, 15_000);
|
|
362
|
+
auth.push({
|
|
363
|
+
instance: instance.name,
|
|
364
|
+
state: probe.result?.state,
|
|
365
|
+
ok: probe.result?.ok,
|
|
366
|
+
lastValidatedAt: probe.result?.lastValidatedAt,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
catch (err) {
|
|
370
|
+
auth.push({ instance: instance.name, state: err?.code === 'E_UNKNOWN_COMMAND' ? 'AUTH_UNSUPPORTED' : 'AUTH_UNKNOWN', ok: false });
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
try {
|
|
374
|
+
const caps = await client.execute({ command: 'get_capabilities', params: {} }, 5_000);
|
|
375
|
+
capabilities = caps.result;
|
|
376
|
+
}
|
|
377
|
+
catch { /* helper tab may be closed */ }
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
cliVersion: options.cliVersion,
|
|
381
|
+
descriptors,
|
|
382
|
+
health,
|
|
383
|
+
listeners,
|
|
384
|
+
lease,
|
|
385
|
+
instances,
|
|
386
|
+
auth,
|
|
387
|
+
capabilities,
|
|
388
|
+
recentErrors: [],
|
|
389
|
+
platform: `${os.platform()} ${os.release()}`,
|
|
390
|
+
nodeVersion: process.version,
|
|
391
|
+
cwd: options.cwd,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGH,sCAQC;AASD,8CAiFC;AAMD,wCAiFC;AAGD,gDAmDC;AAwBD,oDAwFC;AA/XD,iFAAiF;AACjF,SAAS,QAAQ,CAAC,KAAc;IAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;IAC5D,IAAI,CAAC;QACJ,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,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/dist/cli/index.d.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
export declare const VERSION: string;
|
|
2
|
+
export type ParseArgsOptions = Record<string, {
|
|
3
|
+
type: 'string' | 'boolean';
|
|
4
|
+
short?: string;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* Build the `parseArgs` option map for a tool: the global options every command
|
|
8
|
+
* accepts, plus the tool's own `cliOptions`.
|
|
9
|
+
*
|
|
10
|
+
* `short` must be OMITTED for an option that has no short form, never set to
|
|
11
|
+
* `undefined`. parseArgs validates the property whenever the key is present
|
|
12
|
+
* (it checks with ObjectHasOwn), so `short: undefined` throws
|
|
13
|
+
* ERR_INVALID_ARG_TYPE before a single argument is read — which took out every
|
|
14
|
+
* invocation of `record delete`, `browser form`, `browser set`, `browser
|
|
15
|
+
* action`, `browser nav` and `screenshot` in 0.2.3, whether or not the flag was
|
|
16
|
+
* passed. Exported so the regression test exercises this builder rather than a
|
|
17
|
+
* copy of it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildParseArgsOptions(tool: {
|
|
20
|
+
cliOptions?: Record<string, {
|
|
21
|
+
type: 'string' | 'boolean';
|
|
22
|
+
short?: string;
|
|
23
|
+
}>;
|
|
24
|
+
}): ParseArgsOptions;
|
|
2
25
|
export declare function printHelp(): void;
|
|
3
26
|
export declare function runCli(argv?: string[]): Promise<void>;
|
|
4
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,OAAO,QAA0B,CAAC;AAY/C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9F;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,gBAAgB,CAgB7I;AAED,wBAAgB,SAAS,IAAI,IAAI,CAoDhC;AAED,wBAAsB,MAAM,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8sBxE"}
|