dsh-plugin-wsl-env 0.24.0 → 0.26.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 (94) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/CODE_OF_CONDUCT.md +85 -0
  3. package/CODE_OF_CONDUCT.zh.md +85 -0
  4. package/CONTRIBUTING.md +19 -3
  5. package/CONTRIBUTING.zh.md +200 -0
  6. package/README.md +18 -6
  7. package/SECURITY.md +12 -0
  8. package/SECURITY.zh.md +108 -0
  9. package/SUPPORT.md +2 -0
  10. package/SUPPORT.zh.md +99 -0
  11. package/client.js +409 -8
  12. package/cordis.patch.yml +17 -0
  13. package/docs/AGENT-PROTOCOL-V7.md +2 -2
  14. package/docs/API.md +2 -0
  15. package/docs/API.zh.md +38 -0
  16. package/docs/ARCHITECTURE.md +30 -9
  17. package/docs/ARCHITECTURE.zh.md +511 -0
  18. package/docs/COMPATIBILITY.md +2 -0
  19. package/docs/COMPATIBILITY.zh.md +117 -0
  20. package/docs/CONFIGURATION.md +45 -2
  21. package/docs/CONFIGURATION.zh.md +39 -3
  22. package/docs/DIAGNOSTICS.md +12 -2
  23. package/docs/DIAGNOSTICS.zh.md +5 -1
  24. package/docs/LIMITATIONS.md +60 -9
  25. package/docs/LIMITATIONS.zh.md +45 -9
  26. package/docs/MIGRATION.md +6 -3
  27. package/docs/MIGRATION.zh.md +91 -0
  28. package/docs/PEER-PARITY.md +63 -51
  29. package/docs/PERFORMANCE.md +2 -0
  30. package/docs/PERFORMANCE.zh.md +59 -0
  31. package/docs/QUICKSTART.md +21 -6
  32. package/docs/QUICKSTART.zh.md +16 -4
  33. package/docs/README.zh.md +28 -19
  34. package/docs/RELEASING.md +19 -14
  35. package/docs/REQUIREMENTS.zh.md +6 -3
  36. package/docs/ROADMAP-1.0.md +1 -1
  37. package/docs/UPSTREAM-FILE-REFERENCE-SEAM.md +1 -1
  38. package/docs/UPSTREAM-FSIO-EXPORT.md +5 -4
  39. package/docs/UPSTREAM-OPEN-IN-APP.md +33 -11
  40. package/docs/UPSTREAM-PROMPT-ADAPTERS.md +85 -0
  41. package/docs/UPSTREAM-SESSION-NOTICE.md +7 -0
  42. package/docs/VALUE.md +146 -0
  43. package/docs/VALUE.zh.md +15 -13
  44. package/docs/root-fs-routing.md +1 -1
  45. package/lib/agent-confined.d.ts +7 -1
  46. package/lib/agent-confined.js +3 -3
  47. package/lib/auto-preset-seam.d.ts +45 -0
  48. package/lib/auto-preset-seam.js +47 -0
  49. package/lib/auto-preset.d.ts +33 -10
  50. package/lib/auto-preset.js +148 -44
  51. package/lib/bwrap.d.ts +14 -0
  52. package/lib/bwrap.js +11 -0
  53. package/lib/cwd-prompt.d.ts +41 -3
  54. package/lib/cwd-prompt.js +125 -8
  55. package/lib/doctor-live.d.ts +30 -0
  56. package/lib/doctor-live.js +37 -0
  57. package/lib/doctor-report.d.ts +50 -0
  58. package/lib/doctor-report.js +172 -0
  59. package/lib/fs-routing.d.ts +1 -1
  60. package/lib/fs-routing.js +1 -1
  61. package/lib/fs.d.ts +1 -1
  62. package/lib/fs.js +1 -1
  63. package/lib/index.d.ts +6 -1464
  64. package/lib/index.js +5 -2120
  65. package/lib/messages.d.ts +20 -1
  66. package/lib/messages.js +31 -3
  67. package/lib/open-in-app.d.ts +206 -0
  68. package/lib/open-in-app.js +300 -0
  69. package/lib/preflight.d.ts +7 -4
  70. package/lib/preflight.js +27 -13
  71. package/lib/preset-choice.d.ts +13 -0
  72. package/lib/preset-choice.js +18 -1
  73. package/lib/provider-common.d.ts +58 -0
  74. package/lib/provider-common.js +123 -0
  75. package/lib/sandbox-core.d.ts +1 -0
  76. package/lib/sandbox-core.js +4 -2
  77. package/lib/session-runtime.d.ts +7 -1
  78. package/lib/session-runtime.js +9 -2
  79. package/lib/shell.d.ts +1 -1
  80. package/lib/shell.js +1 -1
  81. package/lib/status.js +2 -1
  82. package/lib/writable-roots.d.ts +109 -0
  83. package/lib/writable-roots.js +257 -0
  84. package/lib/wsl-doctor-command.js +2 -1
  85. package/lib/wsl-doctor-tool.js +2 -2
  86. package/lib/wsl-filesystem.d.ts +692 -0
  87. package/lib/wsl-filesystem.js +897 -0
  88. package/lib/wsl-shell.d.ts +742 -0
  89. package/lib/wsl-shell.js +965 -0
  90. package/lib/wsl.d.ts +1 -1
  91. package/lib/wsl.js +1 -1
  92. package/package.json +48 -24
  93. package/scripts/doctor.mjs +1 -1
  94. package/scripts/profile-preset.mjs +17 -5
