dsh-gitbash-shell 0.10.0 → 0.10.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.
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-gitbash-shell",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "main": "./src/index.js",
5
5
  "description": "Windows 全模式 Git Bash:用 Git for Windows bash 替换 PowerShell 执行器,并物化 standard/minimal/code/cordis 的 Git Bash 变体 preset。双 era 适配 dsh <= 0.1.1(内置 id 'code')与 >= 0.1.2(改名 'ptc'),启动探测自动选择,preset id 永不变。联动:dsh-ptc-cordis-preset(两者同装时 PTC 创造模式自动物化为 Git Bash 版)+ dsh-better-sidebar(终端 UI 标签与模型 terminal_* 工具自动切到 Git Bash)。",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gitbash-shell",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "DSH plugin: run every agent shell command through Git for Windows bash on Windows instead of PowerShell. Replaces the pwsh executor with a Git Bash ctx.shell provider and materializes Git Bash variants of the standard/minimal/code/cordis agent presets into your user preset root at startup. On Windows it also adopts dsh-better-sidebar's terminal shell (UI tabs and the model-facing terminal_* tools) through the sidebar's official settings seam, and pairs with dsh-ptc-cordis-preset so the PTC Creation-mode preset materializes as its Git Bash variant. Ships both composition eras for dsh <= 0.1.1 (built-in preset id 'code') and dsh >= 0.1.2 (renamed id 'ptc') — the era is probed per boot and re-materialized automatically after a dsh upgrade, in either upgrade order; preset ids never change so pinned sessions stay valid.",
5
5
  "type": "module",
6
6
  "repository": {
package/src/client.js CHANGED
@@ -276,5 +276,7 @@ window.__ModuleLoader__.load({
276
276
  console.warn(TAG + " settings card registration failed:", error && error.message ? error.message : error);
277
277
  }
278
278
  };
279
+
280
+ return module.exports;
279
281
  },
280
282
  });
package/src/index.js CHANGED
@@ -360,22 +360,30 @@ export function translateMsysPath(value) {
360
360
  }
361
361
 
362
362
  /**
363
- * Rewrite MSYS drive roots in an arguments object path fields, in place.
364
- * @returns {boolean} whether any field changed (false also when args is not
365
- * an object — the caller treats that as nothing to do).
363
+ * Return an arguments object whose path fields carry drive-letter roots.
364
+ * Pure: builds a NEW object when any field changes and returns the ORIGINAL
365
+ * reference otherwise — the registry deep-freezes exec.arguments at exec
366
+ * construction (0.10.2 lesson: in-place writes throw in strict mode and were
367
+ * silently swallowed), so the caller REPLACES the exec.arguments property
368
+ * (the exec object itself is not frozen until tools/result; signal
369
+ * replacement is the registry's own precedent).
370
+ * @returns {object} the translated arguments object, or the input when
371
+ * nothing changed (also the input itself when args is not an object).
366
372
  */
367
373
  export function translatePathArguments(args) {
368
- if (!args || typeof args !== 'object') return false
374
+ if (!args || typeof args !== 'object') return args
369
375
  let changed = false
370
- for (const key of Object.keys(args)) {
376
+ const next = { ...args }
377
+ for (const key of Object.keys(next)) {
371
378
  if (!TRANSLATABLE_PATH_FIELDS.has(key)) continue
372
- const value = args[key]
379
+ const value = next[key]
373
380
  if (typeof value !== 'string') continue
374
381
  const translated = translateMsysPath(value)
375
382
  if (translated === value) continue
376
- try { args[key] = translated; changed = true } catch { /* frozen: degrade */ }
383
+ next[key] = translated
384
+ changed = true
377
385
  }
378
- return changed
386
+ return changed ? next : args
379
387
  }
380
388
 
381
389
  // ── dsh-better-sidebar shell cooperation ───────────────────────────────────
@@ -623,7 +631,8 @@ export async function apply(ctx, config = {}) {
623
631
  ctx.on('tools/execute', (exec, next) => {
624
632
  try {
625
633
  if (exec && exec.arguments && typeof exec.arguments === 'object' && readPosixPaths(ctx)) {
626
- translatePathArguments(exec.arguments)
634
+ const translated = translatePathArguments(exec.arguments)
635
+ if (translated !== exec.arguments) exec.arguments = translated
627
636
  }
628
637
  } catch { /* never block a call on translation */ }
629
638
  return next()