From a1763a3e44193137124016fbd518ca6652ab7b10 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Wed, 18 Mar 2026 13:41:47 -0700 Subject: [PATCH] feat(workspaces): improve prompt UX for sensitive defaults and mask API keys --- .gemini/skills/workspaces/scripts/setup.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gemini/skills/workspaces/scripts/setup.ts b/.gemini/skills/workspaces/scripts/setup.ts index 0cd7577f8c..7ffd7e3e74 100644 --- a/.gemini/skills/workspaces/scripts/setup.ts +++ b/.gemini/skills/workspaces/scripts/setup.ts @@ -9,7 +9,7 @@ import { ProviderFactory } from './providers/ProviderFactory.ts'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const REPO_ROOT = path.resolve(__dirname, '../../../..'); -async function prompt(question: string, defaultValue: string, explanation?: string): Promise { +async function prompt(question: string, defaultValue: string, explanation?: string, sensitive: boolean = false): Promise { const autoAccept = process.argv.includes('--yes') || process.argv.includes('-y'); if (autoAccept && defaultValue) return defaultValue; @@ -17,9 +17,10 @@ async function prompt(question: string, defaultValue: string, explanation?: stri console.log(`\nšŸ“– ${explanation}`); } + const displayDefault = sensitive && defaultValue ? `${defaultValue.substring(0, 4)}...${defaultValue.substring(defaultValue.length - 4)}` : defaultValue; const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); return new Promise((resolve) => { - rl.question(`ā“ ${question} (default: ${defaultValue}, to use default): `, (answer) => { + rl.question(`ā“ ${question} (default: ${displayDefault || 'none'}, to use default): `, (answer) => { rl.close(); resolve(answer.trim() || defaultValue); }); @@ -195,7 +196,7 @@ and full builds) to a dedicated, high-performance GCP worker. if (authStrategy === 'gemini-api-key' && !geminiApiKey) { console.log('\nšŸ“– In API Key mode, the remote worker needs your Gemini API Key to authenticate.'); - geminiApiKey = await prompt('Paste Gemini API Key', ''); + geminiApiKey = await prompt('Paste Gemini API Key', '', undefined, true); } // 5. Save Confirmed State