Squash the current repository state back into one baseline commit while preserving the README reframing and repository contents. Constraint: User explicitly requested a single squashed commit with subject "asdf" Confidence: high Scope-risk: broad Reversibility: clean Directive: This commit intentionally rewrites published history; coordinate before future force-pushes Tested: git status clean; local history rewritten to one commit; force-pushed main to origin and instructkr Not-tested: Fresh clone verification after push
34 lines
981 B
TypeScript
34 lines
981 B
TypeScript
import { useMemo } from 'react'
|
|
import type { MCPServerConnection } from '../services/mcp/types.js'
|
|
|
|
export type IdeStatus = 'connected' | 'disconnected' | 'pending' | null
|
|
|
|
type IdeConnectionResult = {
|
|
status: IdeStatus
|
|
ideName: string | null
|
|
}
|
|
|
|
export function useIdeConnectionStatus(
|
|
mcpClients?: MCPServerConnection[],
|
|
): IdeConnectionResult {
|
|
return useMemo(() => {
|
|
const ideClient = mcpClients?.find(client => client.name === 'ide')
|
|
if (!ideClient) {
|
|
return { status: null, ideName: null }
|
|
}
|
|
// Extract IDE name from config if available
|
|
const config = ideClient.config
|
|
const ideName =
|
|
config.type === 'sse-ide' || config.type === 'ws-ide'
|
|
? config.ideName
|
|
: null
|
|
if (ideClient.type === 'connected') {
|
|
return { status: 'connected', ideName }
|
|
}
|
|
if (ideClient.type === 'pending') {
|
|
return { status: 'pending', ideName }
|
|
}
|
|
return { status: 'disconnected', ideName }
|
|
}, [mcpClients])
|
|
}
|