dsh-gitbash-shell 0.14.0 → 0.15.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 +25 -4
- package/README_EN.md +31 -4
- package/dsh.plugin.json +1 -1
- package/package.json +1 -1
- package/src/client.js +352 -11
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -144,9 +144,30 @@ preset 会被插件自动清理;宿主 shell 回退为 PowerShell。
|
|
|
144
144
|
> 切换生效后若 `ptc-cordis` 目录已存在且被旧版本物化,删除
|
|
145
145
|
> `~/.dsh/.agent-presets/ptc-cordis` 并重启,即由新逻辑重新物化。
|
|
146
146
|
|
|
147
|
-
## POSIX
|
|
148
|
-
|
|
149
|
-
Windows 上本插件把宿主 shell 换成 Git Bash
|
|
147
|
+
## POSIX 路径方言(v0.7.0 引入,受 `posixPaths` 开关门控)
|
|
148
|
+
|
|
149
|
+
Windows 上本插件把宿主 shell 换成 Git Bash 的同时,让**模型看到的路径**统一成 MSYS 盘根
|
|
150
|
+
POSIX 形式(`/c/Users/...`、`/c/Program Files/...`)。开关是 settings 命名空间
|
|
151
|
+
`gitbash-shell` 的布尔字段 `posixPaths`,**默认开启**(v0.10.0 起),可在 **设置 → 插件**
|
|
152
|
+
里本插件的「Git Bash 路径方言」卡片上随时切换;不修改任何 preset / 组合文件,标准/极简/
|
|
153
|
+
PTC/创造及用户自建模式一律覆盖。
|
|
154
|
+
|
|
155
|
+
开启时(仅 Win32),`posixPaths` 门控以下全部行为:
|
|
156
|
+
|
|
157
|
+
- **提示词源头替换**:组装期(`system-prompt/assemble`)把官方提示词 sections / contexts /
|
|
158
|
+
variables 里的 Windows 绝对路径**原位**改写成 `/c/...`——不增删任何内容、不动工具 schema;
|
|
159
|
+
- **一句话指示**:经 `systemPrompt.context`(order 126)注入全局指示——shell 是 Git for
|
|
160
|
+
Windows bash,路径用 MSYS 盘根,所有工具都直接接受这种写法;
|
|
161
|
+
- **参数翻译**:`tools/execute` 上把文件工具的路径参数(`file_path` / `path` / `workdir`)由
|
|
162
|
+
`/c/...` 翻回 `C:/...` 交给 Node 文件工具;bash 的 `command` 字段不动——那是 Git Bash 母语;
|
|
163
|
+
- **结果回流**:成功结果里的路径元数据(`read`/`write`/`edit` 的 `path`、`glob` 的 `paths[]`、
|
|
164
|
+
`grep` 的 `matches[].path`)改写回 MSYS 形式;文件内容与错误结果不动;
|
|
165
|
+
- **运行时事实**:向官方 `dsh-shell-env` 注册表贡献 `DSH_PATH_DIALECT=msys`,模型可在执行时
|
|
166
|
+
核验(随开关实时生效)。
|
|
167
|
+
|
|
168
|
+
关闭后回到 dsh 原生行为:指示文本为空(组装期直接丢弃,零提示噪声),路径参数与结果元数据
|
|
169
|
+
都不再改写,文件工具收 Windows 路径。**bash 始终是 Git Bash,不受此开关影响**——它只决定
|
|
170
|
+
跨工具的路径方言。
|
|
150
171
|
|
|
151
172
|
## 与 dsh-better-sidebar 联动
|
|
152
173
|
|
|
@@ -158,4 +179,4 @@ Windows 上本插件把宿主 shell 换成 Git Bash 的同时,会向**每个会
|
|
|
158
179
|
|
|
159
180
|
## 许可
|
|
160
181
|
|
|
161
|
-
MIT © KannaKuron。参考与致敬:[dsh-ptc-cordis-preset](https://github.com/KannaKuron/dsh-ptc-cordis-preset)。
|
|
182
|
+
MIT © KannaKuron。参考与致敬:[dsh-ptc-cordis-preset](https://github.com/KannaKuron/dsh-ptc-cordis-preset)。
|
package/README_EN.md
CHANGED
|
@@ -83,9 +83,36 @@ the PTC preset is materialized as Git Bash automatically (tool-bash on,
|
|
|
83
83
|
tool-pwsh off) — no extra mode, no manual edits. Without this plugin the PTC
|
|
84
84
|
preset stays as its own plugin manages it.
|
|
85
85
|
|
|
86
|
-
## POSIX path
|
|
87
|
-
|
|
88
|
-
While replacing the host shell with Git Bash, this plugin
|
|
86
|
+
## POSIX path dialect (introduced in v0.7.0, gated by the `posixPaths` switch)
|
|
87
|
+
|
|
88
|
+
While replacing the host shell with Git Bash on Windows, this plugin makes every path the
|
|
89
|
+
model sees use the MSYS drive-root POSIX form (/c/Users/..., /c/Program Files/...). The switch
|
|
90
|
+
is the `posixPaths` boolean in the `gitbash-shell` settings namespace; it is **on by default**
|
|
91
|
+
(since v0.10.0) and can be toggled any time on this plugin's "Git Bash path dialect" card in
|
|
92
|
+
**Settings → Plugins**. No preset or composition file is touched, and every mode —
|
|
93
|
+
standard/minimal/PTC/creation and user-authored presets — is covered.
|
|
94
|
+
|
|
95
|
+
While it is on (Windows only), `posixPaths` gates all of the following:
|
|
96
|
+
|
|
97
|
+
- **Source-level rewrite**: during assembly (`system-prompt/assemble`) every Windows absolute
|
|
98
|
+
path in the official prompt's sections, contexts, and variables is rewritten in place to the
|
|
99
|
+
/c/... form — nothing is added or removed, and tool schemas stay untouched;
|
|
100
|
+
- **One-sentence directive**: a global directive via `systemPrompt.context` (order 126) — the
|
|
101
|
+
shell is Git for Windows bash, paths use MSYS drive roots, and every tool accepts that form
|
|
102
|
+
directly;
|
|
103
|
+
- **Argument translation**: on `tools/execute` the file tools' path arguments (`file_path` /
|
|
104
|
+
`path` / `workdir`) are translated from /c/... back to C:/... for the Node-backed file tools;
|
|
105
|
+
a bash command's `command` field is left alone — that is Git Bash's native form;
|
|
106
|
+
- **Result round-trip**: path metadata in successful results (`path` of read/write/edit,
|
|
107
|
+
`paths[]` of glob, `matches[].path` of grep) flows back in the MSYS form; file contents and
|
|
108
|
+
error results are untouched;
|
|
109
|
+
- **Runtime fact**: `DSH_PATH_DIALECT=msys` is contributed to the official `dsh-shell-env`
|
|
110
|
+
registry, so the model can verify the dialect at execution time (it follows the live switch).
|
|
111
|
+
|
|
112
|
+
With the switch off, dsh-native behavior returns: the directive text is empty (dropped at
|
|
113
|
+
assembly, so zero prompt noise), path arguments and result metadata are no longer rewritten, and
|
|
114
|
+
the file tools receive Windows paths. **Bash stays Git Bash either way** — the switch only
|
|
115
|
+
governs the cross-tool path dialect.
|
|
89
116
|
|
|
90
117
|
## Cooperation with dsh-better-sidebar
|
|
91
118
|
|
|
@@ -98,4 +125,4 @@ When [dsh-better-sidebar](https://github.com/omdsh-dev/DSH-better-sidebar) (v0.1
|
|
|
98
125
|
## License
|
|
99
126
|
|
|
100
127
|
MIT © KannaKuron. Inspired by
|
|
101
|
-
[dsh-ptc-cordis-preset](https://github.com/KannaKuron/dsh-ptc-cordis-preset).
|
|
128
|
+
[dsh-ptc-cordis-preset](https://github.com/KannaKuron/dsh-ptc-cordis-preset).
|
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.15.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.15.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/client.js
CHANGED
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
* (react and @deepseek-ai/dsh-client-ui-primitives only, smoke-enforced);
|
|
22
22
|
* - plain React.createElement, no JSX/TS; components at module level;
|
|
23
23
|
* - dsh.client.inject in package.json lists the packages that must load
|
|
24
|
-
* first so locale / settingsScope / slots exist when this applies
|
|
24
|
+
* first so locale / settingsScope / slots exist when this applies;
|
|
25
|
+
* - copy ships in three layers: zh/en inline, one LOCALES entry per third
|
|
26
|
+
* language (each preceded by a locale marker line), every dictionary
|
|
27
|
+
* key-aligned with zh (smoke-enforced) and read through a live lookup —
|
|
28
|
+
* DSH's language preference switches without a page reload.
|
|
25
29
|
*/
|
|
26
30
|
window.__ModuleLoader__.load({
|
|
27
31
|
id: "dsh-gitbash-shell",
|
|
@@ -35,6 +39,7 @@ window.__ModuleLoader__.load({
|
|
|
35
39
|
|
|
36
40
|
var E = React.createElement;
|
|
37
41
|
var useState = React.useState;
|
|
42
|
+
var useEffect = React.useEffect;
|
|
38
43
|
|
|
39
44
|
var TAG = "[gitbash-shell/client]";
|
|
40
45
|
/** Dictionary namespace (the plugin's own t seat). */
|
|
@@ -42,11 +47,15 @@ window.__ModuleLoader__.load({
|
|
|
42
47
|
/** The settings namespace the HOST half serves. */
|
|
43
48
|
var SETTINGS_NAMESPACE = "gitbash-shell";
|
|
44
49
|
|
|
45
|
-
// ── dictionaries
|
|
50
|
+
// ── dictionaries ────────────────────────────────────────────────────────
|
|
51
|
+
// zh/en stay inline; the third languages live in LOCALES below, one entry
|
|
52
|
+
// per language behind a locale marker line. EVERY shipped dictionary MUST
|
|
53
|
+
// carry zh's exact key set: a missing key falls back to English at lookup
|
|
54
|
+
// time, which reads as a half-translated card (smoke-enforced).
|
|
46
55
|
|
|
47
56
|
var zh = {
|
|
48
57
|
"title": "Git Bash 路径方言",
|
|
49
|
-
"cardDesc": "所有工具统一 /c/ POSIX 路径形式(
|
|
58
|
+
"cardDesc": "所有工具统一 /c/ POSIX 路径形式(默认开启)",
|
|
50
59
|
"state.label": "当前状态",
|
|
51
60
|
"state.on": "已启用",
|
|
52
61
|
"state.off": "已关闭",
|
|
@@ -58,7 +67,7 @@ window.__ModuleLoader__.load({
|
|
|
58
67
|
|
|
59
68
|
var en = {
|
|
60
69
|
"title": "Git Bash path dialect",
|
|
61
|
-
"cardDesc": "One /c/ POSIX path style for every tool (
|
|
70
|
+
"cardDesc": "One /c/ POSIX path style for every tool (on by default)",
|
|
62
71
|
"state.label": "Current state",
|
|
63
72
|
"state.on": "Enabled",
|
|
64
73
|
"state.off": "Disabled",
|
|
@@ -68,6 +77,302 @@ window.__ModuleLoader__.load({
|
|
|
68
77
|
"hint": "Enabled: every tool (bash commands and workdir, read/write/edit/read_image/glob/grep path arguments) uses MSYS drive-root POSIX paths (/c/Users/...); the host translates path fields for the file tools automatically. Disabled restores dsh-native behavior (Windows paths for file tools). Bash is always Git Bash while the plugin is installed; this switch only governs the cross-tool path dialect.",
|
|
69
78
|
};
|
|
70
79
|
|
|
80
|
+
/* Third-language dictionaries: one entry per language, each preceded
|
|
81
|
+
by a locale marker line the smoke test slices on. Adding a language is
|
|
82
|
+
one entry here and nothing else — the dictionaries also ride the
|
|
83
|
+
ctx.locale.register call below, so host-side consumers read the same
|
|
84
|
+
copy the card does. Every key set MUST equal zh's exactly: a missing
|
|
85
|
+
key falls back to English silently and the card looks half-translated.
|
|
86
|
+
zh-hk and zh-mo ship one Cantonese-flavoured copy; zh-tw carries the
|
|
87
|
+
Taiwan wording. */
|
|
88
|
+
var LOCALES = {
|
|
89
|
+
/* locale: ar */
|
|
90
|
+
"ar": {
|
|
91
|
+
"title": "لهجة مسارات Git Bash",
|
|
92
|
+
"cardDesc": "صيغة مسار POSIX موحّدة /c/ لكل الأدوات (مُفعَّلة افتراضيًا)",
|
|
93
|
+
"state.label": "الحالة الحالية",
|
|
94
|
+
"state.on": "مُفعَّلة",
|
|
95
|
+
"state.off": "مُعطَّلة",
|
|
96
|
+
"switch.on": "تفعيل",
|
|
97
|
+
"switch.off": "تعطيل",
|
|
98
|
+
"error": "فشل الكتابة",
|
|
99
|
+
"hint": "عند التفعيل: تستخدم كل الأدوات (أوامر bash و workdir، ومعاملات المسار في read/write/edit/read_image/glob/grep) مسارات POSIX من جذر قرص MSYS (/c/Users/...)؛ ويتولّى المضيف ترجمة حقول المسار لأدوات الملفات تلقائيًا. عند التعطيل يعود السلوك الأصلي لـ dsh (مسارات Windows لأدوات الملفات). يبقى bash دائمًا Git Bash ما دامت الإضافة مثبَّتة؛ هذا المفتاح لا يحكم سوى لهجة المسارات بين الأدوات.",
|
|
100
|
+
},
|
|
101
|
+
/* locale: de */
|
|
102
|
+
"de": {
|
|
103
|
+
"title": "Git-Bash-Pfaddialekt",
|
|
104
|
+
"cardDesc": "Eine einheitliche /c/-POSIX-Pfadform für alle Tools (standardmäßig an)",
|
|
105
|
+
"state.label": "Aktueller Status",
|
|
106
|
+
"state.on": "Aktiviert",
|
|
107
|
+
"state.off": "Deaktiviert",
|
|
108
|
+
"switch.on": "Aktivieren",
|
|
109
|
+
"switch.off": "Deaktivieren",
|
|
110
|
+
"error": "Schreiben fehlgeschlagen",
|
|
111
|
+
"hint": "Aktiviert: Alle Tools (bash-Befehle und workdir sowie Pfadargumente von read/write/edit/read_image/glob/grep) verwenden POSIX-Pfade ab der MSYS-Laufwerkswurzel (/c/Users/...); der Host übersetzt die Pfadfelder der Dateitools automatisch. Deaktiviert stellt das dsh-native Verhalten wieder her (Windows-Pfade für Dateitools). Bash ist bei installiertem Plugin immer Git Bash; dieser Schalter steuert nur den Pfaddialekt zwischen den Tools.",
|
|
112
|
+
},
|
|
113
|
+
/* locale: fr */
|
|
114
|
+
"fr": {
|
|
115
|
+
"title": "Dialecte de chemins Git Bash",
|
|
116
|
+
"cardDesc": "Une forme de chemin POSIX /c/ unique pour tous les outils (activée par défaut)",
|
|
117
|
+
"state.label": "État actuel",
|
|
118
|
+
"state.on": "Activé",
|
|
119
|
+
"state.off": "Désactivé",
|
|
120
|
+
"switch.on": "Activer",
|
|
121
|
+
"switch.off": "Désactiver",
|
|
122
|
+
"error": "échec de l'écriture",
|
|
123
|
+
"hint": "Activé : tous les outils (commandes bash et workdir, arguments de chemin de read/write/edit/read_image/glob/grep) utilisent des chemins POSIX à racine de lecteur MSYS (/c/Users/...) ; l'hôte traduit automatiquement les champs de chemin des outils de fichiers. Désactivé rétablit le comportement natif de dsh (chemins Windows pour les outils de fichiers). Bash reste toujours Git Bash tant que le plugin est installé ; ce commutateur ne régit que le dialecte de chemins entre outils.",
|
|
124
|
+
},
|
|
125
|
+
/* locale: hi */
|
|
126
|
+
"hi": {
|
|
127
|
+
"title": "Git Bash पथ शैली",
|
|
128
|
+
"cardDesc": "सभी टूल के लिए एक ही /c/ POSIX पथ रूप (डिफ़ॉल्ट रूप से सक्षम)",
|
|
129
|
+
"state.label": "वर्तमान स्थिति",
|
|
130
|
+
"state.on": "सक्षम",
|
|
131
|
+
"state.off": "अक्षम",
|
|
132
|
+
"switch.on": "सक्षम करें",
|
|
133
|
+
"switch.off": "अक्षम करें",
|
|
134
|
+
"error": "लिखना विफल रहा",
|
|
135
|
+
"hint": "सक्षम होने पर: सभी टूल (bash कमांड और workdir, तथा read/write/edit/read_image/glob/grep के पथ तर्क) MSYS ड्राइव-रूट POSIX पथ (/c/Users/...) का उपयोग करते हैं; फ़ाइल टूल के पथ फ़ील्ड होस्ट स्वतः अनुवादित करता है। अक्षम करने पर dsh का मूल व्यवहार बहाल होता है (फ़ाइल टूल के लिए Windows पथ)। जब तक प्लगइन इंस्टॉल है bash हमेशा Git Bash रहता है; यह स्विच केवल टूल के बीच पथ शैली नियंत्रित करता है।",
|
|
136
|
+
},
|
|
137
|
+
/* locale: id */
|
|
138
|
+
"id": {
|
|
139
|
+
"title": "Dialek path Git Bash",
|
|
140
|
+
"cardDesc": "Satu bentuk path POSIX /c/ untuk semua alat (aktif secara bawaan)",
|
|
141
|
+
"state.label": "Status saat ini",
|
|
142
|
+
"state.on": "Aktif",
|
|
143
|
+
"state.off": "Nonaktif",
|
|
144
|
+
"switch.on": "Aktifkan",
|
|
145
|
+
"switch.off": "Nonaktifkan",
|
|
146
|
+
"error": "gagal menulis",
|
|
147
|
+
"hint": "Saat aktif: semua alat (perintah bash dan workdir, serta argumen path read/write/edit/read_image/glob/grep) memakai path POSIX berakar drive MSYS (/c/Users/...); host menerjemahkan bidang path untuk alat berkas secara otomatis. Saat nonaktif, perilaku asli dsh dipulihkan (path Windows untuk alat berkas). Bash selalu Git Bash selama plugin terpasang; sakelar ini hanya mengatur dialek path antaralat.",
|
|
148
|
+
},
|
|
149
|
+
/* locale: it */
|
|
150
|
+
"it": {
|
|
151
|
+
"title": "Dialetto dei percorsi Git Bash",
|
|
152
|
+
"cardDesc": "Un'unica forma di percorso POSIX /c/ per tutti gli strumenti (attivata per impostazione predefinita)",
|
|
153
|
+
"state.label": "Stato attuale",
|
|
154
|
+
"state.on": "Attivato",
|
|
155
|
+
"state.off": "Disattivato",
|
|
156
|
+
"switch.on": "Attiva",
|
|
157
|
+
"switch.off": "Disattiva",
|
|
158
|
+
"error": "scrittura non riuscita",
|
|
159
|
+
"hint": "Attivato: tutti gli strumenti (comandi bash e workdir, argomenti di percorso di read/write/edit/read_image/glob/grep) usano percorsi POSIX con radice di unità MSYS (/c/Users/...); l'host traduce automaticamente i campi di percorso degli strumenti per i file. Disattivato ripristina il comportamento nativo di dsh (percorsi Windows per gli strumenti per i file). Bash resta sempre Git Bash finché il plugin è installato; questo interruttore governa solo il dialetto dei percorsi tra gli strumenti.",
|
|
160
|
+
},
|
|
161
|
+
/* locale: ja */
|
|
162
|
+
"ja": {
|
|
163
|
+
"title": "Git Bash パス方言",
|
|
164
|
+
"cardDesc": "すべてのツールで /c/ POSIX パス形式に統一(既定ではオン)",
|
|
165
|
+
"state.label": "現在の状態",
|
|
166
|
+
"state.on": "有効",
|
|
167
|
+
"state.off": "無効",
|
|
168
|
+
"switch.on": "有効にする",
|
|
169
|
+
"switch.off": "無効にする",
|
|
170
|
+
"error": "書き込みに失敗しました",
|
|
171
|
+
"hint": "有効にすると、すべてのツール(bash コマンドと workdir、read/write/edit/read_image/glob/grep のパス引数)が MSYS ドライブルートの POSIX パス(/c/Users/...)を使います。ファイルツールのパスフィールドはホストが自動的に変換します。無効にすると dsh 本来の動作(ファイルツールは Windows パス)に戻ります。bash はプラグインがインストールされている限り常に Git Bash で、このスイッチの影響を受けません。",
|
|
172
|
+
},
|
|
173
|
+
/* locale: ko */
|
|
174
|
+
"ko": {
|
|
175
|
+
"title": "Git Bash 경로 방언",
|
|
176
|
+
"cardDesc": "모든 도구에 하나의 /c/ POSIX 경로 형식 사용(기본값 켜짐)",
|
|
177
|
+
"state.label": "현재 상태",
|
|
178
|
+
"state.on": "사용",
|
|
179
|
+
"state.off": "사용 안 함",
|
|
180
|
+
"switch.on": "사용",
|
|
181
|
+
"switch.off": "사용 안 함",
|
|
182
|
+
"error": "쓰기 실패",
|
|
183
|
+
"hint": "켜면 모든 도구(bash 명령과 workdir, read/write/edit/read_image/glob/grep의 경로 인수)가 MSYS 드라이브 루트 POSIX 경로(/c/Users/...)를 사용합니다. 파일 도구의 경로 필드는 호스트가 자동으로 변환합니다. 끄면 dsh 기본 동작(파일 도구에 Windows 경로 사용)으로 돌아갑니다. 플러그인이 설치되어 있는 동안 bash는 항상 Git Bash이며 이 스위치의 영향을 받지 않습니다.",
|
|
184
|
+
},
|
|
185
|
+
/* locale: nl */
|
|
186
|
+
"nl": {
|
|
187
|
+
"title": "Git Bash-paddialect",
|
|
188
|
+
"cardDesc": "Eén /c/ POSIX-padvorm voor alle tools (standaard aan)",
|
|
189
|
+
"state.label": "Huidige status",
|
|
190
|
+
"state.on": "Ingeschakeld",
|
|
191
|
+
"state.off": "Uitgeschakeld",
|
|
192
|
+
"switch.on": "Inschakelen",
|
|
193
|
+
"switch.off": "Uitschakelen",
|
|
194
|
+
"error": "schrijven mislukt",
|
|
195
|
+
"hint": "Ingeschakeld: alle tools (bash-opdrachten en workdir, padargumenten van read/write/edit/read_image/glob/grep) gebruiken POSIX-paden vanaf de MSYS-schijfwortel (/c/Users/...); de host vertaalt de padvelden voor de bestandstools automatisch. Uitgeschakeld herstelt het oorspronkelijke dsh-gedrag (Windows-paden voor bestandstools). Bash is altijd Git Bash zolang de plugin is geïnstalleerd; deze schakelaar bepaalt alleen het paddialect tussen de tools.",
|
|
196
|
+
},
|
|
197
|
+
/* locale: pl */
|
|
198
|
+
"pl": {
|
|
199
|
+
"title": "Dialekt ścieżek Git Bash",
|
|
200
|
+
"cardDesc": "Jedna postać ścieżki POSIX /c/ dla wszystkich narzędzi (domyślnie włączone)",
|
|
201
|
+
"state.label": "Bieżący stan",
|
|
202
|
+
"state.on": "Włączone",
|
|
203
|
+
"state.off": "Wyłączone",
|
|
204
|
+
"switch.on": "Włącz",
|
|
205
|
+
"switch.off": "Wyłącz",
|
|
206
|
+
"error": "zapis nie powiódł się",
|
|
207
|
+
"hint": "Po włączeniu: wszystkie narzędzia (polecenia bash i workdir oraz argumenty ścieżek w read/write/edit/read_image/glob/grep) używają ścieżek POSIX od korzenia dysku MSYS (/c/Users/...); host automatycznie tłumaczy pola ścieżek narzędzi plikowych. Wyłączenie przywraca natywne zachowanie dsh (ścieżki Windows dla narzędzi plikowych). Bash jest zawsze Git Bash, dopóki wtyczka jest zainstalowana; ten przełącznik reguluje wyłącznie dialekt ścieżek między narzędziami.",
|
|
208
|
+
},
|
|
209
|
+
/* locale: pt */
|
|
210
|
+
"pt": {
|
|
211
|
+
"title": "Dialeto de caminhos do Git Bash",
|
|
212
|
+
"cardDesc": "Uma única forma de caminho POSIX /c/ para todas as ferramentas (ativada por padrão)",
|
|
213
|
+
"state.label": "Estado atual",
|
|
214
|
+
"state.on": "Ativada",
|
|
215
|
+
"state.off": "Desativada",
|
|
216
|
+
"switch.on": "Ativar",
|
|
217
|
+
"switch.off": "Desativar",
|
|
218
|
+
"error": "falha ao gravar",
|
|
219
|
+
"hint": "Ativada: todas as ferramentas (comandos bash e workdir, argumentos de caminho de read/write/edit/read_image/glob/grep) usam caminhos POSIX a partir da raiz da unidade MSYS (/c/Users/...); o host traduz automaticamente os campos de caminho das ferramentas de arquivo. Desativada restaura o comportamento nativo do dsh (caminhos Windows para as ferramentas de arquivo). O bash é sempre Git Bash enquanto o plugin estiver instalado; este interruptor rege apenas o dialeto de caminhos entre ferramentas.",
|
|
220
|
+
},
|
|
221
|
+
/* locale: ru */
|
|
222
|
+
"ru": {
|
|
223
|
+
"title": "Диалект путей Git Bash",
|
|
224
|
+
"cardDesc": "Единый POSIX-формат путей /c/ для всех инструментов (по умолчанию включено)",
|
|
225
|
+
"state.label": "Текущее состояние",
|
|
226
|
+
"state.on": "Включено",
|
|
227
|
+
"state.off": "Выключено",
|
|
228
|
+
"switch.on": "Включить",
|
|
229
|
+
"switch.off": "Выключить",
|
|
230
|
+
"error": "не удалось записать",
|
|
231
|
+
"hint": "Включено: все инструменты (команды bash и workdir, аргументы путей read/write/edit/read_image/glob/grep) используют POSIX-пути от корня диска MSYS (/c/Users/...); хост автоматически преобразует поля путей для файловых инструментов. Выключение возвращает исходное поведение dsh (пути Windows для файловых инструментов). Пока плагин установлен, bash всегда остаётся Git Bash; этот переключатель управляет только диалектом путей между инструментами.",
|
|
232
|
+
},
|
|
233
|
+
/* locale: sv */
|
|
234
|
+
"sv": {
|
|
235
|
+
"title": "Git Bash-sökvägsdialekt",
|
|
236
|
+
"cardDesc": "En /c/ POSIX-sökvägsform för alla verktyg (på som standard)",
|
|
237
|
+
"state.label": "Aktuell status",
|
|
238
|
+
"state.on": "Aktiverad",
|
|
239
|
+
"state.off": "Inaktiverad",
|
|
240
|
+
"switch.on": "Aktivera",
|
|
241
|
+
"switch.off": "Inaktivera",
|
|
242
|
+
"error": "skrivning misslyckades",
|
|
243
|
+
"hint": "Aktiverad: alla verktyg (bash-kommandon och workdir, sökvägsargument för read/write/edit/read_image/glob/grep) använder POSIX-sökvägar från MSYS-enhetsroten (/c/Users/...); värden översätter sökvägsfälten för filverktygen automatiskt. Inaktiverad återställer dsh:s ursprungliga beteende (Windows-sökvägar för filverktyg). Bash är alltid Git Bash så länge insticksprogrammet är installerat; den här växeln styr bara sökvägsdialekten mellan verktygen.",
|
|
244
|
+
},
|
|
245
|
+
/* locale: th */
|
|
246
|
+
"th": {
|
|
247
|
+
"title": "รูปแบบพาธของ Git Bash",
|
|
248
|
+
"cardDesc": "ใช้รูปแบบพาธ POSIX /c/ แบบเดียวกันกับทุกเครื่องมือ (เปิดไว้เป็นค่าเริ่มต้น)",
|
|
249
|
+
"state.label": "สถานะปัจจุบัน",
|
|
250
|
+
"state.on": "เปิดใช้งาน",
|
|
251
|
+
"state.off": "ปิดใช้งาน",
|
|
252
|
+
"switch.on": "เปิดใช้งาน",
|
|
253
|
+
"switch.off": "ปิดใช้งาน",
|
|
254
|
+
"error": "เขียนไม่สำเร็จ",
|
|
255
|
+
"hint": "เมื่อเปิดใช้งาน: เครื่องมือทั้งหมด (คำสั่ง bash และ workdir รวมถึงอาร์กิวเมนต์พาธของ read/write/edit/read_image/glob/grep) ใช้พาธ POSIX จากรากไดรฟ์ของ MSYS (/c/Users/...) โฮสต์จะแปลฟิลด์พาธของเครื่องมือจัดการไฟล์ให้อัตโนมัติ เมื่อปิดใช้งานจะกลับสู่พฤติกรรมดั้งเดิมของ dsh (เครื่องมือจัดการไฟล์ใช้พาธ Windows) bash เป็น Git Bash เสมอเมื่อติดตั้งปลั๊กอินนี้ สวิตช์นี้ควบคุมเฉพาะรูปแบบพาธระหว่างเครื่องมือเท่านั้น",
|
|
256
|
+
},
|
|
257
|
+
/* locale: tr */
|
|
258
|
+
"tr": {
|
|
259
|
+
"title": "Git Bash yol lehçesi",
|
|
260
|
+
"cardDesc": "Tüm araçlar için tek /c/ POSIX yol biçimi (varsayılan olarak açık)",
|
|
261
|
+
"state.label": "Geçerli durum",
|
|
262
|
+
"state.on": "Etkin",
|
|
263
|
+
"state.off": "Devre dışı",
|
|
264
|
+
"switch.on": "Etkinleştir",
|
|
265
|
+
"switch.off": "Devre dışı bırak",
|
|
266
|
+
"error": "yazma başarısız",
|
|
267
|
+
"hint": "Etkinleştirildiğinde: tüm araçlar (bash komutları ve workdir ile read/write/edit/read_image/glob/grep yol bağımsız değişkenleri) MSYS sürücü kökünden POSIX yolları (/c/Users/...) kullanır; ana süreç dosya araçlarının yol alanlarını otomatik olarak çevirir. Devre dışı bırakıldığında dsh yerel davranışına döner (dosya araçları için Windows yolları). Eklenti kurulu olduğu sürece bash her zaman Git Bash olarak kalır; bu anahtar yalnızca araçlar arası yol lehçesini yönetir.",
|
|
268
|
+
},
|
|
269
|
+
/* locale: vi */
|
|
270
|
+
"vi": {
|
|
271
|
+
"title": "Phương ngữ đường dẫn Git Bash",
|
|
272
|
+
"cardDesc": "Một dạng đường dẫn POSIX /c/ thống nhất cho mọi công cụ (mặc định bật)",
|
|
273
|
+
"state.label": "Trạng thái hiện tại",
|
|
274
|
+
"state.on": "Đã bật",
|
|
275
|
+
"state.off": "Đã tắt",
|
|
276
|
+
"switch.on": "Bật",
|
|
277
|
+
"switch.off": "Tắt",
|
|
278
|
+
"error": "ghi thất bại",
|
|
279
|
+
"hint": "Khi bật: mọi công cụ (lệnh bash và workdir, tham số đường dẫn của read/write/edit/read_image/glob/grep) dùng đường dẫn POSIX từ gốc ổ đĩa MSYS (/c/Users/...); máy chủ tự động chuyển đổi trường đường dẫn cho các công cụ tệp. Khi tắt, hành vi gốc của dsh được khôi phục (công cụ tệp dùng đường dẫn Windows). bash luôn là Git Bash khi plugin được cài đặt; công tắc này chỉ điều khiển phương ngữ đường dẫn giữa các công cụ.",
|
|
280
|
+
},
|
|
281
|
+
/* locale: zh-hk */
|
|
282
|
+
"zh-hk": {
|
|
283
|
+
"title": "Git Bash 路徑方言",
|
|
284
|
+
"cardDesc": "所有工具統一用 /c/ POSIX 路徑格式(預設開啟)",
|
|
285
|
+
"state.label": "目前狀態",
|
|
286
|
+
"state.on": "已啟用",
|
|
287
|
+
"state.off": "已關閉",
|
|
288
|
+
"switch.on": "啟用",
|
|
289
|
+
"switch.off": "停用",
|
|
290
|
+
"error": "寫入失敗",
|
|
291
|
+
"hint": "啟用後:所有工具(bash 指令同 workdir、read/write/edit/read_image/glob/grep 嘅路徑參數)統一使用 MSYS 磁碟根 POSIX 路徑(/c/Users/...);檔案工具嘅路徑參數由宿主自動翻譯,模型無感。停用後回復 dsh 原生行為(檔案工具用 Windows 路徑)。bash 永遠係 Git Bash,唔受呢個開關影響。",
|
|
292
|
+
},
|
|
293
|
+
/* locale: zh-mo */
|
|
294
|
+
"zh-mo": {
|
|
295
|
+
"title": "Git Bash 路徑方言",
|
|
296
|
+
"cardDesc": "所有工具統一用 /c/ POSIX 路徑格式(預設開啟)",
|
|
297
|
+
"state.label": "目前狀態",
|
|
298
|
+
"state.on": "已啟用",
|
|
299
|
+
"state.off": "已關閉",
|
|
300
|
+
"switch.on": "啟用",
|
|
301
|
+
"switch.off": "停用",
|
|
302
|
+
"error": "寫入失敗",
|
|
303
|
+
"hint": "啟用後:所有工具(bash 指令同 workdir、read/write/edit/read_image/glob/grep 嘅路徑參數)統一使用 MSYS 磁碟根 POSIX 路徑(/c/Users/...);檔案工具嘅路徑參數由宿主自動翻譯,模型無感。停用後回復 dsh 原生行為(檔案工具用 Windows 路徑)。bash 永遠係 Git Bash,唔受呢個開關影響。",
|
|
304
|
+
},
|
|
305
|
+
/* locale: zh-tw */
|
|
306
|
+
"zh-tw": {
|
|
307
|
+
"title": "Git Bash 路徑方言",
|
|
308
|
+
"cardDesc": "所有工具統一採用 /c/ POSIX 路徑格式(預設開啟)",
|
|
309
|
+
"state.label": "目前狀態",
|
|
310
|
+
"state.on": "已啟用",
|
|
311
|
+
"state.off": "已關閉",
|
|
312
|
+
"switch.on": "啟用",
|
|
313
|
+
"switch.off": "停用",
|
|
314
|
+
"error": "寫入失敗",
|
|
315
|
+
"hint": "啟用後:所有工具(bash 指令與 workdir,以及 read/write/edit/read_image/glob/grep 的路徑參數)統一使用 MSYS 磁碟根 POSIX 路徑(/c/Users/...);檔案工具的路徑參數由宿主自動轉譯,模型無感。停用後恢復 dsh 原生行為(檔案工具使用 Windows 路徑)。bash 一律是 Git Bash,不受此開關影響。",
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// ── locale resolution (live: read per lookup, cached per tag) ───────────
|
|
320
|
+
|
|
321
|
+
function hasOwnKey(bag, key) {
|
|
322
|
+
return Object.prototype.hasOwnProperty.call(bag, key);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* Resolve one locale tag against what this plugin ships: the exact tag,
|
|
326
|
+
then the primary subtag, then English. Chinese is special-cased because
|
|
327
|
+
the traditional variants are shipped while a bare zh-Hant-* is not
|
|
328
|
+
spelled out. */
|
|
329
|
+
function dictionaryFor(active) {
|
|
330
|
+
var raw = active === undefined || active === null || active === "" ? "en" : String(active);
|
|
331
|
+
var tag = raw.toLowerCase().replace(/_/g, "-");
|
|
332
|
+
var primary = tag.split("-")[0];
|
|
333
|
+
if (primary === "zh") {
|
|
334
|
+
if (hasOwnKey(LOCALES, tag)) return LOCALES[tag];
|
|
335
|
+
if (tag.indexOf("hant") >= 0 || tag === "zh-hk" || tag === "zh-mo" || tag === "zh-tw") {
|
|
336
|
+
return hasOwnKey(LOCALES, "zh-hk") ? LOCALES["zh-hk"] : zh;
|
|
337
|
+
}
|
|
338
|
+
return zh;
|
|
339
|
+
}
|
|
340
|
+
if (hasOwnKey(LOCALES, primary)) return LOCALES[primary];
|
|
341
|
+
return en;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* The active locale tag, read fresh every time: DSH's language preference
|
|
345
|
+
switches live, so a value captured once at activation would keep answering
|
|
346
|
+
in the language that happened to be active when the card loaded. The
|
|
347
|
+
host-backed preference wins; the browser is the fallback. */
|
|
348
|
+
function activeLocaleOf(ctx) {
|
|
349
|
+
var active = "";
|
|
350
|
+
try {
|
|
351
|
+
var locale = ctx.get("locale");
|
|
352
|
+
if (locale !== undefined && typeof locale.getSnapshot === "function") {
|
|
353
|
+
var snapshot = locale.getSnapshot();
|
|
354
|
+
if (snapshot !== null && typeof snapshot === "object" && typeof snapshot.active === "string") active = snapshot.active;
|
|
355
|
+
}
|
|
356
|
+
} catch (error) { /* fall through to the browser */ }
|
|
357
|
+
if (active === "" && typeof navigator === "object" && navigator !== null && typeof navigator.language === "string") active = navigator.language;
|
|
358
|
+
return active;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* A live lookup: the dictionary is picked per call and cached under the tag
|
|
362
|
+
it was picked for, so a language switch costs one string compare per
|
|
363
|
+
string. Falling back to EN — kept key-complete on purpose — means an
|
|
364
|
+
unsupported language shows English, never a raw key. */
|
|
365
|
+
function translatorOf(ctx) {
|
|
366
|
+
var cachedTag = null;
|
|
367
|
+
var cachedDict = null;
|
|
368
|
+
return function (key) {
|
|
369
|
+
var tag = activeLocaleOf(ctx);
|
|
370
|
+
if (tag !== cachedTag) { cachedTag = tag; cachedDict = dictionaryFor(tag); }
|
|
371
|
+
if (hasOwnKey(cachedDict, key)) return cachedDict[key];
|
|
372
|
+
return hasOwnKey(en, key) ? en[key] : key;
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
71
376
|
// ── styles (gb- prefixed; tokens mirror PluginCard.module.css) ─────────
|
|
72
377
|
|
|
73
378
|
var STYLE_ID = "dsh-gitbash-shell-style";
|
|
@@ -140,13 +445,40 @@ window.__ModuleLoader__.load({
|
|
|
140
445
|
return this.props.children;
|
|
141
446
|
};
|
|
142
447
|
|
|
448
|
+
// ── live locale (repaint the card on a language switch) ─────────────────
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Wraps the card so a language switch repaints it instead of waiting for a
|
|
452
|
+
* page load. DSH's own components re-render on the locale snapshot, but this
|
|
453
|
+
* card belongs to a plugin: it subscribes for itself, and it hands the card
|
|
454
|
+
* THIS plugin's live lookup (translatorOf) — whose resolution covers the
|
|
455
|
+
* third languages the DSH catalog does not carry. The card stays inside the
|
|
456
|
+
* same quiet boundary as before.
|
|
457
|
+
*/
|
|
458
|
+
function LocaleLive(props) {
|
|
459
|
+
var tickState = useState(0);
|
|
460
|
+
var tick = tickState[0];
|
|
461
|
+
var setTick = tickState[1];
|
|
462
|
+
void tick;
|
|
463
|
+
|
|
464
|
+
useEffect(function () {
|
|
465
|
+
var locale = props.ctx && typeof props.ctx.get === "function" ? props.ctx.get("locale") : undefined;
|
|
466
|
+
if (locale === undefined || typeof locale.subscribe !== "function") return undefined;
|
|
467
|
+
var unsubscribe = locale.subscribe(function () { setTick(function (value) { return value + 1; }); });
|
|
468
|
+
return typeof unsubscribe === "function" ? unsubscribe : undefined;
|
|
469
|
+
}, []);
|
|
470
|
+
|
|
471
|
+
return E(QuietBoundary, null, E(GitBashCard, Object.assign({}, props.cardProps, { t: props.t })));
|
|
472
|
+
}
|
|
473
|
+
|
|
143
474
|
// ── settings card (module-level component) ───────────────────────────────
|
|
144
475
|
|
|
145
476
|
/**
|
|
146
|
-
* The Settings → Plugins card. t arrives
|
|
147
|
-
* locale
|
|
148
|
-
* Snapshots are read per render; each
|
|
149
|
-
* card re-reads without an external-store
|
|
477
|
+
* The Settings → Plugins card. t arrives from LocaleLive (the plugin's own
|
|
478
|
+
* live lookup, keyed on the active locale at call time); scope arrives as a
|
|
479
|
+
* PLAIN prop from the inject factory. Snapshots are read per render; each
|
|
480
|
+
* write bumps a local tick so the card re-reads without an external-store
|
|
481
|
+
* hook adapter.
|
|
150
482
|
*/
|
|
151
483
|
function GitBashCard(props) {
|
|
152
484
|
var t = typeof props.t === "function" ? props.t : function (key) { return key; };
|
|
@@ -235,11 +567,17 @@ window.__ModuleLoader__.load({
|
|
|
235
567
|
|
|
236
568
|
exports.apply = function (ctx) {
|
|
237
569
|
var scope = ctx.settingsScope.bind({ namespace: SETTINGS_NAMESPACE });
|
|
570
|
+
/* The card's only copy entry point: a live lookup, never a captured
|
|
571
|
+
dictionary — the language preference switches without a reload. */
|
|
572
|
+
var t = translatorOf(ctx);
|
|
238
573
|
|
|
239
574
|
ctx.effect(function () {
|
|
240
575
|
var disposers = [ensureStyles()];
|
|
241
576
|
try {
|
|
242
|
-
|
|
577
|
+
/* Every shipped dictionary rides the DSH locale registry, so host-side
|
|
578
|
+
consumers read the same copy the card does; a missing service simply
|
|
579
|
+
means the card is the only reader. */
|
|
580
|
+
var disposeDict = ctx.locale.register(NS, Object.assign({ zh: zh, en: en }, LOCALES));
|
|
243
581
|
if (typeof disposeDict === "function") disposers.push(disposeDict);
|
|
244
582
|
} catch (error) {
|
|
245
583
|
console.warn(TAG + " dictionary registration failed:", error && error.message ? error.message : error);
|
|
@@ -270,8 +608,11 @@ window.__ModuleLoader__.load({
|
|
|
270
608
|
// props: the bound settings scope rides here as a PLAIN member
|
|
271
609
|
// (top-level options fields do NOT reach the component).
|
|
272
610
|
inject: function () { return { scope: scope }; },
|
|
273
|
-
}, function
|
|
274
|
-
|
|
611
|
+
}, function CardWithLocale(props) {
|
|
612
|
+
/* The registration's locale field also hands out the framework's own
|
|
613
|
+
t seat; the plugin's lookup wins (21 locale tags against the catalog's
|
|
614
|
+
zh/en), passed last so no prop merge order can override it. */
|
|
615
|
+
return E(LocaleLive, { ctx: ctx, t: t, cardProps: props });
|
|
275
616
|
});
|
|
276
617
|
});
|
|
277
618
|
} catch (error) {
|
package/src/index.js
CHANGED
|
@@ -923,7 +923,7 @@ export async function apply(ctx, config = {}) {
|
|
|
923
923
|
const disposeGitBash = ctx.provide('gitBash', gitBashCapability)
|
|
924
924
|
ctx.effect(() => disposeGitBash, 'dsh-gitbash-shell: gitBash capability')
|
|
925
925
|
|
|
926
|
-
// ── settings namespace: the posixPaths switch (default
|
|
926
|
+
// ── settings namespace: the posixPaths switch (default ON, v0.10.0) ──────
|
|
927
927
|
// Served on the host so the Plugins tab pairs it with the browser card
|
|
928
928
|
// (the tab dispatches Host-served namespaces ∩ registered cards). Dynamic
|
|
929
929
|
// imports keep the zero-dependency smoke path importable; the schema MUST
|