dsh-plugin-wsl-env 0.7.5 → 0.9.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +345 -8
  2. package/CONTRIBUTING.md +221 -68
  3. package/README.md +50 -35
  4. package/SECURITY.md +18 -2
  5. package/SUPPORT.md +23 -7
  6. package/cordis.patch.yml +9 -0
  7. package/docs/ARCHITECTURE.md +200 -57
  8. package/docs/CONFIGURATION.md +180 -16
  9. package/docs/LIMITATIONS.md +91 -33
  10. package/docs/PARITY.md +66 -38
  11. package/docs/PEER-PARITY.md +95 -32
  12. package/docs/README.zh.md +49 -31
  13. package/docs/UPSTREAM-FSIO-EXPORT.md +159 -50
  14. package/docs/UPSTREAM-TERMINAL-TITLE.md +49 -14
  15. package/lib/agent-confined.d.ts +42 -0
  16. package/lib/agent-confined.js +25 -41
  17. package/lib/agent-errors.d.ts +31 -0
  18. package/lib/agent-errors.js +19 -16
  19. package/lib/agent-exec.d.ts +159 -0
  20. package/lib/agent-exec.js +151 -165
  21. package/lib/agent-protocol.d.ts +192 -0
  22. package/lib/agent-protocol.js +76 -100
  23. package/lib/agent-shared.d.ts +27 -0
  24. package/lib/agent-shared.js +12 -12
  25. package/lib/agent.d.ts +353 -0
  26. package/lib/agent.js +536 -552
  27. package/lib/auto-preset.d.ts +110 -0
  28. package/lib/auto-preset.js +157 -141
  29. package/lib/bwrap.d.ts +90 -0
  30. package/lib/bwrap.js +18 -18
  31. package/lib/file-reference-wsl.d.ts +160 -0
  32. package/lib/file-reference-wsl.js +192 -173
  33. package/lib/fs-decisions.d.ts +107 -0
  34. package/lib/fs-decisions.js +64 -60
  35. package/lib/fs-routing.d.ts +182 -0
  36. package/lib/fs-routing.js +173 -116
  37. package/lib/fs-substrate.d.ts +258 -0
  38. package/lib/fs-substrate.js +248 -248
  39. package/lib/fs.d.ts +10 -0
  40. package/lib/fs.js +5 -0
  41. package/lib/fsio-agent.d.ts +307 -0
  42. package/lib/fsio-agent.js +414 -410
  43. package/lib/fsio-text.d.ts +115 -0
  44. package/lib/fsio-text.js +104 -84
  45. package/lib/git-route.d.ts +100 -0
  46. package/lib/git-route.js +46 -47
  47. package/lib/index.d.ts +1003 -0
  48. package/lib/index.js +1106 -1003
  49. package/lib/listing.d.ts +114 -0
  50. package/lib/listing.js +68 -55
  51. package/lib/paths.d.ts +182 -0
  52. package/lib/paths.js +134 -109
  53. package/lib/picker.d.ts +266 -0
  54. package/lib/picker.js +371 -351
  55. package/lib/ports.d.ts +44 -0
  56. package/lib/ports.js +39 -29
  57. package/lib/preflight.d.ts +91 -0
  58. package/lib/preflight.js +94 -0
  59. package/lib/preset-choice.d.ts +33 -0
  60. package/lib/preset-choice.js +15 -7
  61. package/lib/probe-cache.d.ts +51 -0
  62. package/lib/probe-cache.js +43 -29
  63. package/lib/sandbox-core.d.ts +149 -0
  64. package/lib/sandbox-core.js +239 -87
  65. package/lib/sandbox.d.ts +48 -0
  66. package/lib/sandbox.js +4 -4
  67. package/lib/search-exec.d.ts +96 -0
  68. package/lib/search-exec.js +52 -79
  69. package/lib/search-route.d.ts +75 -0
  70. package/lib/search-route.js +30 -31
  71. package/lib/shell-env.d.ts +88 -0
  72. package/lib/shell-env.js +78 -74
  73. package/lib/shell.d.ts +10 -0
  74. package/lib/shell.js +5 -0
  75. package/lib/subprocess.d.ts +313 -0
  76. package/lib/subprocess.js +267 -262
  77. package/lib/terminal-activity.d.ts +98 -0
  78. package/lib/terminal-activity.js +29 -39
  79. package/lib/terminal-route.d.ts +27 -0
  80. package/lib/terminal-route.js +16 -8
  81. package/lib/watcher.d.ts +77 -0
  82. package/lib/watcher.js +120 -126
  83. package/lib/workspace-files-route.d.ts +132 -0
  84. package/lib/workspace-files-route.js +73 -81
  85. package/lib/workspace-files-wsl.d.ts +257 -0
  86. package/lib/workspace-files-wsl.js +311 -251
  87. package/lib/wsl.d.ts +266 -0
  88. package/lib/wsl.js +150 -155
  89. package/locale/preflight/en.json +6 -0
  90. package/locale/preflight/zh.json +6 -0
  91. package/package.json +78 -22
  92. package/scripts/diagnose.sh +92 -0
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env bash
2
+ # Collect a read-only diagnostic report for a bug report, in one command:
3
+ #
4
+ # pnpm run diagnose -- [distro] # distro optional; default distro otherwise
5
+ #
6
+ # Prints versions and probe verdicts as plain text that can be pasted into an
7
+ # issue as-is. It runs NO installation, changes nothing in the distro, and reads
8
+ # nothing secret: the report is tool versions, a kernel release and probe
9
+ # verdicts. Exit code is always 0 — the report is informational; the verdict
10
+ # lines carry the failures.
11
+ #
12
+ # Deeper sandbox probing lives in `npm run probe:sandbox` (run inside the
13
+ # distro); this script answers "what is installed and does bwrap run at all".
14
+
15
+ set -u
16
+ export WSL_UTF8=1 # wsl.exe writes UTF-16LE without it; read as UTF-8 that is mojibake
17
+
18
+ DISTRO="${1:-}"
19
+
20
+ ok() { printf 'ok %s\n' "$1"; }
21
+ miss() { printf 'MISSING %s\n' "$1"; }
22
+ info() { printf 'info %s\n' "$1"; }
23
+ header(){ printf '\n== %s ==\n' "$1"; }
24
+
25
+ echo "# dsh-plugin-wsl-env diagnose report"
26
+
27
+ header "host"
28
+ winver="$(cmd.exe /c ver 2>/dev/null | tr -d '\r' | grep -o '[0-9][0-9.]*' | head -1)"
29
+ if [ -n "$winver" ]; then ok "windows build $winver"; else info "windows build unknown (cmd.exe not reachable through interop)"; fi
30
+ wsl_ver="$(wsl.exe --version 2>/dev/null | tr -d '\0\r' | head -2 | tr '\n' ' ')"
31
+ if [ -n "$wsl_ver" ]; then ok "wsl: $wsl_ver"; else info "wsl --version unsupported on this WSL build"; fi
32
+ wsl_status="$(wsl.exe --status 2>/dev/null | tr -d '\0\r' | tr '\n' ' ')"
33
+ [ -n "$wsl_status" ] && info "wsl status: $wsl_status"
34
+ wsl.exe -l -v 2>/dev/null | tr -d '\0\r' | grep -v '^$' | sed 's/^/ /'
35
+
36
+ header "plugin"
37
+ echo " plugin version: $(node -p "require('./package.json').version" 2>/dev/null || echo unknown)"
38
+ echo " dsh version: $(dsh --version 2>/dev/null || echo unknown)"
39
+
40
+ if [ -z "$DISTRO" ]; then
41
+ DISTRO="$(wsl.exe -l -q 2>/dev/null | tr -d '\0\r' | grep -v '^$' | head -1)"
42
+ fi
43
+ if [ -z "$DISTRO" ]; then
44
+ header "distro"
45
+ miss "no distro installed — 'wsl.exe --list --online' lists names, 'wsl --install -d <name>' installs one"
46
+ exit 0
47
+ fi
48
+
49
+ header "distro: $DISTRO"
50
+ in_distro() { wsl.exe -d "$DISTRO" --exec sh -c "$1" 2>/dev/null; }
51
+
52
+ info "kernel: $(in_distro 'uname -r')"
53
+ family="$(in_distro 'for m in apt-get dnf pacman zypper; do command -v $m && break; done' | tr -d '\r')"
54
+ case "$family" in
55
+ *apt-get) info "package family: apt" ;;
56
+ *dnf) info "package family: dnf" ;;
57
+ *pacman) info "package family: pacman" ;;
58
+ *zypper) info "package family: zypper" ;;
59
+ *) info "package family: unknown" ;;
60
+ esac
61
+
62
+ for tool in bwrap rg git inotifywait; do
63
+ if in_distro "command -v $tool" | grep -q .; then
64
+ case "$tool" in
65
+ bwrap) ver="$(in_distro 'bwrap --version' | tr -d '\r' | head -1)" ;;
66
+ rg) ver="$(in_distro 'rg --version' | tr -d '\r' | head -1)" ;;
67
+ git) ver="$(in_distro 'git --version' | tr -d '\r' | head -1)" ;;
68
+ inotifywait) ver="inotifywait (no version flag)" ;;
69
+ esac
70
+ ok "$ver"
71
+ else
72
+ case "$tool" in
73
+ bwrap) miss "bwrap — REQUIRED; every confined command fails closed without it. Install: wsl.exe -d $DISTRO -u root -- apt-get install -y bubblewrap (or: pnpm run bootstrap -- $DISTRO --install)" ;;
74
+ rg) miss "ripgrep — the search tool falls back to slower matching without it" ;;
75
+ git) miss "git — snapshot and diff baselines degrade without it" ;;
76
+ inotifywait) miss "inotify-tools — file watching falls back to polling without it" ;;
77
+ esac
78
+ fi
79
+ done
80
+
81
+ if in_distro 'command -v bwrap' | grep -q .; then
82
+ if in_distro 'bwrap --ro-bind / / -- true'; then
83
+ ok "bwrap runs a read-only profile (the usability probe passes)"
84
+ else
85
+ miss "bwrap is installed but FAILED the read-only profile probe — likely the kernel (unprivileged user namespaces disabled) or an unusable build; reinstalling will not help"
86
+ fi
87
+ fi
88
+
89
+ header "notes"
90
+ info "trace file: set DSH_WSL_TRACE=<path> to record the auto-preset decisions, then re-run the scenario"
91
+ info "paste this report into the issue's Output section; redact anything you would rather not publish"
92
+ exit 0