dsh-gitbash-shell 0.5.1 → 0.5.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 +1 -1
- package/package.json +1 -1
- package/src/index.js +21 -8
package/dsh.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-gitbash-shell",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.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。联动 dsh-ptc-cordis-preset:两者同装时 PTC 创造模式自动物化为 Git Bash 版。",
|
|
6
6
|
"engines": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-gitbash-shell",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.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.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
package/src/index.js
CHANGED
|
@@ -246,18 +246,32 @@ export function installRegisterShim(reg) {
|
|
|
246
246
|
// this plugin returns the sidebar to what it was before.
|
|
247
247
|
|
|
248
248
|
const SIDEBAR_NS = 'dsh-better-sidebar'
|
|
249
|
+
const SIDEBAR_TRIES = 12
|
|
250
|
+
const SIDEBAR_RETRY_MS = 1500
|
|
249
251
|
|
|
250
252
|
/**
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
253
|
+
* Write the sidebar's `terminalShell` pref through the settings service.
|
|
254
|
+
* Polls until the settings service (and the sidebar's namespace) are ready:
|
|
255
|
+
* at boot the service may not be provided yet when this row's apply runs, so
|
|
256
|
+
* the first attempt can silently see nothing — every attempt after the first
|
|
257
|
+
* catches the service once it exists. Never throws; always logs the outcome.
|
|
254
258
|
*/
|
|
255
259
|
function adoptSidebarShell(ctx, bashPath) {
|
|
256
260
|
let tried = 0
|
|
261
|
+
let timer = null
|
|
262
|
+
ctx.effect(() => () => { if (timer) clearTimeout(timer) }, 'dsh-gitbash-shell: sidebar adoption polling')
|
|
257
263
|
const run = async () => {
|
|
258
264
|
tried += 1
|
|
259
265
|
const settings = ctx.get('settings')
|
|
260
|
-
|
|
266
|
+
const ready = settings && typeof settings.update === 'function' && typeof settings.get === 'function'
|
|
267
|
+
if (!ready) {
|
|
268
|
+
if (tried < SIDEBAR_TRIES) {
|
|
269
|
+
timer = setTimeout(run, SIDEBAR_RETRY_MS)
|
|
270
|
+
return
|
|
271
|
+
}
|
|
272
|
+
console.log(`${TAG} better-sidebar shell adoption skipped: settings service unavailable after ${tried} tries`)
|
|
273
|
+
return
|
|
274
|
+
}
|
|
261
275
|
let current
|
|
262
276
|
try {
|
|
263
277
|
current = settings.get(SIDEBAR_NS)
|
|
@@ -269,9 +283,8 @@ function adoptSidebarShell(ctx, bashPath) {
|
|
|
269
283
|
try {
|
|
270
284
|
await settings.update(SIDEBAR_NS, { terminalShell: bashPath })
|
|
271
285
|
} catch (error) {
|
|
272
|
-
if (tried <
|
|
273
|
-
|
|
274
|
-
ctx.effect(() => () => clearTimeout(timer), 'dsh-gitbash-shell: sidebar adoption retry')
|
|
286
|
+
if (tried < SIDEBAR_TRIES) {
|
|
287
|
+
timer = setTimeout(run, SIDEBAR_RETRY_MS)
|
|
275
288
|
return
|
|
276
289
|
}
|
|
277
290
|
console.log(`${TAG} better-sidebar shell adoption unavailable: ${error?.message ?? error}`)
|
|
@@ -291,7 +304,7 @@ function adoptSidebarShell(ctx, bashPath) {
|
|
|
291
304
|
return
|
|
292
305
|
}
|
|
293
306
|
if (String(now?.terminalShell ?? '') === bashPath) {
|
|
294
|
-
s.update(SIDEBAR_NS, { terminalShell:
|
|
307
|
+
s.update(SIDEBAR_NS, { terminalShell: previous }).catch(() => {})
|
|
295
308
|
}
|
|
296
309
|
},
|
|
297
310
|
'dsh-gitbash-shell: sidebar shell revert',
|