@@ -337,6 +337,20 @@ function isTauriRuntime() {
337337 return typeof window !== "undefined" && ( window as any ) . __TAURI_INTERNALS__ != null ;
338338}
339339
340+ function isWindowsPlatform ( ) {
341+ if ( typeof navigator === "undefined" ) return false ;
342+
343+ const ua = typeof navigator . userAgent === "string" ? navigator . userAgent : "" ;
344+ const platform =
345+ typeof ( navigator as any ) . userAgentData ?. platform === "string"
346+ ? ( navigator as any ) . userAgentData . platform
347+ : typeof navigator . platform === "string"
348+ ? navigator . platform
349+ : "" ;
350+
351+ return / w i n d o w s / i. test ( platform ) || / w i n d o w s / i. test ( ua ) ;
352+ }
353+
340354function readModePreference ( ) : Mode | null {
341355 if ( typeof window === "undefined" ) return null ;
342356
@@ -1630,7 +1644,9 @@ export default function App() {
16301644
16311645 if ( ! result . found ) {
16321646 setError (
1633- "OpenCode CLI not found. Install with `brew install anomalyco/tap/opencode` or `curl -fsSL https://opencode.ai/install | bash`, then retry." ,
1647+ isWindowsPlatform ( )
1648+ ? "OpenCode CLI not found. Install OpenCode for Windows, then restart OpenWork. If it is installed, ensure `opencode.exe` is on PATH (try `opencode --version` in PowerShell)."
1649+ : "OpenCode CLI not found. Install with `brew install anomalyco/tap/opencode` or `curl -fsSL https://opencode.ai/install | bash`, then retry." ,
16341650 ) ;
16351651 return false ;
16361652 }
@@ -1655,7 +1671,13 @@ export default function App() {
16551671 setAuthorizedDirs ( [ dir ] ) ;
16561672 }
16571673
1674+ if ( isWindowsPlatform ( ) && engineSource ( ) === "sidecar" ) {
1675+ setEngineSource ( "path" ) ;
1676+ setError ( "Sidecar OpenCode is not supported on Windows yet. Using PATH instead." ) ;
1677+ }
1678+
16581679 const info = await engineStart ( dir , { preferSidecar : engineSource ( ) === "sidecar" } ) ;
1680+
16591681 setEngine ( info ) ;
16601682
16611683 if ( info . baseUrl ) {
@@ -3092,45 +3114,79 @@ export default function App() {
30923114
30933115 < Show when = { engineDoctorResult ( ) && ! engineDoctorResult ( ) ! . found } >
30943116 < div class = "mt-4 space-y-2" >
3095- < div class = "text-xs text-zinc-500" > Install one of these:</ div >
3096- < div class = "rounded-xl bg-black/40 border border-zinc-800 px-3 py-2 font-mono text-xs text-zinc-300" >
3097- brew install anomalyco/tap/opencode
3098- </ div >
3099- < div class = "rounded-xl bg-black/40 border border-zinc-800 px-3 py-2 font-mono text-xs text-zinc-300" >
3100- curl -fsSL https://opencode.ai/install | bash
3101- </ div >
3117+ < Show
3118+ when = { isWindowsPlatform ( ) }
3119+ fallback = {
3120+ < >
3121+ < div class = "text-xs text-zinc-500" > Install one of these:</ div >
3122+ < div class = "rounded-xl bg-black/40 border border-zinc-800 px-3 py-2 font-mono text-xs text-zinc-300" >
3123+ brew install anomalyco/tap/opencode
3124+ </ div >
3125+ < div class = "rounded-xl bg-black/40 border border-zinc-800 px-3 py-2 font-mono text-xs text-zinc-300" >
3126+ curl -fsSL https://opencode.ai/install | bash
3127+ </ div >
3128+ </ >
3129+ }
3130+ >
3131+ < >
3132+ < div class = "text-xs text-zinc-500" > Install OpenCode for Windows:</ div >
3133+ < div class = "rounded-xl bg-black/40 border border-zinc-800 px-3 py-2 font-mono text-xs text-zinc-300" >
3134+ https://opencode.ai/install
3135+ </ div >
3136+ < div class = "text-[11px] text-zinc-600" >
3137+ After installing, make sure `opencode.exe` is available on PATH (try `opencode --version`).
3138+ </ div >
3139+ </ >
3140+ </ Show >
31023141
31033142 < div class = "flex gap-2 pt-2" >
3104- < Button
3105- onClick = { async ( ) => {
3106- setError ( null ) ;
3107- setEngineInstallLogs ( null ) ;
3108- setBusy ( true ) ;
3109- setBusyLabel ( "Installing OpenCode" ) ;
3110- setBusyStartedAt ( Date . now ( ) ) ;
3111-
3112- try {
3113- const result = await engineInstall ( ) ;
3114- const combined = `${ result . stdout } ${ result . stderr ? `\n${ result . stderr } ` : "" } ` . trim ( ) ;
3115- setEngineInstallLogs ( combined || null ) ;
3116-
3117- if ( ! result . ok ) {
3118- setError ( result . stderr . trim ( ) || "OpenCode install failed. See logs above." ) ;
3119- }
3120-
3121- await refreshEngineDoctor ( ) ;
3122- } catch ( e ) {
3123- setError ( e instanceof Error ? e . message : safeStringify ( e ) ) ;
3124- } finally {
3125- setBusy ( false ) ;
3126- setBusyLabel ( null ) ;
3127- setBusyStartedAt ( null ) ;
3128- }
3129- } }
3130- disabled = { busy ( ) }
3143+ < Show
3144+ when = { ! isWindowsPlatform ( ) }
3145+ fallback = {
3146+ < Button
3147+ variant = "outline"
3148+ onClick = { ( ) => {
3149+ setEngineInstallLogs (
3150+ "Windows install is currently manual. Visit https://opencode.ai/install then restart OpenWork. If OpenCode is installed but not detected, ensure opencode.exe is on PATH." ,
3151+ ) ;
3152+ } }
3153+ disabled = { busy ( ) }
3154+ >
3155+ Show Windows install notes
3156+ </ Button >
3157+ }
31313158 >
3132- Install OpenCode
3133- </ Button >
3159+ < Button
3160+ onClick = { async ( ) => {
3161+ setError ( null ) ;
3162+ setEngineInstallLogs ( null ) ;
3163+ setBusy ( true ) ;
3164+ setBusyLabel ( "Installing OpenCode" ) ;
3165+ setBusyStartedAt ( Date . now ( ) ) ;
3166+
3167+ try {
3168+ const result = await engineInstall ( ) ;
3169+ const combined = `${ result . stdout } ${ result . stderr ? `\n${ result . stderr } ` : "" } ` . trim ( ) ;
3170+ setEngineInstallLogs ( combined || null ) ;
3171+
3172+ if ( ! result . ok ) {
3173+ setError ( result . stderr . trim ( ) || "OpenCode install failed. See logs above." ) ;
3174+ }
3175+
3176+ await refreshEngineDoctor ( ) ;
3177+ } catch ( e ) {
3178+ setError ( e instanceof Error ? e . message : safeStringify ( e ) ) ;
3179+ } finally {
3180+ setBusy ( false ) ;
3181+ setBusyLabel ( null ) ;
3182+ setBusyStartedAt ( null ) ;
3183+ }
3184+ } }
3185+ disabled = { busy ( ) }
3186+ >
3187+ Install OpenCode
3188+ </ Button >
3189+ </ Show >
31343190 < Button
31353191 variant = "outline"
31363192 onClick = { ( ) => {
@@ -4083,13 +4139,17 @@ export default function App() {
40834139 < Button
40844140 variant = { engineSource ( ) === "sidecar" ? "secondary" : "outline" }
40854141 onClick = { ( ) => setEngineSource ( "sidecar" ) }
4086- disabled = { busy ( ) }
4142+ disabled = { busy ( ) || isWindowsPlatform ( ) }
4143+ title = { isWindowsPlatform ( ) ? "Sidecar is not supported on Windows yet" : "" }
40874144 >
40884145 Sidecar
40894146 </ Button >
40904147 </ div >
40914148 < div class = "text-[11px] text-zinc-600" >
40924149 PATH uses your installed OpenCode (default). Sidecar will use a bundled binary when available.
4150+ < Show when = { isWindowsPlatform ( ) } >
4151+ < span class = "text-zinc-500" > Sidecar is currently unavailable on Windows.</ span >
4152+ </ Show >
40934153 </ div >
40944154 </ div >
40954155 </ Show >
0 commit comments