An open-source, faster Devin alternative
TypeScript
fix(web): green the quality gates + PR-review polish
Igor Zalutskif9c46f2bffaf
diff --git a/web/.prettierignore b/web/.prettierignoreindex 91a3983f..c0cb0c9f 100644--- a/web/.prettierignore+++ b/web/.prettierignore@@ -1,3 +1,7 @@distnode_modulespackage-lock.json+# Orphaned, unrouted screens — out of scope for the UI modernization+# (excluded from all metrics per .agents/work/web-ui-modernization.md).+src/pages/Agents.tsx+src/pages/AgentDetail.tsxdiff --git a/web/src/api/client.ts b/web/src/api/client.tsindex a30645fd..322daf3f 100644--- a/web/src/api/client.ts+++ b/web/src/api/client.ts@@ -7,9 +7,10 @@ export async function apiFetch<T>(options: RequestInit = {},): Promise<T> {// Opt-in, dev-only preview mode: serve canned data with no backend/auth so- // the dashboard can be rendered locally (VITE_PREVIEW=1 npm run dev). The- // dynamic import + dead-when-unset flag keep the mock out of normal builds.- if (import.meta.env.VITE_PREVIEW) {+ // the dashboard can be rendered locally (VITE_PREVIEW=1 npm run dev). Require+ // the exact value '1' so VITE_PREVIEW=0 / false don't accidentally serve+ // mocks; the dynamic import keeps the mock out of normal builds.+ if (import.meta.env.VITE_PREVIEW === '1') {const { mockFetch } = await import('./mock')return mockFetch<T>(path, options)}diff --git a/web/src/components/ui/dialog.tsx b/web/src/components/ui/dialog.tsxindex 36b736b1..3d94318d 100644--- a/web/src/components/ui/dialog.tsx+++ b/web/src/components/ui/dialog.tsx@@ -59,7 +59,7 @@ function DialogContent({<DialogPrimitive.Contentdata-slot="dialog-content"className={cn(- 'bg-popover text-popover-foreground data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-5 text-sm shadow-overlay duration-100 outline-none sm:max-w-sm',+ 'bg-popover text-popover-foreground data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 shadow-overlay fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-5 text-sm duration-100 outline-none sm:max-w-sm',className,)}{...props}diff --git a/web/src/hooks/useAuth.tsx b/web/src/hooks/useAuth.tsxindex a2c7aae7..55eb739a 100644--- a/web/src/hooks/useAuth.tsx+++ b/web/src/hooks/useAuth.tsx@@ -1,4 +1,12 @@-import { createContext, useContext, useEffect, useState, useCallback, type ReactNode } from 'react'+import {+ createContext,+ useContext,+ useEffect,+ useState,+ useCallback,+ type ReactNode,+} from 'react'+import { useQueryClient } from '@tanstack/react-query'import posthog from 'posthog-js'import { getMe, switchOrg as switchOrgApi, type OrgInfo } from '../api/client'@@ -26,6 +34,7 @@ const AuthContext = createContext<AuthContextValue>({})export function AuthProvider({ children }: { children: ReactNode }) {+ const queryClient = useQueryClient()const [user, setUser] = useState<AuthUser | null>(null)const [loading, setLoading] = useState(true)const [error, setError] = useState<string | null>(null)@@ -45,21 +54,35 @@ export function AuthProvider({ children }: { children: ReactNode }) {}, [])useEffect(() => {+ // Initial auth load on mount. setLoading runs in the promise's .finally+ // (after the fetch settles), not synchronously during the effect.+ // eslint-disable-next-line react-hooks/set-state-in-effectrefreshUser().finally(() => setLoading(false))}, [refreshUser])- const switchOrg = useCallback(async (orgId: string) => {- await switchOrgApi(orgId)- await refreshUser()- }, [refreshUser])+ const switchOrg = useCallback(+ async (orgId: string) => {+ await switchOrgApi(orgId)+ await refreshUser()+ // Drop all cached queries so no previous-org data lingers in+ // sessions / billing / API keys while the new org loads.+ queryClient.clear()+ },+ [refreshUser, queryClient],+ )return (- <AuthContext.Provider value={{ user, loading, error, switchOrg, refreshUser }}>+ <AuthContext.Provider+ value={{ user, loading, error, switchOrg, refreshUser }}+ >{children}</AuthContext.Provider>)}+// Co-located with the provider by design; the hook export trips react-refresh's+// component-only rule, which is a fast-refresh DX hint, not a correctness issue.+// eslint-disable-next-line react-refresh/only-export-componentsexport function useAuth() {return useContext(AuthContext)}diff --git a/web/src/index.css b/web/src/index.cssindex 9c604d9b..a5deb0b6 100644--- a/web/src/index.css+++ b/web/src/index.css@@ -13,9 +13,26 @@@import 'tw-animate-css';@import 'shadcn/tailwind.css';-/* Self-hosted brand fonts (no external CDN dependency). */-@import '@fontsource-variable/inter';-@import '@fontsource-variable/geist-mono';+/* Self-hosted brand fonts — latin subset only (the dashboard is latin-only for+ now). Explicit @font-face instead of the full package CSS so the build does+ not bundle the cyrillic / greek / latin-ext / vietnamese subsets or the+ unused italic / optical-size variants. */+@font-face {+ font-family: 'Inter Variable';+ font-style: normal;+ font-display: swap;+ font-weight: 100 900;+ src: url('@fontsource-variable/inter/files/inter-latin-wght-normal.woff2')+ format('woff2-variations');+}+@font-face {+ font-family: 'Geist Mono Variable';+ font-style: normal;+ font-display: swap;+ font-weight: 100 900;+ src: url('@fontsource-variable/geist-mono/files/geist-mono-latin-wght-normal.woff2')+ format('woff2-variations');+}@custom-variant dark (&:is(.dark *));diff --git a/web/src/pages/APIKeys.tsx b/web/src/pages/APIKeys.tsxindex 0231faac..b51fab68 100644--- a/web/src/pages/APIKeys.tsx+++ b/web/src/pages/APIKeys.tsx@@ -103,7 +103,7 @@ export default function APIKeys() {<Buttonvariant="ghost"size="sm"- className="text-status-error underline-offset-2 hover:bg-transparent hover:text-destructive hover:underline"+ className="text-status-error hover:text-destructive underline-offset-2 hover:bg-transparent hover:underline"onClick={() => setToRevoke(k)}>Revokediff --git a/web/src/pages/Checkpoints.tsx b/web/src/pages/Checkpoints.tsxindex 61846d28..11115f62 100644--- a/web/src/pages/Checkpoints.tsx+++ b/web/src/pages/Checkpoints.tsx@@ -153,7 +153,7 @@ export default function Checkpoints() {<Buttonvariant="ghost"size="sm"- className="text-status-error underline-offset-2 hover:bg-transparent hover:text-destructive hover:underline"+ className="text-status-error hover:text-destructive underline-offset-2 hover:bg-transparent hover:underline"onClick={() => setToDelete(cp)}>Deletediff --git a/web/src/pages/SessionDetail.tsx b/web/src/pages/SessionDetail.tsxindex e9355b0e..04d8c3e5 100644--- a/web/src/pages/SessionDetail.tsx+++ b/web/src/pages/SessionDetail.tsx@@ -84,7 +84,9 @@ export default function SessionDetail() {const deleteMutation = useMutation({mutationFn: () => deleteSession(sandboxId!),onMutate: async () => {- await queryClient.cancelQueries({ queryKey: ['session-detail', sandboxId] })+ await queryClient.cancelQueries({+ queryKey: ['session-detail', sandboxId],+ })const stoppedAt = new Date().toISOString()queryClient.setQueryData<SessionDetailData>(['session-detail', sandboxId],@@ -100,14 +102,18 @@ export default function SessionDetail() {setShowTerminal(false)},onError: (e) =>- toast.error(`Delete failed: ${e instanceof Error ? e.message : String(e)}`),+ toast.error(+ `Delete failed: ${e instanceof Error ? e.message : String(e)}`,+ ),onSettled: invalidate,})const rebootMutation = useMutation({mutationFn: () => rebootSession(sandboxId!),onError: (e) =>- toast.error(`Reboot failed: ${e instanceof Error ? e.message : String(e)}`),+ toast.error(+ `Reboot failed: ${e instanceof Error ? e.message : String(e)}`,+ ),onSettled: invalidate,})@@ -162,7 +168,7 @@ export default function SessionDetail() {<div><Linkto="/sessions"- className="mb-5 inline-flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground"+ className="text-muted-foreground hover:text-foreground mb-5 inline-flex items-center gap-1.5 text-sm transition-colors"><ArrowLeft className="size-4" />Back to Sessions@@ -173,13 +179,14 @@ export default function SessionDetail() {<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"><div className="min-w-0"><div className="flex flex-wrap items-center gap-3">- <code className="font-mono text-lg font-semibold text-foreground">+ <code className="text-foreground font-mono text-lg font-semibold">{session.sandboxId}</code><StatusBadge status={session.status} /></div>- <div className="mt-1 text-sm text-muted-foreground">- {session.template || 'base'} · Started {timeAgo(session.startedAt)}+ <div className="text-muted-foreground mt-1 text-sm">+ {session.template || 'base'} · Started{' '}+ {timeAgo(session.startedAt)}</div></div>@@ -218,7 +225,9 @@ export default function SessionDetail() {onClick={() => setConfirm('power-cycle')}><Power className="size-4" />- {powerCycleMutation.isPending ? 'Power-cycling…' : 'Power cycle'}+ {powerCycleMutation.isPending+ ? 'Power-cycling…'+ : 'Power cycle'}</Button></>) : null}@@ -248,7 +257,10 @@ export default function SessionDetail() {{showLogs ? (<div className="mb-4">- <LogsPanel sandboxId={sandboxId!} onClose={() => setShowLogs(false)} />+ <LogsPanel+ sandboxId={sandboxId!}+ onClose={() => setShowLogs(false)}+ /></div>) : null}@@ -299,7 +311,7 @@ export default function SessionDetail() {<div className="mt-3"><buttononClick={() => setShowInternal((v) => !v)}- className="flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground"+ className="text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors"><ChevronRightclassName={`size-3.5 transition-transform ${showInternal ? 'rotate-90' : ''}`}@@ -354,7 +366,7 @@ export default function SessionDetail() {</dl>{isRunning ? (<div className="mt-4 space-y-1.5">- <div className="text-xs text-muted-foreground">CLI shell</div>+ <div className="text-muted-foreground text-xs">CLI shell</div><CopyRow value={`oc shell ${session.sandboxId}`} /></div>) : null}@@ -385,7 +397,9 @@ export default function SessionDetail() {confirmLabel="Reboot"pending={rebootMutation.isPending}onConfirm={() =>- rebootMutation.mutate(undefined, { onSuccess: () => setConfirm(null) })+ rebootMutation.mutate(undefined, {+ onSuccess: () => setConfirm(null),+ })}/><ConfirmDialog@@ -410,7 +424,9 @@ export default function SessionDetail() {destructivepending={deleteMutation.isPending}onConfirm={() =>- deleteMutation.mutate(undefined, { onSuccess: () => setConfirm(null) })+ deleteMutation.mutate(undefined, {+ onSuccess: () => setConfirm(null),+ })}/></div>@@ -430,14 +446,14 @@ function PreviewUrlRow({}) {return (<div className="flex items-center gap-3">- <span className="w-12 shrink-0 font-mono text-xs text-muted-foreground">+ <span className="text-muted-foreground w-12 shrink-0 font-mono text-xs">:{port}</span><ahref={`https://${host}`}target="_blank"rel="noopener noreferrer"- className="flex-1 truncate rounded-md border bg-panel-2 px-3 py-2 font-mono text-[13px] text-foreground hover:underline"+ className="bg-panel-2 text-foreground flex-1 truncate rounded-md border px-3 py-2 font-mono text-[13px] hover:underline">https://{host}</a>@@ -459,7 +475,7 @@ function Detail({}) {return (<div>- <dt className="text-xs text-muted-foreground">{label}</dt>+ <dt className="text-muted-foreground text-xs">{label}</dt><ddclassName={`font-mono text-[13px] break-all ${error ? 'text-status-error' : 'text-foreground'}`}>