dsh-plugin-wsl-env 0.26.1 → 0.26.2

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.
@@ -1509,23 +1509,31 @@ async function main(options) {
1509
1509
  }
1510
1510
 
1511
1511
  // ---- optional tools ------------------------------------------------------
1512
- // Feature-degradation warnings, not first-command prerequisites: the quick
1513
- // profile skips them (three process spawns a distro) and the full run names
1514
- // what each missing tool costs. None is a fallback-free break — a missing
1515
- // rg still leaves the model bash grep, a missing git still leaves
1516
- // file-tool edits, a missing inotifywait still polls.
1517
- if (!quick) {
1512
+ // Feature-degradation warnings, not first-command prerequisites. One
1513
+ // combined probe (one process a distro) runs them in the quick profile too,
1514
+ // so a missing rg is visible in the panel at startup instead of surfacing
1515
+ // as an opaque failure at the model's first grep/glob. None is a
1516
+ // fallback-free break — a missing rg still leaves bash grep, a missing git
1517
+ // still leaves file-tool edits, a missing inotifywait still polls.
1518
+ if (want("host")) {
1518
1519
  /** The optional tools, in the order users notice them losing. */
1519
1520
  /** @type {Array<[string, string]>} */
1520
- const optionalTools = [["rg", "the fs-search tool needs rg; the model can still run grep in a shell, slower"], ["git", "change review falls back to file-tool edits"], ["inotifywait", "the watcher falls back to polling"]];
1521
+ const optionalTools = [["rg", "the fs-search tool fails (exit 127); the model can still run grep in a shell, slower"], ["git", "change review falls back to file-tool edits"], ["inotifywait", "the watcher falls back to polling"]];
1522
+ // One `wsl.exe` for the set: every name is answered in the same shell, so
1523
+ // the quick profile pays one spawn, not three, for the full tool list.
1524
+ const toolAnswer = await probe(`for t in ${optionalTools.map(([tool]) => tool).join(" ")}; do if p=$(command -v "$t" 2>/dev/null); then printf 'found %s %s\\n' "$t" "$p"; else printf 'missing %s\\n' "$t"; fi; done`);
1525
+ /** @type {Map<string, string>} */
1526
+ const toolPaths = new Map();
1527
+ for (const line of toolAnswer.stdout.split(/\r?\n/)) {
1528
+ const match = /^(?:found|missing)\s+([a-z]+)(?:\s+(.*))?$/.exec(line.trim());
1529
+ if (match !== null && match[1] !== undefined) toolPaths.set(match[1], match[2] ?? "");
1530
+ }
1521
1531
  for (const [tool, cost] of optionalTools) {
1522
- const toolAnswer = await probe(`command -v ${tool}`);
1532
+ const found = toolPaths.get(tool);
1523
1533
  if (!toolAnswer.ok && toolAnswer.flaked) flakeCheck(`tools.${tool}`, tool, toolAnswer);
1524
- else {
1525
- const found = toolAnswer.stdout.trim();
1526
- if (found.length > 0) check(`tools.${tool}`, "ok", tool, found);
1527
- else check(`tools.${tool}`, "warn", tool, `missing; ${cost}`, install);
1528
- }
1534
+ else if (found === undefined) check(`tools.${tool}`, "info", tool, "the combined probe answered nothing for this tool, so this run cannot say whether it is installed");
1535
+ else if (found.length > 0) check(`tools.${tool}`, "ok", tool, found);
1536
+ else check(`tools.${tool}`, "warn", tool, `missing; ${cost}`, install);
1529
1537
  }
1530
1538
  }
1531
1539