diff --git a/.changeset/fix-3362-windows-powershell-gemini.md b/.changeset/fix-3362-windows-powershell-gemini.md new file mode 100644 index 000000000..159d9168f --- /dev/null +++ b/.changeset/fix-3362-windows-powershell-gemini.md @@ -0,0 +1,6 @@ +--- +type: Fixed +pr: 3368 +--- + +**Gemini install output is valid on Windows PowerShell** - managed hook commands now use PowerShell's call operator when invoking quoted Node runners on Windows, and reinstall rewrites existing managed hooks without double-prefixing them. Gemini agent conversion also drops Claude-only `AskUserQuestion` / `ask_user` tool metadata and rewrites body references to runtime-neutral prompt wording. Fixes #3362. diff --git a/bin/install.js b/bin/install.js index 6095e9b15..f08396e14 100755 --- a/bin/install.js +++ b/bin/install.js @@ -594,8 +594,15 @@ function resolveNodeRunner() { * * Returns true if any entry was rewritten. */ -function rewriteLegacyManagedNodeHookCommands(settings, absoluteRunner) { +function formatHookCommandForShell(command, opts) { + const platform = (opts && opts.platform) || process.platform; + return platform === 'win32' ? `& ${command}` : command; +} + +function rewriteLegacyManagedNodeHookCommands(settings, absoluteRunner, opts) { if (!settings || !settings.hooks || !absoluteRunner) return false; + if (!opts) opts = {}; + const platform = opts.platform || process.platform; const MANAGED_HOOK_FILES = new Set([ 'gsd-check-update.js', 'gsd-statusline.js', @@ -613,7 +620,11 @@ function rewriteLegacyManagedNodeHookCommands(settings, absoluteRunner) { if (!entry || !Array.isArray(entry.hooks)) continue; for (const h of entry.hooks) { if (!h || typeof h.command !== 'string') continue; - const trimmed = h.command.trim(); + let trimmed = h.command.trim(); + const hadPowerShellCallOperator = platform === 'win32' && /^&\s+/.test(trimmed); + if (hadPowerShellCallOperator) { + trimmed = trimmed.replace(/^&\s+/, '').trim(); + } // Match two runner forms: // 1. Legacy bare-node form: `node