package/lib/wsl.d.ts CHANGED
@@ -179,7 +179,7 @@ export interface WslTerminalOptions {
179
179
  /**
180
180
  * The `wsl.exe` argv that opens one interactive shell inside a distro.
181
181
  *
182
- * This is the terminal twin of the command form built in `lib/index.js`, with
182
+ * This is the terminal twin of the command form built in `lib/wsl-shell.js`, with
183
183
  * three deliberate differences:
184
184
  *
185
185
  * - There is no command string. With no pinned shell the launch ends here and
package/lib/wsl.js CHANGED
@@ -241,7 +241,7 @@ export function interactiveShellArgs(shellPath, login) {
241
241
  /**
242
242
  * The `wsl.exe` argv that opens one interactive shell inside a distro.
243
243
  *
244
- * This is the terminal twin of the command form built in `lib/index.js`, with
244
+ * This is the terminal twin of the command form built in `lib/wsl-shell.js`, with
245
245
  * three deliberate differences:
246
246
  *
247
247
  * - There is no command string. With no pinned shell the launch ends here and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-wsl-env",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "在 WSL 的 Linux 实例中打开项目工作区,在对应 Linux 空间中进行命令执行、运行 shell 脚本和文件访问,以获得全套 Linux Shell 工具链收益,并通过 bubblewrap 对命令进行沙箱隔离",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -56,6 +56,10 @@
56
56
  "types": "./lib/index.d.ts",
57
57
  "default": "./lib/index.js"
58
58
  },
59
+ "./open-in-app": {
60
+ "types": "./lib/open-in-app.d.ts",
61
+ "default": "./lib/open-in-app.js"
62
+ },
59
63
  "./locale/en.json": "./locale/en.json",
60
64
  "./locale/zh.json": "./locale/zh.json",
61
65
  "./package.json": "./package.json",
@@ -124,7 +128,10 @@
124
128
  "@deepseek-ai/dsh-client-ui-slots",
125
129
  "@deepseek-ai/dsh-client-ui-layout",
126
130
  "@deepseek-ai/dsh-client-ui-sidebar",
127
- "@deepseek-ai/dsh-client-ui-workspace"
131
+ "@deepseek-ai/dsh-client-ui-workspace",
132
+ "@deepseek-ai/dsh-client-ui-conversation",
133
+ "@deepseek-ai/dsh-client-ui-context-menu",
134
+ "@deepseek-ai/dsh-client-ui-session"
128
135
  ]
129
136
  }
130
137
  },
@@ -154,6 +161,7 @@
154
161
  "docs/root-fs-routing.md",
155
162
  "docs/VALUE.zh.md",
156
163
  "docs/UPSTREAM-OPEN-IN-APP.md",
164
+ "docs/UPSTREAM-PROMPT-ADAPTERS.md",
157
165
  "docs/adr/0002-native-agent.md",
158
166
  "docs/PARITY.md",
159
167
  "docs/PEER-PARITY.md",
@@ -181,16 +189,28 @@
181
189
  "scripts/diagnose.sh",
182
190
  "scripts/doctor.mjs",
183
191
  "scripts/open-wsl-vscode.ps1",
184
- "scripts/profile-preset.mjs"
192
+ "scripts/profile-preset.mjs",
193
+ "docs/ARCHITECTURE.zh.md",
194
+ "docs/API.zh.md",
195
+ "docs/COMPATIBILITY.zh.md",
196
+ "docs/MIGRATION.zh.md",
197
+ "docs/PERFORMANCE.zh.md",
198
+ "docs/VALUE.md",
199
+ "CONTRIBUTING.zh.md",
200
+ "SECURITY.zh.md",
201
+ "SUPPORT.zh.md",
202
+ "CODE_OF_CONDUCT.md",
203
+ "CODE_OF_CONDUCT.zh.md"
185
204
  ],
186
205
  "scripts": {
187
206
  "test": "pnpm run lint:style && pnpm run lint:links && pnpm run lint:requirements && pnpm run lint:docs && pnpm run test:syntax && pnpm run lint:build && pnpm run lint:types && pnpm run test:unit",
188
207
  "lint:types": "tsc --noEmit",
189
208
  "build": "node scripts/build.mjs",
190
209
  "lint:build": "node test/build-freshness.mjs",
191
- "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/status.test.mjs test/client-host.test.mjs test/messages.test.mjs",
210
+ "test:browser": "node --test --test-timeout=120000 test/browser/e2e.test.mjs",
211
+ "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/auto-preset.test.mjs test/probe-cache.test.mjs test/writable-roots.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/status.test.mjs test/client-host.test.mjs test/messages.test.mjs test/client.test.mjs test/open-in-app.test.mjs",
192
212
  "test:syntax": "node test/syntax.mjs",
193
- "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/status.test.mjs test/client-host.test.mjs test/messages.test.mjs",
213
+ "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/writable-roots.test.mjs test/preflight.test.mjs test/preset-choice.test.mjs test/auto-preset.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/status.test.mjs test/client-host.test.mjs test/messages.test.mjs test/client.test.mjs test/open-in-app.test.mjs",
194
214
  "lint:style": "node test/style.mjs",
195
215
  "lint:links": "node scripts/check-links.mjs",
196
216
  "lint:requirements": "node scripts/check-requirements.mjs",
@@ -248,33 +268,37 @@
248
268
  "@deepseek-ai/cordis": "4.1.0",
249
269
  "@deepseek-ai/cordis-plugin-include": "1.1.0",
250
270
  "@deepseek-ai/cordis-plugin-loader": "1.1.0",
251
- "@deepseek-ai/dsh-bash-local": "0.2.2-rc.1",
252
- "@deepseek-ai/dsh-fs": "0.2.2-rc.1",
253
- "@deepseek-ai/dsh-fs-local": "0.2.2-rc.1",
254
- "@deepseek-ai/dsh-fs-patch": "0.2.2-rc.1",
255
- "@deepseek-ai/dsh-host-directory-picker": "0.2.2-rc.1",
256
- "@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
257
- "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.1",
258
- "@deepseek-ai/dsh-subprocess": "0.2.2-rc.1",
259
- "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.1",
260
- "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
271
+ "@deepseek-ai/dsh-bash-local": "0.2.2-rc.2",
272
+ "@deepseek-ai/dsh-fs": "0.2.2-rc.2",
273
+ "@deepseek-ai/dsh-fs-local": "0.2.2-rc.2",
274
+ "@deepseek-ai/dsh-fs-patch": "0.2.2-rc.2",
275
+ "@deepseek-ai/dsh-host-directory-picker": "0.2.2-rc.2",
276
+ "@deepseek-ai/dsh-sandbox": "0.2.2-rc.2",
277
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.2",
278
+ "@deepseek-ai/dsh-subprocess": "0.2.2-rc.2",
279
+ "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.2",
280
+ "@deepseek-ai/dsh-tools": "0.2.2-rc.2",
261
281
  "@deepseek-ai/schemastery": "3.19.0",
262
282
  "@types/js-yaml": "^4.0.9",
263
283
  "@types/node": "~22.20.5",
284
+ "esbuild": "0.25.8",
264
285
  "js-yaml": "4.3.2",
286
+ "playwright": "1.65.0",
287
+ "react": "19.1.1",
288
+ "react-dom": "19.1.1",
265
289
  "typescript": "~6.0.3"
266
290
  },
267
291
  "peerDependencies": {
268
292
  "@deepseek-ai/cordis": "^4.1.0",
269
- "@deepseek-ai/dsh-bash-local": ">=0.2.2-rc.1",
270
- "@deepseek-ai/dsh-fs": ">=0.2.2-rc.1",
271
- "@deepseek-ai/dsh-fs-local": ">=0.2.2-rc.1",
272
- "@deepseek-ai/dsh-fs-patch": ">=0.2.2-rc.1",
273
- "@deepseek-ai/dsh-host-directory-picker": ">=0.2.2-rc.1",
274
- "@deepseek-ai/dsh-sandbox": ">=0.2.2-rc.1",
275
- "@deepseek-ai/dsh-subprocess": ">=0.2.2-rc.1",
276
- "@deepseek-ai/dsh-tools": ">=0.2.2-rc.1",
277
- "@deepseek-ai/dsh-subprocess-local": ">=0.2.2-rc.1",
293
+ "@deepseek-ai/dsh-bash-local": ">=0.2.2-rc.2",
294
+ "@deepseek-ai/dsh-fs": ">=0.2.2-rc.2",
295
+ "@deepseek-ai/dsh-fs-local": ">=0.2.2-rc.2",
296
+ "@deepseek-ai/dsh-fs-patch": ">=0.2.2-rc.2",
297
+ "@deepseek-ai/dsh-host-directory-picker": ">=0.2.2-rc.2",
298
+ "@deepseek-ai/dsh-sandbox": ">=0.2.2-rc.2",
299
+ "@deepseek-ai/dsh-subprocess": ">=0.2.2-rc.2",
300
+ "@deepseek-ai/dsh-tools": ">=0.2.2-rc.2",
301
+ "@deepseek-ai/dsh-subprocess-local": ">=0.2.2-rc.2",
278
302
  "@deepseek-ai/schemastery": "^3.19.0"
279
303
  },
280
304
  "peerDependenciesMeta": {
@@ -84,7 +84,7 @@ import { parseListeningPorts, procNetScript } from "../lib/ports.js";
84
84
  // `test/doctor.test.mjs` compares the copy against the lib export to pin it
85
85
  // against drift.
86
86
  //
87
- // Inlined from `src/index.ts` `effectiveMaskWindowsDrive`:
87
+ // Inlined from `src/provider-common.ts` `effectiveMaskWindowsDrive`:
88
88
  /**
89
89
  * Whether confined profiles shadow `/mnt` under this config.
90
90
  *
@@ -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
  }