dsh-gitbash-shell 0.17.0 → 0.17.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 +47 -6
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-gitbash-shell",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.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.17.
|
|
3
|
+
"version": "0.17.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
|
@@ -724,6 +724,38 @@ function posixSeparators(value) {
|
|
|
724
724
|
: value
|
|
725
725
|
}
|
|
726
726
|
|
|
727
|
+
/**
|
|
728
|
+
* Rewrite Windows absolute paths inside an ERROR result's text blocks to
|
|
729
|
+
* the MSYS dialect (pure, v0.17.1). Error results cannot carry a
|
|
730
|
+
* replacement `value` (the registry rejects that), but replacing `content`
|
|
731
|
+
* is the official post-execute channel, so the message the model reads
|
|
732
|
+
* stays in one dialect — it must not relearn Windows forms from failure
|
|
733
|
+
* text. Non-drive-letter diagnostics (device paths, URLs) never match
|
|
734
|
+
* windowsToMsys and are left verbatim.
|
|
735
|
+
*/
|
|
736
|
+
/**
|
|
737
|
+
* The only tools whose ERROR content is dialect-translated (v0.17.1).
|
|
738
|
+
* These messages are harness-generated path diagnostics (cannot read
|
|
739
|
+
* "C:\..."), so rewriting them is safe. Every other tool — bash above all,
|
|
740
|
+
* whose failed runs carry raw command stdout/stderr — keeps its error
|
|
741
|
+
* content VERBATIM: output is data, never rewritten (the same red line as
|
|
742
|
+
* file content in successful results).
|
|
743
|
+
*/
|
|
744
|
+
const ERROR_CONTENT_TOOLS = new Set(['read', 'read_image', 'write', 'edit', 'glob', 'grep', 'present'])
|
|
745
|
+
|
|
746
|
+
export function rewriteErrorContent(content) {
|
|
747
|
+
if (!Array.isArray(content)) return content
|
|
748
|
+
let changed = false
|
|
749
|
+
const next = content.map((block) => {
|
|
750
|
+
if (!block || typeof block !== 'object' || typeof block.text !== 'string') return block
|
|
751
|
+
const out = windowsToMsys(block.text)
|
|
752
|
+
if (out === block.text) return block
|
|
753
|
+
changed = true
|
|
754
|
+
return { ...block, text: out }
|
|
755
|
+
})
|
|
756
|
+
return changed ? next : content
|
|
757
|
+
}
|
|
758
|
+
|
|
727
759
|
export function rewriteResultPaths(name, value, env) {
|
|
728
760
|
if (!value || typeof value !== 'object') return value
|
|
729
761
|
// v0.17.0: paths under the user TEMP directory echo back in the bash
|
|
@@ -1369,17 +1401,26 @@ export async function apply(ctx, config = {}) {
|
|
|
1369
1401
|
try {
|
|
1370
1402
|
ctx.on('tools/post-execute', (exec, result, next) => {
|
|
1371
1403
|
let patch
|
|
1404
|
+
let contentPatch
|
|
1372
1405
|
try {
|
|
1373
|
-
if (readPosixPaths(ctx) && result &&
|
|
1374
|
-
|
|
1375
|
-
|
|
1406
|
+
if (readPosixPaths(ctx) && result && typeof result === 'object') {
|
|
1407
|
+
if (result.isError === false && result.value && typeof result.value === 'object') {
|
|
1408
|
+
const value = rewriteResultPaths(exec && exec.name, result.value, buildTranslateEnv())
|
|
1409
|
+
if (value !== result.value) patch = value
|
|
1410
|
+
} else if (result.isError === true && exec && ERROR_CONTENT_TOOLS.has(exec.name) && Array.isArray(result.content)) {
|
|
1411
|
+
const content = rewriteErrorContent(result.content)
|
|
1412
|
+
if (content !== result.content) contentPatch = content
|
|
1413
|
+
}
|
|
1376
1414
|
}
|
|
1377
1415
|
} catch { /* never block a result */ }
|
|
1378
1416
|
const chain = next()
|
|
1379
|
-
if (patch === undefined) return chain
|
|
1417
|
+
if (patch === undefined && contentPatch === undefined) return chain
|
|
1380
1418
|
return chain.then((decision) => {
|
|
1381
1419
|
try {
|
|
1382
|
-
if (decision && decision.kind === 'accept')
|
|
1420
|
+
if (decision && decision.kind === 'accept') {
|
|
1421
|
+
if (patch !== undefined) return { ...decision, value: patch }
|
|
1422
|
+
return { ...decision, content: contentPatch }
|
|
1423
|
+
}
|
|
1383
1424
|
} catch { /* keep the downstream decision */ }
|
|
1384
1425
|
return decision
|
|
1385
1426
|
})
|
|
@@ -1510,4 +1551,4 @@ export async function apply(ctx, config = {}) {
|
|
|
1510
1551
|
}
|
|
1511
1552
|
|
|
1512
1553
|
// Test surface: pure helpers, no Cordis context required.
|
|
1513
|
-
export const _internal = { PRESET_IDS, translateMsysPath, translatePathArguments, translateGlobArguments, buildTranslateEnv, readPosixPaths, readAdoptSidebar, windowsToMsys, rewriteResultPaths, MARKER_FILE, classify, materialize, cleanupOnDispose, firstUserRoot, hashTree, skillsHashes, syncDecision, installRegisterShim, baseForRoster, detectBase, pickComposition, personaEraForText, detectPersonaEra, injectPresentRow, hostHasToolPresent, detectPresentSupport, injectPluginManagerRow, hostHasPluginManagerTools, rowFormOf, rowFormsOf, alignEngineRow, alignRalphRow, ROW_SOURCE }
|
|
1554
|
+
export const _internal = { PRESET_IDS, translateMsysPath, translatePathArguments, translateGlobArguments, buildTranslateEnv, rewriteErrorContent, ERROR_CONTENT_TOOLS, readPosixPaths, readAdoptSidebar, windowsToMsys, rewriteResultPaths, MARKER_FILE, classify, materialize, cleanupOnDispose, firstUserRoot, hashTree, skillsHashes, syncDecision, installRegisterShim, baseForRoster, detectBase, pickComposition, personaEraForText, detectPersonaEra, injectPresentRow, hostHasToolPresent, detectPresentSupport, injectPluginManagerRow, hostHasPluginManagerTools, rowFormOf, rowFormsOf, alignEngineRow, alignRalphRow, ROW_SOURCE }
|