dsh-plugin-wsl-env 0.23.1 → 0.25.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 (77) hide show
  1. package/CHANGELOG.md +212 -0
  2. package/README.md +9 -5
  3. package/SECURITY.md +10 -0
  4. package/client.js +974 -165
  5. package/cordis.patch.yml +28 -3
  6. package/docs/API.md +2 -1
  7. package/docs/ARCHITECTURE.md +36 -13
  8. package/docs/COMPATIBILITY.md +5 -0
  9. package/docs/CONFIGURATION.md +80 -9
  10. package/docs/CONFIGURATION.zh.md +64 -8
  11. package/docs/DIAGNOSTICS.md +48 -20
  12. package/docs/DIAGNOSTICS.zh.md +36 -14
  13. package/docs/LIMITATIONS.md +36 -9
  14. package/docs/LIMITATIONS.zh.md +26 -7
  15. package/docs/MIGRATION.md +1 -1
  16. package/docs/PEER-PARITY.md +4 -4
  17. package/docs/QUICKSTART.md +42 -12
  18. package/docs/QUICKSTART.zh.md +29 -8
  19. package/docs/README.zh.md +9 -5
  20. package/docs/RELEASING.md +17 -13
  21. package/docs/REQUIREMENTS.zh.md +5 -4
  22. package/docs/UPSTREAM-FSIO-EXPORT.md +5 -4
  23. package/docs/UPSTREAM-PROMPT-ADAPTERS.md +85 -0
  24. package/docs/root-fs-routing.md +1 -1
  25. package/lib/agent-confined.d.ts +7 -1
  26. package/lib/agent-confined.js +3 -3
  27. package/lib/auto-preset.d.ts +27 -0
  28. package/lib/auto-preset.js +40 -3
  29. package/lib/bwrap.d.ts +14 -0
  30. package/lib/bwrap.js +11 -0
  31. package/lib/client-host.d.ts +2 -2
  32. package/lib/client-host.js +2 -2
  33. package/lib/cwd-prompt.d.ts +41 -3
  34. package/lib/cwd-prompt.js +125 -8
  35. package/lib/doctor-report.d.ts +50 -0
  36. package/lib/doctor-report.js +172 -0
  37. package/lib/fs-routing.d.ts +1 -1
  38. package/lib/fs-routing.js +1 -1
  39. package/lib/fs.d.ts +1 -1
  40. package/lib/fs.js +1 -1
  41. package/lib/index.d.ts +6 -1464
  42. package/lib/index.js +5 -2120
  43. package/lib/listing.d.ts +21 -9
  44. package/lib/listing.js +25 -21
  45. package/lib/messages.d.ts +1 -1
  46. package/lib/messages.js +3 -3
  47. package/lib/picker.d.ts +50 -16
  48. package/lib/picker.js +103 -23
  49. package/lib/preflight.d.ts +7 -4
  50. package/lib/preflight.js +27 -13
  51. package/lib/preset-choice.d.ts +22 -3
  52. package/lib/preset-choice.js +36 -3
  53. package/lib/provider-common.d.ts +58 -0
  54. package/lib/provider-common.js +123 -0
  55. package/lib/sandbox-core.d.ts +1 -0
  56. package/lib/sandbox-core.js +4 -2
  57. package/lib/session-runtime.d.ts +7 -1
  58. package/lib/session-runtime.js +9 -2
  59. package/lib/shell.d.ts +1 -1
  60. package/lib/shell.js +1 -1
  61. package/lib/status.d.ts +261 -0
  62. package/lib/status.js +425 -0
  63. package/lib/writable-roots.d.ts +109 -0
  64. package/lib/writable-roots.js +257 -0
  65. package/lib/wsl-doctor-tool.d.ts +8 -0
  66. package/lib/wsl-doctor-tool.js +18 -20
  67. package/lib/wsl-filesystem.d.ts +692 -0
  68. package/lib/wsl-filesystem.js +897 -0
  69. package/lib/wsl-shell.d.ts +742 -0
  70. package/lib/wsl-shell.js +965 -0
  71. package/lib/wsl.d.ts +13 -1
  72. package/lib/wsl.js +16 -1
  73. package/locale/doctor/en.json +3 -2
  74. package/locale/doctor/zh.json +3 -2
  75. package/package.json +12 -4
  76. package/scripts/doctor.mjs +436 -226
  77. package/scripts/profile-preset.mjs +17 -5
@@ -12,6 +12,7 @@
12
12
  *
13
13
  * node scripts/profile-preset.mjs [--distro Debian] [--session-sandbox false|auto]
