dsh-plugin-wsl-env 0.21.0 → 0.22.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/CHANGELOG.md +66 -1
- package/client.js +153 -33
- package/cordis.patch.yml +9 -0
- package/docs/CONFIGURATION.md +10 -1
- package/docs/DIAGNOSTICS.md +28 -1
- package/docs/DIAGNOSTICS.zh.md +24 -1
- package/lib/index.d.ts +11 -0
- package/lib/index.js +4 -0
- package/lib/messages.d.ts +81 -0
- package/lib/messages.js +94 -1
- package/lib/wsl-doctor-command.d.ts +105 -0
- package/lib/wsl-doctor-command.js +240 -0
- package/lib/wsl-doctor-tool.d.ts +99 -7
- package/lib/wsl-doctor-tool.js +284 -22
- package/locale/doctor/en.json +30 -0
- package/locale/doctor/zh.json +30 -0
- package/package.json +7 -3
- package/scripts/doctor.mjs +569 -141
package/lib/wsl-doctor-tool.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
27
27
|
import { distroOfUnc } from "./distro-route.js";
|
|
28
|
+
import { t } from "./messages.js";
|
|
28
29
|
import { doctorReport } from "./index.js";
|
|
29
30
|
export const name = "wsl-doctor-tool";
|
|
30
31
|
/**
|
|
@@ -38,15 +39,106 @@ export const name = "wsl-doctor-tool";
|
|
|
38
39
|
* below.
|
|
39
40
|
*/
|
|
40
41
|
export const inject = ["tools", "workingDirectory"];
|
|
42
|
+
/**
|
|
43
|
+
* The section a check id belongs to. Mirrors `sectionOf` in
|
|
44
|
+
* `scripts/doctor.mjs` (the CLI's `--sections` filter reads that one); the
|
|
45
|
+
* parity is pinned by a test in `test/wsl-doctor-tool.test.mjs`, so a check
|
|
46
|
+
* cannot move sections on one side without the other noticing.
|
|
47
|
+
* @param id - the check id.
|
|
48
|
+
* @returns the section name.
|
|
49
|
+
*/
|
|
50
|
+
export function sectionOf(id) {
|
|
51
|
+
if (id.startsWith("sandbox.") || id === "functional.sandbox")
|
|
52
|
+
return "sandbox";
|
|
53
|
+
if (id.startsWith("session.") || id === "runtime.scopes" || id === "distro.wsl-conf-boot")
|
|
54
|
+
return "session";
|
|
55
|
+
if (id.startsWith("config.") || id === "distro.wsl-conf-interop" || id === "distro.wsl-conf-automount")
|
|
56
|
+
return "conf";
|
|
57
|
+
if (id === "distro.dns")
|
|
58
|
+
return "net";
|
|
59
|
+
if (id.startsWith("agent.") || id === "functional.exec" || id === "functional.fs")
|
|
60
|
+
return "agent";
|
|
61
|
+
return "host";
|
|
62
|
+
}
|
|
63
|
+
/** The sections in report order, matching the doctor CLI's SECTIONS list. */
|
|
64
|
+
export const SECTIONS = ["host", "sandbox", "session", "conf", "net", "agent"];
|
|
65
|
+
/** The pseudo-distro a check lands under when this run's scope never executed it. */
|
|
66
|
+
const NOT_RUN = "(not run)";
|
|
67
|
+
/** The detail a scope-filtered skip row carries; the marker the renderer buckets on. */
|
|
68
|
+
export const SCOPE_SKIP_DETAIL = "not run in this scope";
|
|
69
|
+
/** The detail prefix a CLI-gated skip row carries (the blocker follows it). */
|
|
70
|
+
export const SKIP_DETAIL_PREFIX = "skipped: ";
|
|
71
|
+
/**
|
|
72
|
+
* Every check id the doctor can emit — the CLI's whole probing surface,
|
|
73
|
+
* including the ids that only appear conditionally (`distro.present` for a
|
|
74
|
+
* configured-but-missing distro, `fix.git-trust` for a `--fix` run) and the
|
|
75
|
+
* `tools.*` ids the optional-tool loop constructs. The itemized listing uses
|
|
76
|
+
* this to show the checks a scoped (quick or section) run did NOT execute as
|
|
77
|
+
* explicit `[SKIP]` rows instead of silently dropping them; the parity test
|
|
78
|
+
* in `test/wsl-doctor-tool.test.mjs` re-extracts the ids from the CLI source
|
|
79
|
+
* and fails when the catalog drifts. A full run carries no scope, so a
|
|
80
|
+
* conditional id whose trigger never fired (no distro is missing, no
|
|
81
|
+
* `--fix`) also surfaces there under the generic `no scope recorded`
|
|
82
|
+
* reason — for those ids the honest reading is "did not fire", not
|
|
83
|
+
* "out of scope".
|
|
84
|
+
*/
|
|
85
|
+
export const CHECK_CATALOG = [
|
|
86
|
+
"agent.arch",
|
|
87
|
+
"agent.cache",
|
|
88
|
+
"agent.handshake",
|
|
89
|
+
"agent.native",
|
|
90
|
+
"config.deprecated",
|
|
91
|
+
"config.effective",
|
|
92
|
+
"config.preset-trap",
|
|
93
|
+
"config.profiles",
|
|
94
|
+
"config.wslconfig",
|
|
95
|
+
"distro.clock",
|
|
96
|
+
"distro.disk",
|
|
97
|
+
"distro.dns",
|
|
98
|
+
"distro.family",
|
|
99
|
+
"distro.home",
|
|
100
|
+
"distro.kernel",
|
|
101
|
+
"distro.present",
|
|
102
|
+
"distro.reachable",
|
|
103
|
+
"distro.shell",
|
|
104
|
+
"distro.wsl-conf-automount",
|
|
105
|
+
"distro.wsl-conf-boot",
|
|
106
|
+
"distro.wsl-conf-interop",
|
|
107
|
+
"distro.wsl-mode",
|
|
108
|
+
"fix.git-trust",
|
|
109
|
+
"functional.exec",
|
|
110
|
+
"functional.fs",
|
|
111
|
+
"functional.sandbox",
|
|
112
|
+
"git.win-safe",
|
|
113
|
+
"host.distros",
|
|
114
|
+
"host.windows",
|
|
115
|
+
"host.wsl",
|
|
116
|
+
"peers.versions",
|
|
117
|
+
"runtime.scopes",
|
|
118
|
+
"sandbox.bwrap",
|
|
119
|
+
"sandbox.bwrap-usable",
|
|
120
|
+
"session.linger",
|
|
121
|
+
"session.systemd",
|
|
122
|
+
"session.systemd-run",
|
|
123
|
+
"session.user-manager",
|
|
124
|
+
"tools.git",
|
|
125
|
+
"tools.inotifywait",
|
|
126
|
+
"tools.rg",
|
|
127
|
+
"update.latest",
|
|
128
|
+
];
|
|
41
129
|
/**
|
|
42
130
|
* Digest one doctor report down to what the model acts on: the verdict, the
|
|
43
|
-
* blockers,
|
|
131
|
+
* blockers, every failing check with its copy-paste remedy, and the
|
|
132
|
+
* per-section tallies that make the passed checks visible (a bare verdict
|
|
133
|
+
* says nothing about what was tested — the sections do). Warnings and
|
|
44
134
|
* skipped legs count but do not list — the report's own ids name them when
|
|
45
135
|
* the model asks.
|
|
46
136
|
* @param report - the collected (and live-merged) doctor report.
|
|
137
|
+
* @param sessionDistro - the distro this session runs in, when known; the
|
|
138
|
+
* matching tally is flagged so the rendered summary can name it.
|
|
47
139
|
* @returns the digest.
|
|
48
140
|
*/
|
|
49
|
-
export function digestReport(report) {
|
|
141
|
+
export function digestReport(report, sessionDistro) {
|
|
50
142
|
const checks = report.checks ?? [];
|
|
51
143
|
const failing = checks
|
|
52
144
|
.filter((check) => check.status === "fail")
|
|
@@ -54,42 +146,197 @@ export function digestReport(report) {
|
|
|
54
146
|
id: check.id,
|
|
55
147
|
detail: check.detail ?? "",
|
|
56
148
|
remedy: check.remedy === undefined || check.remedy.length === 0 ? "no remedy — see docs/DIAGNOSTICS.md" : check.remedy,
|
|
149
|
+
...(check.distro === undefined ? {} : { distro: check.distro }),
|
|
57
150
|
}));
|
|
58
151
|
const blockers = report.blockers ?? failing.map((check) => check.id);
|
|
59
152
|
const verdict = report.verdict ?? (blockers.length === 0 ? "ready" : "blocked");
|
|
60
153
|
const warningCount = report.summary?.warn ?? checks.filter((check) => check.status === "warn").length;
|
|
61
154
|
const skippedCount = report.summary?.skipped ?? checks.filter((check) => check.status === "skipped").length;
|
|
155
|
+
const sections = SECTIONS
|
|
156
|
+
.map((section) => {
|
|
157
|
+
const rows = checks.filter((check) => sectionOf(check.id) === section && check.status !== "skipped");
|
|
158
|
+
const count = (status) => rows.filter((check) => check.status === status).length;
|
|
159
|
+
return {
|
|
160
|
+
section,
|
|
161
|
+
ok: count("ok"),
|
|
162
|
+
warn: count("warn"),
|
|
163
|
+
fail: count("fail"),
|
|
164
|
+
unknown: count("unknown"),
|
|
165
|
+
};
|
|
166
|
+
})
|
|
167
|
+
.filter((tally) => tally.ok + tally.warn + tally.fail + tally.unknown > 0);
|
|
168
|
+
// Per-distro tallies in first-appearance order. Host-wide checks carry no
|
|
169
|
+
// distro and group under "(host)" so the summary stays complete.
|
|
170
|
+
const distroVerdictByName = new Map(report.distroVerdicts?.map((row) => [row.name, row.verdict]) ?? []);
|
|
171
|
+
const distroMap = new Map();
|
|
172
|
+
for (const check of checks) {
|
|
173
|
+
const name = check.distro ?? "(host)";
|
|
174
|
+
let tally = distroMap.get(name);
|
|
175
|
+
if (tally === undefined) {
|
|
176
|
+
tally = { name, ok: 0, warn: 0, fail: 0, unknown: 0, info: 0, skipped: 0 };
|
|
177
|
+
distroMap.set(name, tally);
|
|
178
|
+
}
|
|
179
|
+
if (check.status === "ok")
|
|
180
|
+
tally.ok += 1;
|
|
181
|
+
else if (check.status === "warn")
|
|
182
|
+
tally.warn += 1;
|
|
183
|
+
else if (check.status === "fail")
|
|
184
|
+
tally.fail += 1;
|
|
185
|
+
else if (check.status === "unknown")
|
|
186
|
+
tally.unknown += 1;
|
|
187
|
+
else if (check.status === "info")
|
|
188
|
+
tally.info += 1;
|
|
189
|
+
else if (check.status === "skipped")
|
|
190
|
+
tally.skipped += 1;
|
|
191
|
+
}
|
|
192
|
+
const distros = [...distroMap.values()].map((tally) => {
|
|
193
|
+
const verdict = distroVerdictByName.get(tally.name);
|
|
194
|
+
return {
|
|
195
|
+
...tally,
|
|
196
|
+
...(sessionDistro !== undefined && tally.name === sessionDistro ? { session: true } : {}),
|
|
197
|
+
...(verdict === undefined ? {} : { verdict }),
|
|
198
|
+
};
|
|
199
|
+
});
|
|
62
200
|
return {
|
|
63
201
|
verdict,
|
|
64
202
|
blockers,
|
|
65
203
|
failing,
|
|
66
204
|
warningCount,
|
|
67
205
|
skippedCount,
|
|
206
|
+
sections,
|
|
207
|
+
distros,
|
|
208
|
+
items: (() => {
|
|
209
|
+
const rows = checks.map((check) => ({
|
|
210
|
+
id: check.id,
|
|
211
|
+
title: check.title ?? check.id,
|
|
212
|
+
status: check.status,
|
|
213
|
+
detail: check.detail ?? "",
|
|
214
|
+
...(check.distro === undefined ? {} : { distro: check.distro }),
|
|
215
|
+
...(check.remedy === undefined || check.remedy.length === 0
|
|
216
|
+
? check.status === "fail" ? { remedy: "no remedy — see docs/DIAGNOSTICS.md" } : {}
|
|
217
|
+
: { remedy: check.remedy }),
|
|
218
|
+
}));
|
|
219
|
+
// Scope the listing never drops silently: every catalog id the report
|
|
220
|
+
// did not carry joins the items as an explicit skip row, so a quick or
|
|
221
|
+
// section-scoped answer still shows the full check surface.
|
|
222
|
+
const reported = new Set(checks.map((check) => check.id));
|
|
223
|
+
for (const id of CHECK_CATALOG) {
|
|
224
|
+
if (reported.has(id))
|
|
225
|
+
continue;
|
|
226
|
+
rows.push({ id, title: id, status: "skipped", detail: SCOPE_SKIP_DETAIL, distro: NOT_RUN });
|
|
227
|
+
}
|
|
228
|
+
return rows;
|
|
229
|
+
})(),
|
|
230
|
+
...(report.scope === undefined ? {} : { scope: report.scope }),
|
|
68
231
|
distroVerdicts: report.distroVerdicts ?? [],
|
|
69
232
|
note: verdict === "ready"
|
|
70
|
-
? "
|
|
71
|
-
: "
|
|
233
|
+
? t("doctorDigestNoteReady", {})
|
|
234
|
+
: t("doctorDigestNoteBlocked", {}),
|
|
72
235
|
};
|
|
73
236
|
}
|
|
74
237
|
/**
|
|
75
|
-
* Render the digest as the tool's text output
|
|
76
|
-
*
|
|
77
|
-
*
|
|
238
|
+
* Render the digest as the tool's text output, in the style of a regular
|
|
239
|
+
* diagnostic tool: one verdict line, then an itemized listing — every check
|
|
240
|
+
* the report carried, grouped by distro, each with an explicit status marker
|
|
241
|
+
* (`[OK]` / `[WARN]` / `[FAIL]` / `[INFO]` / `[SKIP]` / `[??]`), its name and
|
|
242
|
+
* what it found. A failed check carries its copy-paste remedy on the next
|
|
243
|
+
* line; a warned check carries its detail, which is already the remedy's
|
|
244
|
+
* context. The model narrates this; keeping it plain text keeps the
|
|
245
|
+
* transcript readable.
|
|
78
246
|
* @param digest - the digested report.
|
|
79
247
|
* @returns the multi-line text.
|
|
80
248
|
*/
|
|
81
249
|
export function renderDigest(digest) {
|
|
82
|
-
const lines = [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
250
|
+
const lines = [t("doctorDigestVerdict", { verdict: digest.verdict.toUpperCase() })];
|
|
251
|
+
const mark = (status) => {
|
|
252
|
+
if (status === "ok")
|
|
253
|
+
return "[ OK ]";
|
|
254
|
+
if (status === "warn")
|
|
255
|
+
return "[WARN]";
|
|
256
|
+
if (status === "fail")
|
|
257
|
+
return "[FAIL]";
|
|
258
|
+
if (status === "info")
|
|
259
|
+
return "[INFO]";
|
|
260
|
+
if (status === "skipped")
|
|
261
|
+
return "[SKIP]";
|
|
262
|
+
return "[ ?? ]";
|
|
263
|
+
};
|
|
264
|
+
// Group the itemized listing by distro in first-appearance order; the
|
|
265
|
+
// session distro is labeled so the reader knows which group is "here".
|
|
266
|
+
const sessionName = digest.distros.find((tally) => tally.session)?.name;
|
|
267
|
+
const groups = [];
|
|
268
|
+
for (const item of digest.items) {
|
|
269
|
+
const name = item.distro ?? "(host)";
|
|
270
|
+
let group = groups.find((entry) => entry.name === name);
|
|
271
|
+
if (group === undefined) {
|
|
272
|
+
group = { name, items: [] };
|
|
273
|
+
groups.push(group);
|
|
274
|
+
}
|
|
275
|
+
group.items.push(item);
|
|
276
|
+
}
|
|
277
|
+
for (const group of groups) {
|
|
278
|
+
const tally = digest.distros.find((entry) => entry.name === group.name);
|
|
279
|
+
const label = group.name === "(host)"
|
|
280
|
+
? t("doctorDigestHostLabel", {})
|
|
281
|
+
: group.name === NOT_RUN
|
|
282
|
+
? t("doctorDigestNotRunLabel", {})
|
|
283
|
+
: sessionName !== undefined && group.name === sessionName ? t("doctorDigestSessionLabel", { name: group.name }) : group.name;
|
|
284
|
+
lines.push("", `== ${label} =`);
|
|
285
|
+
// Skip rows carry no actionable content — one summary line per group
|
|
286
|
+
// instead of one row per check, so the checks that actually ran keep
|
|
287
|
+
// the reader's attention. Two distinct reasons share the bucket and must
|
|
288
|
+
// not blur: out-of-scope checks (the run's profile never touched them)
|
|
289
|
+
// collapse into one line that names the scope's shape, while a failed
|
|
290
|
+
// prerequisite's gated smoke legs keep one line each — their blocker is
|
|
291
|
+
// the actionable fact.
|
|
292
|
+
const skipped = group.items.filter((item) => item.status === "skipped");
|
|
293
|
+
const scoped = skipped.filter((item) => item.detail === SCOPE_SKIP_DETAIL);
|
|
294
|
+
const gated = skipped.filter((item) => item.detail !== SCOPE_SKIP_DETAIL);
|
|
295
|
+
for (const item of group.items) {
|
|
296
|
+
if (item.status === "skipped")
|
|
297
|
+
continue;
|
|
298
|
+
const name = item.title === item.id ? item.id : `${item.id} — ${item.title}`;
|
|
299
|
+
lines.push(`${mark(item.status)} ${name}${item.detail.length > 0 ? `: ${item.detail}` : ""}`);
|
|
300
|
+
if (item.status === "fail" && item.remedy !== undefined && item.remedy.length > 0) {
|
|
301
|
+
lines.push(t("doctorDigestFixPrefix", { remedy: item.remedy }));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (scoped.length > 0) {
|
|
305
|
+
const reason = digest.scope === undefined
|
|
306
|
+
? t("doctorSkipReasonGeneric", {})
|
|
307
|
+
: digest.scope.quick
|
|
308
|
+
? t("doctorSkipReasonQuick", {})
|
|
309
|
+
: t("doctorSkipReasonSections", { sections: digest.scope.sections.join(", ") });
|
|
310
|
+
lines.push(t("doctorDigestSkipRow", { n: scoped.length, reason, ids: scoped.map((item) => item.id).join(", ") }));
|
|
311
|
+
}
|
|
312
|
+
for (const item of gated) {
|
|
313
|
+
const detail = item.detail.startsWith(SKIP_DETAIL_PREFIX) ? item.detail.slice(SKIP_DETAIL_PREFIX.length) : item.detail;
|
|
314
|
+
lines.push(t("doctorSkipGated", { id: item.id, reason: detail }));
|
|
315
|
+
}
|
|
316
|
+
if (tally !== undefined) {
|
|
317
|
+
const counts = [];
|
|
318
|
+
if (tally.ok > 0)
|
|
319
|
+
counts.push(t("doctorTallyOk", { n: tally.ok }));
|
|
320
|
+
if (tally.warn > 0)
|
|
321
|
+
counts.push(t("doctorTallyWarn", { n: tally.warn }));
|
|
322
|
+
if (tally.fail > 0)
|
|
323
|
+
counts.push(t("doctorTallyFail", { n: tally.fail }));
|
|
324
|
+
if (tally.unknown > 0)
|
|
325
|
+
counts.push(t("doctorTallyUnknown", { n: tally.unknown }));
|
|
326
|
+
if (tally.info > 0)
|
|
327
|
+
counts.push(t("doctorTallyInfo", { n: tally.info }));
|
|
328
|
+
if (tally.skipped > 0)
|
|
329
|
+
counts.push(t("doctorTallySkipped", { n: tally.skipped }));
|
|
330
|
+
if (counts.length > 0)
|
|
331
|
+
lines.push(`-- ${counts.join(", ")}`);
|
|
332
|
+
}
|
|
87
333
|
}
|
|
334
|
+
const blockers = digest.failing.map((check) => check.distro !== undefined && digest.distros.length > 1 ? `${check.distro}/${check.id}` : check.id);
|
|
88
335
|
if (digest.failing.length === 0) {
|
|
89
|
-
lines.push(digest.note);
|
|
336
|
+
lines.push("", digest.note);
|
|
90
337
|
}
|
|
91
338
|
else {
|
|
92
|
-
lines.push(
|
|
339
|
+
lines.push("", t("doctorDigestBlockedTail", { blockers: blockers.join(", "), warnings: digest.warningCount, skipped: digest.skippedCount, note: digest.note }));
|
|
93
340
|
}
|
|
94
341
|
return lines.join("\n");
|
|
95
342
|
}
|
|
@@ -125,11 +372,23 @@ async function doctorCollector(ctx) {
|
|
|
125
372
|
export async function apply(ctx) {
|
|
126
373
|
ctx.tools.register(defineTool({
|
|
127
374
|
name: "wsl_doctor",
|
|
128
|
-
description: "Run the WSL environment doctor for this session's distro and return the verdict: ready (the first command should succeed), or blocked with per-failure copy-paste remedies.
|
|
129
|
-
parameters: {
|
|
375
|
+
description: "Run the WSL environment doctor for this session's distro and return the verdict: ready (the first command should succeed), or blocked with per-failure copy-paste remedies. Interactive by design: start with depth \"quick\" (prerequisites only, ~10 s) and narrate the result, then narrow with \"section\" (one of host/sandbox/session/conf/net/agent) or run depth \"full\" only when the user asked for a complete diagnosis — each call probes its scope and itemizes every check it tested with an explicit status marker, grouped by distro.",
|
|
376
|
+
parameters: {
|
|
377
|
+
distro: {
|
|
130
378
|
type: "string",
|
|
131
379
|
description: "Distro to examine. Omit to examine this session's own distro.",
|
|
132
|
-
}
|
|
380
|
+
},
|
|
381
|
+
depth: {
|
|
382
|
+
type: "string",
|
|
383
|
+
enum: ["quick", "full"],
|
|
384
|
+
description: "quick (default): prerequisites only (~10 s) — the right first call. full: every check including the agent smokes and the registry update query — pass it only when the user asked for a complete diagnosis.",
|
|
385
|
+
},
|
|
386
|
+
section: {
|
|
387
|
+
type: "string",
|
|
388
|
+
enum: ["host", "sandbox", "session", "conf", "net", "agent"],
|
|
389
|
+
description: "Restrict the run to one section for a focused follow-up (e.g. session to re-check systemd/linger after a fix). Overrides depth.",
|
|
390
|
+
},
|
|
391
|
+
},
|
|
133
392
|
output: {
|
|
134
393
|
schema: {
|
|
135
394
|
type: "object",
|
|
@@ -137,13 +396,14 @@ export async function apply(ctx) {
|
|
|
137
396
|
properties: {
|
|
138
397
|
verdict: { type: "string", required: true, description: "ready or blocked." },
|
|
139
398
|
blockers: { type: "string", required: true, description: "Comma-separated blocking check ids; empty when ready." },
|
|
140
|
-
|
|
399
|
+
report: { type: "string", required: true, description: "Itemized per-check listing grouped by distro — each check with an explicit [OK]/[WARN]/[FAIL] status marker, what it found, and the copy-paste fix for every failure." },
|
|
141
400
|
},
|
|
142
401
|
},
|
|
143
|
-
render: (_args, value) => [{ type: "text", text: value.
|
|
402
|
+
render: (_args, value) => [{ type: "text", text: value.report }],
|
|
144
403
|
},
|
|
145
404
|
async execute(args, exec) {
|
|
146
|
-
|
|
405
|
+
const argv = args;
|
|
406
|
+
let distro = argv.distro ?? "";
|
|
147
407
|
if (distro.length === 0) {
|
|
148
408
|
if (exec.agent === undefined)
|
|
149
409
|
throw new Error("wsl_doctor requires an agent Session (or an explicit distro)");
|
|
@@ -153,9 +413,11 @@ export async function apply(ctx) {
|
|
|
153
413
|
if (distro.length === 0) {
|
|
154
414
|
throw new Error("wsl_doctor could not resolve the session's distro from its working directory — pass one explicitly");
|
|
155
415
|
}
|
|
416
|
+
const quick = argv.section === undefined || argv.section.length === 0 ? argv.depth !== "full" : false;
|
|
417
|
+
const sections = argv.section !== undefined && argv.section.length > 0 ? [argv.section] : undefined;
|
|
156
418
|
const doctor = await doctorCollector(ctx);
|
|
157
|
-
const digest = digestReport(await doctor(distro));
|
|
158
|
-
return { verdict: digest.verdict, blockers: digest.blockers.join(", "),
|
|
419
|
+
const digest = digestReport(await doctor(distro, { ...(quick ? { quick: true } : {}), ...(sections !== undefined ? { sections } : {}) }), distro);
|
|
420
|
+
return { verdict: digest.verdict, blockers: digest.blockers.join(", "), report: renderDigest(digest) };
|
|
159
421
|
}
|
|
160
422
|
}));
|
|
161
423
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app": "dsh-plugin-wsl-env doctor",
|
|
3
|
+
"mark.ok": "ok ",
|
|
4
|
+
"mark.warn": "warn",
|
|
5
|
+
"mark.fail": "fail",
|
|
6
|
+
"mark.skipped": "skip",
|
|
7
|
+
"mark.unknown": "unkn",
|
|
8
|
+
"mark.info": "info",
|
|
9
|
+
"summary": "{ok} ok, {warn} warn, {fail} fail, {info} info",
|
|
10
|
+
"summary.skipped": ", {n} skipped",
|
|
11
|
+
"summary.unknown": ", {n} unknown (transport flakes — rerun for a verdict)",
|
|
12
|
+
"timings": "timings: {line}; total {total}ms",
|
|
13
|
+
"verdict.ready.none": "verdict: READY — the first command should succeed",
|
|
14
|
+
"verdict.ready.one": "verdict: READY — the first command should succeed in {target}",
|
|
15
|
+
"verdict.ready.many": "verdict: READY — the first command should succeed in each of: {targets}",
|
|
16
|
+
"verdict.blocked": "verdict: BLOCKED by: {blockers} — apply the fixes above, then rerun",
|
|
17
|
+
"fix.prefix": " fix: {remedy}",
|
|
18
|
+
"fix.hint": "run with --fix to sweep stale scopes; --fix --install asks before installing packages",
|
|
19
|
+
"sessions.title": "sessions across running distros",
|
|
20
|
+
"sessions.none": " (none)",
|
|
21
|
+
"sessions.no-user-manager": "no user manager — scopes unavailable",
|
|
22
|
+
"sessions.no-scopes": "no session scopes",
|
|
23
|
+
"ports.title": "listening ports in {distro}",
|
|
24
|
+
"ports.none": "\nno listening ports in the running distros",
|
|
25
|
+
"bundle.written": "bundle: written to {path} ({bytes} bytes{redacted})",
|
|
26
|
+
"bundle.redacted": ", redacted",
|
|
27
|
+
"refusal.read-only": "doctor: --read-only refuses --fix/--install; run `pnpm run doctor --fix` instead",
|
|
28
|
+
"refusal.scoped-fix": "doctor: --fix needs a full run — a scoped run cannot re-verify what it did not probe",
|
|
29
|
+
"confirm.install": "Install {packages} in \"{distro}\" as root?"
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app": "dsh-plugin-wsl-env 环境诊断",
|
|
3
|
+
"mark.ok": "通过",
|
|
4
|
+
"mark.warn": "警告",
|
|
5
|
+
"mark.fail": "失败",
|
|
6
|
+
"mark.skipped": "跳过",
|
|
7
|
+
"mark.unknown": "未知",
|
|
8
|
+
"mark.info": "信息",
|
|
9
|
+
"summary": "通过 {ok},警告 {warn},失败 {fail},信息 {info}",
|
|
10
|
+
"summary.skipped": ",跳过 {n}",
|
|
11
|
+
"summary.unknown": ",未知 {n}(传输抖动——重跑以获得裁决)",
|
|
12
|
+
"timings": "耗时: {line};总计 {total}ms",
|
|
13
|
+
"verdict.ready.none": "裁决: READY——首条命令应能成功",
|
|
14
|
+
"verdict.ready.one": "裁决: READY——首条命令应能在 {target} 中成功",
|
|
15
|
+
"verdict.ready.many": "裁决: READY——首条命令应能在以下每个 distro 中成功: {targets}",
|
|
16
|
+
"verdict.blocked": "裁决: BLOCKED——阻断项: {blockers};先应用上方的修复,再重跑",
|
|
17
|
+
"fix.prefix": " 修复: {remedy}",
|
|
18
|
+
"fix.hint": "加 --fix 清扫残留 scope;--fix --install 安装软件包前会先询问",
|
|
19
|
+
"sessions.title": "正在运行的 distro 会话",
|
|
20
|
+
"sessions.none": " (无)",
|
|
21
|
+
"sessions.no-user-manager": "无用户管理器——scope 不可用",
|
|
22
|
+
"sessions.no-scopes": "无会话 scope",
|
|
23
|
+
"ports.title": "{distro} 中的监听端口",
|
|
24
|
+
"ports.none": "\n正在运行的 distro 中没有监听端口",
|
|
25
|
+
"bundle.written": "bundle: 已写入 {path}({bytes} 字节{redacted})",
|
|
26
|
+
"bundle.redacted": ",已脱敏",
|
|
27
|
+
"refusal.read-only": "doctor: --read-only 拒绝 --fix/--install;请改用 `pnpm run doctor --fix`",
|
|
28
|
+
"refusal.scoped-fix": "doctor: --fix 需要完整运行——分区运行无法复核未探测的项目",
|
|
29
|
+
"confirm.install": "以 root 在 \"{distro}\" 中安装 {packages}?"
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-wsl-env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "在 WSL 的 Linux 实例中打开项目工作区,在对应 Linux 空间中进行命令执行、运行 shell 脚本和文件访问,以获得全套 Linux Shell 工具链收益,并通过 bubblewrap 对命令进行沙箱隔离",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
"types": "./lib/wsl-doctor-tool.d.ts",
|
|
45
45
|
"default": "./lib/wsl-doctor-tool.js"
|
|
46
46
|
},
|
|
47
|
+
"./wsl-doctor-command": {
|
|
48
|
+
"types": "./lib/wsl-doctor-command.d.ts",
|
|
49
|
+
"default": "./lib/wsl-doctor-command.js"
|
|
50
|
+
},
|
|
47
51
|
"./client": {
|
|
48
52
|
"types": "./client.d.ts",
|
|
49
53
|
"default": "./client.js"
|
|
@@ -179,9 +183,9 @@
|
|
|
179
183
|
"lint:types": "tsc --noEmit",
|
|
180
184
|
"build": "node scripts/build.mjs",
|
|
181
185
|
"lint:build": "node test/build-freshness.mjs",
|
|
182
|
-
"test:coverage": "node scripts/coverage-gate.mjs -- node --test --test-timeout=60000 --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=84 --test-coverage-functions=70 --test-coverage-exclude='scripts/**' --test-coverage-exclude='test/**' test/agent-exec.test.mjs test/agent-fs-script.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/fs-substrate.test.mjs test/fs.boot.test.mjs test/composition.test.mjs test/provider.test.mjs test/file-reference-wsl.test.mjs test/fsio-agent.test.mjs test/fsio-text.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/listing.test.mjs test/paths.test.mjs test/ports.test.mjs test/preset-choice.test.mjs test/probe-cache.test.mjs test/preflight.test.mjs test/sandbox.test.mjs test/search-exec.test.mjs test/search-route.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal-activity.test.mjs test/terminal.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/update-check.test.mjs test/doctor.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs test/cwd-prompt.test.mjs test/cwd-prompt-tool.test.mjs test/wsl-doctor-tool.test.mjs test/wsl-doctor-
|
|
186
|
+
"test:coverage": "node scripts/coverage-gate.mjs -- node --test --test-timeout=60000 --experimental-test-coverage --test-coverage-lines=85 --test-coverage-branches=84 --test-coverage-functions=70 --test-coverage-exclude='scripts/**' --test-coverage-exclude='test/**' test/agent-exec.test.mjs test/agent-fs-script.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/fs-substrate.test.mjs test/fs.boot.test.mjs test/composition.test.mjs test/provider.test.mjs test/file-reference-wsl.test.mjs test/fsio-agent.test.mjs test/fsio-text.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/listing.test.mjs test/paths.test.mjs test/ports.test.mjs test/preset-choice.test.mjs test/probe-cache.test.mjs test/preflight.test.mjs test/sandbox.test.mjs test/search-exec.test.mjs test/search-route.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal-activity.test.mjs test/terminal.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/update-check.test.mjs test/doctor.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs test/cwd-prompt.test.mjs test/cwd-prompt-tool.test.mjs test/wsl-doctor-tool.test.mjs test/wsl-doctor-command.test.mjs test/client-host.test.mjs test/messages.test.mjs",
|
|
183
187
|
"test:syntax": "node test/syntax.mjs",
|
|
184
|
-
"test:unit": "node scripts/test-watchdog.mjs -- node --test --test-timeout=60000 test/fs.boot.test.mjs test/fsio-text.test.mjs test/composition.test.mjs test/provider.test.mjs test/file-reference-wsl.test.mjs test/paths.test.mjs test/listing.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal.test.mjs test/probe-cache.test.mjs test/preflight.test.mjs test/preset-choice.test.mjs test/sandbox.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/agent-fs-script.test.mjs test/fsio-agent.test.mjs test/fs-substrate.test.mjs test/agent-exec.test.mjs test/ports.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/search-route.test.mjs test/search-exec.test.mjs test/terminal-activity.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/update-check.test.mjs test/doctor.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs test/cwd-prompt.test.mjs test/cwd-prompt-tool.test.mjs test/wsl-doctor-tool.test.mjs test/wsl-doctor-
|
|
188
|
+
"test:unit": "node scripts/test-watchdog.mjs -- node --test --test-timeout=60000 test/fs.boot.test.mjs test/fsio-text.test.mjs test/composition.test.mjs test/provider.test.mjs test/file-reference-wsl.test.mjs test/paths.test.mjs test/listing.test.mjs test/shell.test.mjs test/shell-env.test.mjs test/terminal.test.mjs test/probe-cache.test.mjs test/preflight.test.mjs test/preset-choice.test.mjs test/sandbox.test.mjs test/agent-protocol.test.mjs test/agent.test.mjs test/agent-fs-script.test.mjs test/fsio-agent.test.mjs test/fs-substrate.test.mjs test/agent-exec.test.mjs test/ports.test.mjs test/watcher.test.mjs test/wsl.test.mjs test/fs-decisions.test.mjs test/git-exec.test.mjs test/git-route.test.mjs test/search-route.test.mjs test/search-exec.test.mjs test/terminal-activity.test.mjs test/session-scope.test.mjs test/session-runtime.test.mjs test/native-agent.test.mjs test/peers.test.mjs test/agent-shared.test.mjs test/distro-route.test.mjs test/fs-routing.test.mjs test/update-check.test.mjs test/doctor.test.mjs test/profile-preset.test.mjs test/packaging.test.mjs test/peer-canary.test.mjs test/probe-runner.test.mjs test/cwd-prompt.test.mjs test/cwd-prompt-tool.test.mjs test/wsl-doctor-tool.test.mjs test/wsl-doctor-command.test.mjs test/client-host.test.mjs test/messages.test.mjs",
|
|
185
189
|
"lint:style": "node test/style.mjs",
|
|
186
190
|
"lint:links": "node scripts/check-links.mjs",
|
|
187
191
|
"lint:requirements": "node scripts/check-requirements.mjs",
|