dsh-gitbash-shell 0.6.0 → 0.7.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.
- package/README.md +4 -0
- package/README_EN.md +4 -0
- package/dsh.plugin.json +1 -1
- package/package.json +1 -1
- package/src/index.js +27 -0
package/README.md
CHANGED
|
@@ -129,6 +129,10 @@ preset 会被插件自动清理;宿主 shell 回退为 PowerShell。
|
|
|
129
129
|
> 切换生效后若 `ptc-cordis` 目录已存在且被旧版本物化,删除
|
|
130
130
|
> `~/.dsh/.agent-presets/ptc-cordis` 并重启,即由新逻辑重新物化。
|
|
131
131
|
|
|
132
|
+
## POSIX 路径指示(v0.7.0)
|
|
133
|
+
|
|
134
|
+
Windows 上本插件把宿主 shell 换成 Git Bash 的同时,会向**每个会话的系统提示**注入一条全局指示(仅 Win32,走 `systemPrompt.context`,不影响任何 preset/组合文本):**bash 命令里一律用 POSIX 风格路径**(`/c/Users/...`、`/c/Program Files/...`),不要 `C:/...` 或 `C:\...`。这样模型在工具调用里不会再拿 Windows 盘符路径喂给 Git Bash——标准/极简/PTC/创造及用户自建模式全部覆盖,无需任何模式单独改。
|
|
135
|
+
|
|
132
136
|
## 与 dsh-better-sidebar 联动
|
|
133
137
|
|
|
134
138
|
装了 [dsh-better-sidebar](https://github.com/omdsh-dev/DSH-better-sidebar)(v0.15.2+) 时,Windows 上本插件会通过**它的官方设置补丁口**(运行时 `terminalShell` 设置,对方文档明示"settings-page overrides win for terminals opened afterwards")把它打开的终端 shell 指向 Git Bash——**UI 终端标签与模型侧 `terminal_*` 工具统一生效**,不改对方一行代码、新开的终端即生效。此外,**本插件的 bundle patch 还会给对方的行补上 `config.shell`**(启动期解析,连 **tab 标题也会显示 bash**;对方未安装时该行无害跳过)。规则:
|
package/README_EN.md
CHANGED
|
@@ -64,6 +64,10 @@ the PTC preset is materialized as Git Bash automatically (tool-bash on,
|
|
|
64
64
|
tool-pwsh off) — no extra mode, no manual edits. Without this plugin the PTC
|
|
65
65
|
preset stays as its own plugin manages it.
|
|
66
66
|
|
|
67
|
+
## POSIX path directive (v0.7.0)
|
|
68
|
+
|
|
69
|
+
While replacing the host shell with Git Bash, this plugin also injects one global per-session system-prompt directive (Win32 only, via systemPrompt.context; no preset or composition text is touched): **always use POSIX-style paths in bash commands** (/c/Users/..., /c/Program Files/...) — never C:/... or C:\... . Every mode — standard/minimal/PTC/creation and user-authored presets — is covered; nothing needs a per-mode change.
|
|
70
|
+
|
|
67
71
|
## Cooperation with dsh-better-sidebar
|
|
68
72
|
|
|
69
73
|
When [dsh-better-sidebar](https://github.com/omdsh-dev/DSH-better-sidebar) (v0.15.2+) is installed, on Windows this plugin adopts its official runtime settings seam (`terminalShell` — by the sidebar's own contract, "settings-page overrides win for terminals opened afterwards"), so both the sidebar's UI terminal tabs and the model-facing `terminal_*` tools open Git Bash — no upstream change, new terminals pick it up immediately. In addition, this bundle's patch also sets `config.shell` on the sidebar's row (boot-time resolution, so the **tab label reads `bash` too**; the row edit is harmless-skipped when the sidebar is not installed). Rules:
|
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-gitbash-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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.
|
|
3
|
+
"version": "0.7.0",
|
|
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/index.js
CHANGED
|
@@ -448,6 +448,33 @@ export async function apply(ctx, config = {}) {
|
|
|
448
448
|
const disposeGitBash = ctx.provide('gitBash', gitBashCapability)
|
|
449
449
|
ctx.effect(() => disposeGitBash, 'dsh-gitbash-shell: gitBash capability')
|
|
450
450
|
|
|
451
|
+
// ── POSIX path directive (Windows Git Bash, EVERY session) ─────────────
|
|
452
|
+
// The host shell is Git for Windows bash for every mode/preset on this
|
|
453
|
+
// machine: drive-letter paths (C:/..., C:\...) are a Windows-shell idiom
|
|
454
|
+
// that Git Bash only sometimes tolerates, /c/... is the unambiguous form.
|
|
455
|
+
// One global runtime-context directive (same channel dsh-agent-lang uses;
|
|
456
|
+
// order 126 sits after the official CONTEXT_ORDERS 110/115/120 and beside
|
|
457
|
+
// the 125 free slot) so no preset/persona has to carry it. Non-Windows
|
|
458
|
+
// mounts inject nothing.
|
|
459
|
+
if (process.platform === 'win32') {
|
|
460
|
+
try {
|
|
461
|
+
ctx.inject(['systemPrompt'], (pctx) => {
|
|
462
|
+
try {
|
|
463
|
+
pctx.effect(() => pctx.systemPrompt.context({
|
|
464
|
+
name: 'gitbash-shell:posix-paths',
|
|
465
|
+
order: 126,
|
|
466
|
+
text: 'The working shell is Git for Windows bash: use POSIX-style paths in every command — /c/Users/..., /c/Program Files/... — never C:/... or C:\... (Git Bash misreads drive-letter paths).',
|
|
467
|
+
}), 'dsh-gitbash-shell: posix-path context')
|
|
468
|
+
console.log(TAG + ' POSIX-path directive context active (win32)')
|
|
469
|
+
} catch (error) {
|
|
470
|
+
console.log(TAG + ' context registration failed: ' + (error?.message ?? error))
|
|
471
|
+
}
|
|
472
|
+
})
|
|
473
|
+
} catch (error) {
|
|
474
|
+
console.log(TAG + ' systemPrompt inject wiring failed: ' + (error?.message ?? error))
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
451
478
|
// ── dsh-better-sidebar terminal adoption (Windows only) ────────────────
|
|
452
479
|
// The sidebar resolves its terminal shell through the settings seam per
|
|
453
480
|
// open; adopt it through that seam (see adoptSidebarShell for rationale).
|