@miphamai/cli 0.24.11 → 0.24.13
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/bin/mipham.ts +22 -11
- package/package.json +1 -1
package/bin/mipham.ts
CHANGED
|
@@ -308,26 +308,37 @@ async function runUpdate(): Promise<boolean> {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
async function main() {
|
|
311
|
-
// ── Disable terminal
|
|
312
|
-
// Ctrl+S
|
|
313
|
-
//
|
|
311
|
+
// ── Disable terminal special characters ──────────────────────────────────
|
|
312
|
+
// Terminal intercepts Ctrl+S (XOFF), Ctrl+T (SIGINFO/status), Ctrl+R (rprnt)
|
|
313
|
+
// before the app sees them. Disable these so Agent Dashboard shortcuts work.
|
|
314
|
+
// IMPORTANT: stty needs the real terminal on stdin — 'ignore' won't work.
|
|
314
315
|
const { execSync } = await import('node:child_process')
|
|
316
|
+
let savedStty = ''
|
|
315
317
|
try {
|
|
316
|
-
execSync('stty -
|
|
318
|
+
savedStty = execSync('stty -g', {
|
|
319
|
+
encoding: 'utf-8',
|
|
320
|
+
stdio: ['inherit', 'pipe', 'ignore'],
|
|
321
|
+
}).trim()
|
|
322
|
+
execSync('stty -ixon stop undef start undef status undef rprnt undef', {
|
|
323
|
+
stdio: ['inherit', 'ignore', 'ignore'],
|
|
324
|
+
})
|
|
317
325
|
} catch {
|
|
318
|
-
// Non-POSIX platform (Windows) — no
|
|
326
|
+
// Non-POSIX platform (Windows) — no special chars to disable
|
|
319
327
|
}
|
|
320
|
-
// Restore
|
|
321
|
-
const
|
|
328
|
+
// Restore original terminal settings on exit
|
|
329
|
+
const restoreTerminal = () => {
|
|
330
|
+
if (!savedStty) return
|
|
322
331
|
try {
|
|
323
|
-
execSync(
|
|
332
|
+
execSync(`stty ${savedStty}`, {
|
|
333
|
+
stdio: ['inherit', 'ignore', 'ignore'],
|
|
334
|
+
})
|
|
324
335
|
} catch {
|
|
325
336
|
/* ignore */
|
|
326
337
|
}
|
|
327
338
|
}
|
|
328
|
-
process.on('exit',
|
|
329
|
-
process.on('SIGINT',
|
|
330
|
-
process.on('SIGTERM',
|
|
339
|
+
process.on('exit', restoreTerminal)
|
|
340
|
+
process.on('SIGINT', restoreTerminal)
|
|
341
|
+
process.on('SIGTERM', restoreTerminal)
|
|
331
342
|
|
|
332
343
|
// ── Read version fresh from package.json at startup (bypasses Bun module cache) ──
|
|
333
344
|
const { readFileSync } = await import('node:fs')
|