14
14
  * [--sandbox false] [--mask-windows-drive true] [--agent-backend native]
15
+ * [--writable-roots '~/.npm,~/.cache']
15
16
  * [--out <profile/cordis.patch.yml>] [--check <file>] [--force]
16
17
  *
17
18
  * With no `--out`/`--check`, the block (with the edits) goes to stdout.
@@ -110,7 +111,7 @@ function setKey(lines, id, key, value) {
110
111
  /**
111
112
  * Apply the supported edits to a preset block.
112
113
  * @param {string} block - the block from {@link presetBlock}.
113
- * @param {{ distro?: string, sessionSandbox?: boolean | "auto", sandbox?: boolean, maskWindowsDrive?: boolean, agentBackend?: string }} edits - the edits.
114
+ * @param {{ distro?: string, sessionSandbox?: boolean | "auto", sandbox?: boolean, maskWindowsDrive?: boolean, agentBackend?: string, writableRoots?: string[] }} edits - the edits.
114
115
  * @returns {string} the edited block.
115
116
  */
116
117
  export function applyEdits(block, edits) {
@@ -127,18 +128,25 @@ export function applyEdits(block, edits) {
127
128
  setKey(lines, "wsl-fs", key, value);
128
129
  }
129
130
  if (edits.agentBackend !== undefined) setKey(lines, "wsl-shell", "agentBackend", edits.agentBackend);
131
+ if (edits.writableRoots !== undefined) {
132
+ // A flow sequence is valid YAML and keeps the helper's one-line-per-key
133
+ // edit shape; the rows themselves take a real list once the block is merged.
134
+ const value = JSON.stringify(edits.writableRoots);
135
+ setKey(lines, "wsl-shell", "writableRoots", value);
136
+ setKey(lines, "wsl-fs", "writableRoots", value);
137
+ }
130
138
  return lines.join("\n");
131
139
  }
132
140
 
133
141
  /**
134
142
  * Parse the helper's arguments.
135
143
  * @param {string[]} argv - `process.argv.slice(2)`.
136
- * @returns {{ edits: Record<string, string | boolean>, out?: string, check?: string, force: boolean }} the options.
144
+ * @returns {{ edits: Record<string, string | boolean | string[]>, out?: string, check?: string, force: boolean }} the options.
137
145
  */
138
146
  function parseArgs(argv) {
139
- /** @type {Record<string, string | boolean>} */
147
+ /** @type {Record<string, string | boolean | string[]>} */
140
148
  const edits = {};
141
- /** @type {{ edits: Record<string, string | boolean>, out?: string, check?: string, force: boolean }} */
149
+ /** @type {{ edits: Record<string, string | boolean | string[]>, out?: string, check?: string, force: boolean }} */
142
150
  const options = { edits, force: false };
143
151
  for (let i = 0; i < argv.length; i += 1) {
144
152
  const arg = argv[i] ?? "";
@@ -153,13 +161,17 @@ function parseArgs(argv) {
153
161
  else if (flag === "--agent-backend") {
154
162
  if (!["auto", "native", "shell"].includes(value)) throw new Error(`profile-preset: --agent-backend must be auto, native or shell (got "${value}")`);
155
163
  edits.agentBackend = value;
164
+ } else if (flag === "--writable-roots") {
165
+ const roots = value.split(",").map((root) => root.trim()).filter((root) => root.length > 0);
166
+ if (roots.length === 0) throw new Error("profile-preset: --writable-roots needs a comma-separated list of distro paths");
167
+ edits.writableRoots = roots;
156
168
  } else if (flag === "--out") options.out = value;
157
169
  else if (flag === "--check") options.check = value;
158
170
  else if (flag === "--force") {
159
171
  options.force = true;
160
172
  i -= 1;
161
173
  } else if (flag === "--help" || flag === "-h") {
162
- console.log("node scripts/profile-preset.mjs [--distro NAME] [--session-sandbox true|false|auto] [--sandbox true|false] [--mask-windows-drive true|false] [--agent-backend auto|native|shell] [--out FILE] [--check FILE] [--force]");
174
+ console.log("node scripts/profile-preset.mjs [--distro NAME] [--session-sandbox true|false|auto] [--sandbox true|false] [--mask-windows-drive true|false] [--agent-backend auto|native|shell] [--writable-roots 'PATH,...'] [--out FILE] [--check FILE] [--force]");
163
175
  process.exit(0);
164
176
  } else throw new Error(`profile-preset: unknown option "${arg}"`);
165
177
  }