dsh-gitbash-shell 0.20.0 → 0.20.1
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 +1 -1
- package/package.json +1 -1
- package/src/index.js +33 -2
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-gitbash-shell",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.1",
|
|
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.20.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Windows 上让 agent 的每条 shell 命令改经 Git for Windows bash 执行;物化四个内置预设的 Git Bash 变体,统一 MSYS 盘根路径方言,侧栏终端接管可开关。· Run every agent shell command through Git for Windows bash on Windows; materialize Git Bash variants of the built-in presets, unify the MSYS drive-root path dialect, and adopt the sidebar terminal behind a switch.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
package/src/index.js
CHANGED
|
@@ -663,10 +663,30 @@ export function installRegisterShim(reg) {
|
|
|
663
663
|
const SETTINGS_NAMESPACE = 'gitbash-shell'
|
|
664
664
|
|
|
665
665
|
/** The full directive text, injected only while posixPaths is on. */
|
|
666
|
-
const POSIX_DIRECTIVE_TEXT = 'The working shell is Git for Windows bash: paths use MSYS drive roots (/c/Users/...), and every tool accepts that form directly — including the bash-native habits (~ home shorthand, /tmp, /dev/null, /usr/bin/...), which resolve in every tool exactly as bash itself resolves them.
|
|
666
|
+
const POSIX_DIRECTIVE_TEXT = 'The working shell is Git for Windows bash: paths use MSYS drive roots (/c/Users/...), and every tool accepts that form directly — including the bash-native habits (~ home shorthand, /tmp, /dev/null, /usr/bin/...), which resolve in every tool exactly as bash itself resolves them.'
|
|
667
667
|
|
|
668
668
|
/** Strict drive-root-only directive (v0.19.0): used while virtualMounts is off. */
|
|
669
|
-
const POSIX_DIRECTIVE_TEXT_STRICT = 'The working shell is Git for Windows bash: paths use MSYS drive roots (/c/Users/...), and every tool accepts that form directly
|
|
669
|
+
const POSIX_DIRECTIVE_TEXT_STRICT = 'The working shell is Git for Windows bash: paths use MSYS drive roots (/c/Users/...), and every tool accepts that form directly.'
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* The run_code sentence is added ONLY for assemblies whose tool list actually
|
|
673
|
+
* carries run_code (v0.20.1): a preset without it — standard/cordis sessions,
|
|
674
|
+
* or a code-mode session whose tool row is disabled — has no program text to
|
|
675
|
+
* write paths into, so the sentence would be pure noise there. Cheap and
|
|
676
|
+
* honest: the tool list of the very assembly being rendered decides.
|
|
677
|
+
*/
|
|
678
|
+
const RUN_CODE_DIRECTIVE_TEXT = ' Path literals written inside a run_code program are translated the same way before the program runs; shell expansion is not available there, so spell paths out instead of relying on $VARS.'
|
|
679
|
+
const RUN_CODE_DIRECTIVE_STRICT_TEXT = ' Path literals written inside a run_code program are translated before the program runs.'
|
|
680
|
+
|
|
681
|
+
/** The run_code sentence for this assembly, or '' when the tool is not offered. */
|
|
682
|
+
export function runCodeHintFor(tools) {
|
|
683
|
+
if (!Array.isArray(tools)) return ''
|
|
684
|
+
for (const tool of tools) {
|
|
685
|
+
const name = tool && typeof tool.name === 'string' ? tool.name : ''
|
|
686
|
+
if (name === 'run_code') return RUN_CODE_DIRECTIVE_TEXT
|
|
687
|
+
}
|
|
688
|
+
return ''
|
|
689
|
+
}
|
|
670
690
|
|
|
671
691
|
// Official runtime counterpart to the directive (v0.11.0): dsh-shell-env is
|
|
672
692
|
// the host-plane registry behind the model-visible $DSH_* facts, and the
|
|
@@ -1689,6 +1709,17 @@ export async function apply(ctx, config = {}) {
|
|
|
1689
1709
|
if (typeof variables[key] === 'string') variables[key] = windowsToMsys(variables[key])
|
|
1690
1710
|
}
|
|
1691
1711
|
}
|
|
1712
|
+
// v0.20.1: the run_code sentence rides the SAME context entry, but
|
|
1713
|
+
// only when this assembly actually offers the tool (see
|
|
1714
|
+
// runCodeHintFor) — every other mode stays quiet.
|
|
1715
|
+
const hint = runCodeHintFor(assembly.tools)
|
|
1716
|
+
if (hint !== '') {
|
|
1717
|
+
for (const assembled of Array.isArray(assembly.contexts) ? assembly.contexts : []) {
|
|
1718
|
+
if (assembled && assembled.name === 'gitbash-shell:posix-paths' && typeof assembled.text === 'string') {
|
|
1719
|
+
assembled.text += hint
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1692
1723
|
}
|
|
1693
1724
|
} catch { /* never block assembly */ }
|
|
1694
1725
|
return next()
|