fix: detect OS for update banner install command (#265) (#270)

Windows users were always shown the bash install command. Now uses
navigator.platform to show the PowerShell command on Windows.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Ramos
2026-03-10 08:53:05 -07:00
committed by GitHub
parent b6bec6943b
commit 1480915f67
+8 -2
View File
@@ -1,9 +1,15 @@
import React, { useState } from 'react';
import { useUpdateCheck } from '../hooks/useUpdateCheck';
const DEFAULT_INSTALL_COMMAND = 'curl -fsSL https://plannotator.ai/install.sh | bash';
const PI_INSTALL_COMMAND = 'pi install npm:@plannotator/pi-extension';
function getInstallCommand(): string {
const isWindows = typeof navigator !== 'undefined' && /^Win/.test(navigator.platform);
return isWindows
? 'powershell -c "irm https://plannotator.ai/install.ps1 | iex"'
: 'curl -fsSL https://plannotator.ai/install.sh | bash';
}
interface UpdateBannerProps {
origin?: 'claude-code' | 'opencode' | 'pi' | null;
}
@@ -19,7 +25,7 @@ export const UpdateBanner: React.FC<UpdateBannerProps> = ({ origin }) => {
const effectiveOrigin = previewOrigin || origin;
const isPi = effectiveOrigin === 'pi';
const isOpenCode = effectiveOrigin === 'opencode';
const installCommand = isPi ? PI_INSTALL_COMMAND : DEFAULT_INSTALL_COMMAND;
const installCommand = isPi ? PI_INSTALL_COMMAND : getInstallCommand();
if (!updateInfo?.updateAvailable || dismissed) return null;