- wizard.ts: also check for \b (0x08) which Windows terminals send for backspace - browser-tools: read BROWSER_PATH env var and pass as executablePath to Playwright Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
71f749c6da
commit
a32d6fb7b5
2 changed files with 18 additions and 6 deletions
|
|
@ -343,7 +343,10 @@ async function ensureBrowser(): Promise<{ browser: Browser; context: BrowserCont
|
|||
// Lazy import so playwright is only loaded when actually needed
|
||||
const { chromium } = await import("playwright");
|
||||
|
||||
browser = await chromium.launch({ headless: false });
|
||||
const launchOptions: Record<string, unknown> = { headless: false };
|
||||
const customPath = process.env.BROWSER_PATH;
|
||||
if (customPath) launchOptions.executablePath = customPath;
|
||||
browser = await chromium.launch(launchOptions);
|
||||
context = await browser.newContext({
|
||||
deviceScaleFactor: 2,
|
||||
viewport: { width: 1280, height: 800 },
|
||||
|
|
|
|||
|
|
@ -26,6 +26,17 @@ async function promptMasked(label: string, hint: string): Promise<string> {
|
|||
process.stdin.resume()
|
||||
process.stdin.setEncoding('utf8')
|
||||
let value = ''
|
||||
const redraw = () => {
|
||||
process.stdout.clearLine(0)
|
||||
process.stdout.cursorTo(0)
|
||||
if (value.length === 0) {
|
||||
process.stdout.write(' ')
|
||||
} else {
|
||||
const dots = '●'.repeat(Math.min(value.length, 24))
|
||||
const counter = value.length > 24 ? ` ${dim}(${value.length})${reset}` : ` ${dim}${value.length}${reset}`
|
||||
process.stdout.write(` ${dots}${counter}`)
|
||||
}
|
||||
}
|
||||
const handler = (ch: string) => {
|
||||
if (ch === '\r' || ch === '\n') {
|
||||
process.stdin.setRawMode(false)
|
||||
|
|
@ -37,16 +48,14 @@ async function promptMasked(label: string, hint: string): Promise<string> {
|
|||
process.stdin.setRawMode(false)
|
||||
process.stdout.write('\n')
|
||||
process.exit(0)
|
||||
} else if (ch === '\u007f') {
|
||||
} else if (ch === '\u007f' || ch === '\b') {
|
||||
if (value.length > 0) {
|
||||
value = value.slice(0, -1)
|
||||
}
|
||||
process.stdout.clearLine(0)
|
||||
process.stdout.cursorTo(0)
|
||||
process.stdout.write(' ' + '*'.repeat(value.length))
|
||||
redraw()
|
||||
} else {
|
||||
value += ch
|
||||
process.stdout.write('*')
|
||||
redraw()
|
||||
}
|
||||
}
|
||||
process.stdin.on('data', handler)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue