mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix: address findings from the full Docker evaluation of main
Critical and high: - repos: unlinking a local repo removes only the Manager reference and alias, never the repository files; confirm button reads "Unlink" - auth: rate-limit by the socket address; trust proxy headers only when AUTH_TRUSTED_PROXY_HEADERS is set (documented and forwarded in compose) - composer: per-session in-memory drafts (text, bash mode, attachments); Escape no longer clears the prompt - url params: compose same-tick updates so schedule dialogs stay closed after create/delete; delete dialog names the job Medium: - tool rows show failures (non-zero shell exit, failed exploration members) - voice conversation shows the specific error and a starting state - settings: Escape in dropdowns and the shortcut recorder no longer closes the dialog; mobile deep links open the requested section; one content tree per platform - closing pushed sheets, settings, tool panels and schedule dialogs goes back in history - login returns to the requested page; signed-out pages make no authenticated requests - action terminals keep their output (Manager-side output capture and replay) - unpushed-commit detection, commit message kept on failure - binary files with unknown extensions are detected and not editable - tool panel resizes when docked and floats as a dismissible sheet when the page is too narrow - Docker image runs tini as PID 1 Low: not-found states, add-repo and branch validation errors (4xx), search-aware empty states, mobile repo sort/filter/select cues, sidebar resize affordance and collapse shortcut, mobile unread badge, preview port filtering, terminal close handling, walkthrough empty state and helper session filtering, placeholder contrast, permission labels and focus, TTS task-list sanitizing, git identity email validation, quieter git logging, hermetic worktree tests, and accessible names for icon-only controls.
This commit is contained in:
1 parent
1c22ef6ea1
commit
4ec62cd4e7
191 files changed
+6674
-696
No files matched your search
@@ -214,7 +214,7 @@ export function Combobox({
|
||||
className={cn(
|
||||
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-[16px] md:text-sm shadow-sm transition-colors',
|
||||
'file:border-0 file:bg-transparent file:text-sm file:font-medium',
|
||||
'placeholder:text-muted-foreground',
|
||||
'placeholder:text-placeholder',
|
||||
'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',
|
||||
'disabled:cursor-not-allowed disabled:opacity-50',
|
||||
'pr-8'
|
||||
|
||||
@@ -44,7 +44,7 @@ export function ConfirmDestructiveDialog({
|
||||
{warning && (
|
||||
<Alert className="overflow-hidden">
|
||||
<AlertTriangle className="h-4 w-4 flex-shrink-0" />
|
||||
<AlertDescription className="break-all">{warning}</AlertDescription>
|
||||
<AlertDescription className="break-words">{warning}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ interface DeleteDialogProps {
|
||||
description: ReactNode
|
||||
itemName?: string
|
||||
isDeleting?: boolean
|
||||
confirmLabel?: string
|
||||
pendingLabel?: string
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
@@ -22,6 +24,8 @@ export function DeleteDialog({
|
||||
description,
|
||||
itemName,
|
||||
isDeleting = false,
|
||||
confirmLabel,
|
||||
pendingLabel = 'Deleting...',
|
||||
children
|
||||
}: DeleteDialogProps) {
|
||||
return (
|
||||
@@ -35,8 +39,8 @@ export function DeleteDialog({
|
||||
warning={itemName ? (
|
||||
<>This will permanently delete "<span className="font-medium">{itemName}</span>". This action cannot be undone.</>
|
||||
) : undefined}
|
||||
confirmLabel={title.includes('Configuration') ? 'Delete Configuration' : 'Delete'}
|
||||
pendingLabel="Deleting..."
|
||||
confirmLabel={confirmLabel ?? (title.includes('Configuration') ? 'Delete Configuration' : 'Delete')}
|
||||
pendingLabel={pendingLabel}
|
||||
isPending={isDeleting}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -201,9 +201,28 @@ describe("DialogContent", () => {
|
||||
);
|
||||
const closeTrigger = document.querySelector('[data-swipe-close-trigger]');
|
||||
expect(closeTrigger).toBeInTheDocument();
|
||||
expect(closeTrigger).toHaveAccessibleName('Dismiss dialog');
|
||||
});
|
||||
});
|
||||
|
||||
it('extends the close button hit area without enlarging the icon', () => {
|
||||
render(
|
||||
<Dialog open>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Close Target Dialog</DialogTitle>
|
||||
</DialogHeader>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
const closeButton = screen.getByRole('button', { name: 'Close' });
|
||||
const icon = closeButton.querySelector('svg');
|
||||
|
||||
expect(closeButton).toHaveClass('after:-inset-2', 'pointer-coarse:after:-inset-3.5');
|
||||
expect(icon).toHaveClass('h-4', 'w-4');
|
||||
});
|
||||
|
||||
it('does not render hidden close trigger when mobileSwipeToClose is false', () => {
|
||||
withMobileViewport(() => {
|
||||
render(
|
||||
|
||||
@@ -149,11 +149,16 @@ const DialogContent = React.forwardRef<
|
||||
>
|
||||
{children}
|
||||
{shouldEnableMobileSwipe && (
|
||||
<DialogPrimitive.Close ref={closeTriggerRef} className="sr-only" data-swipe-close-trigger />
|
||||
<DialogPrimitive.Close
|
||||
ref={closeTriggerRef}
|
||||
className="sr-only"
|
||||
aria-label="Dismiss dialog"
|
||||
data-swipe-close-trigger
|
||||
/>
|
||||
)}
|
||||
{!hideCloseButton && !fullscreen && (
|
||||
<DialogPrimitive.Close
|
||||
className="absolute right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
|
||||
className="absolute right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground after:absolute after:-inset-2 after:content-[''] pointer-coarse:after:-inset-3.5"
|
||||
style={mobileFullscreen ? {
|
||||
top: 'calc(env(safe-area-inset-top, 0px) + 1rem)',
|
||||
} : { top: '1rem' }}
|
||||
|
||||
@@ -8,7 +8,7 @@ const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
|
||||
<input
|
||||
type={type}
|
||||
className={cn(
|
||||
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-[16px] text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-[16px] text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-placeholder focus-visible:outline-none focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
|
||||
@@ -174,7 +174,7 @@ export function MultiSelect({
|
||||
placeholder={searchPlaceholder}
|
||||
className={cn(
|
||||
'flex h-8 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors',
|
||||
'placeholder:text-muted-foreground',
|
||||
'placeholder:text-placeholder',
|
||||
'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring'
|
||||
)}
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { Button } from '@/components/ui/button'
|
||||
|
||||
interface NotFoundStateProps {
|
||||
message: string
|
||||
backTo: string
|
||||
backLabel: string
|
||||
title?: string
|
||||
}
|
||||
|
||||
export function NotFoundState({ message, backTo, backLabel, title }: NotFoundStateProps) {
|
||||
const navigate = useNavigate()
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-gradient-to-br from-background via-background to-background p-6">
|
||||
<div className="flex flex-col items-center gap-3 text-center">
|
||||
{title && <h1 className="text-lg font-semibold text-foreground">{title}</h1>}
|
||||
<span className="text-muted-foreground">{message}</span>
|
||||
<Button variant="outline" size="sm" onClick={() => navigate(backTo)}>{backLabel}</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { MemoryRouter, Route, Routes } from 'react-router-dom'
|
||||
import { LocationCatcher } from '@/test/test-utils'
|
||||
import { RouteErrorBoundary } from './route-error-boundary'
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
error: undefined as unknown,
|
||||
}))
|
||||
|
||||
vi.mock('react-router-dom', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('react-router-dom')>()
|
||||
return { ...actual, useRouteError: () => mocks.error }
|
||||
})
|
||||
|
||||
function renderBoundary() {
|
||||
const capturedPathname: { current: string } = { current: '' }
|
||||
const capturedSearch: { current: string } = { current: '' }
|
||||
render(
|
||||
<MemoryRouter initialEntries={['/does-not-exist']}>
|
||||
<LocationCatcher capturedSearch={capturedSearch} capturedPathname={capturedPathname} />
|
||||
<Routes>
|
||||
<Route path="/" element={null} />
|
||||
<Route path="*" element={<RouteErrorBoundary />} />
|
||||
</Routes>
|
||||
</MemoryRouter>,
|
||||
)
|
||||
return { capturedPathname, capturedSearch }
|
||||
}
|
||||
|
||||
describe('RouteErrorBoundary', () => {
|
||||
beforeEach(() => {
|
||||
mocks.error = undefined
|
||||
})
|
||||
|
||||
it('offers a way home for a 404', async () => {
|
||||
mocks.error = { status: 404, statusText: 'Not Found', internal: false, data: {} }
|
||||
|
||||
const { capturedPathname } = renderBoundary()
|
||||
|
||||
expect(screen.getByText('Page Not Found')).toBeInTheDocument()
|
||||
expect(screen.getByText('The page you are looking for does not exist.')).toBeInTheDocument()
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Go home' }))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(capturedPathname.current).toBe('/')
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps the retry action for other statuses', () => {
|
||||
mocks.error = { status: 500, statusText: 'Server Error', internal: false, data: { message: 'Boom' } }
|
||||
|
||||
renderBoundary()
|
||||
|
||||
expect(screen.getByRole('button', { name: 'Try again' })).toBeInTheDocument()
|
||||
expect(screen.queryByRole('button', { name: 'Go home' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('keeps the login action for auth errors', () => {
|
||||
mocks.error = { status: 401, statusText: 'Unauthorized', internal: false, data: {} }
|
||||
|
||||
renderBoundary()
|
||||
|
||||
expect(screen.getByRole('button', { name: 'Log in' })).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useRouteError, isRouteErrorResponse } from 'react-router-dom'
|
||||
import { AlertTriangle, RefreshCw, LogIn, WifiOff } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { NotFoundState } from '@/components/ui/not-found-state'
|
||||
import { parseNetworkError } from '@/lib/opencode-errors'
|
||||
|
||||
function getErrorDetails(error: unknown) {
|
||||
@@ -57,6 +58,10 @@ export function RouteErrorBoundary() {
|
||||
|
||||
const isAuthError = statusCode === 401 || statusCode === 403
|
||||
|
||||
if (statusCode === 404) {
|
||||
return <NotFoundState title={title} message={message} backTo="/" backLabel="Go home" />
|
||||
}
|
||||
|
||||
if ('variant' in details && details.variant === 'offline') {
|
||||
return (
|
||||
<div className="flex min-h-screen flex-col items-center justify-center gap-6 bg-background text-foreground">
|
||||
|
||||
@@ -186,6 +186,21 @@ describe('Sidebar resize handle', () => {
|
||||
|
||||
expect(handleWidthChange).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('keeps the collapse toggle clear of the full-height resize strip', () => {
|
||||
render(
|
||||
<Sidebar collapsed={false} onToggle={vi.fn()} width={300} onWidthChange={vi.fn()}>
|
||||
<div>Content</div>
|
||||
</Sidebar>
|
||||
)
|
||||
|
||||
const handle = screen.getByRole('separator', { name: 'Resize sidebar' })
|
||||
const toggle = screen.getByRole('button', { name: 'Collapse sidebar' })
|
||||
|
||||
expect(handle).toHaveClass('inset-y-0')
|
||||
expect(handle).not.toContainElement(toggle)
|
||||
expect(toggle).not.toHaveClass('absolute')
|
||||
})
|
||||
})
|
||||
|
||||
describe('SidebarSection', () => {
|
||||
|
||||
@@ -122,7 +122,11 @@ export function Sidebar({
|
||||
style={!collapsed && width !== undefined ? { width } : undefined}
|
||||
aria-label={ariaLabel}
|
||||
>
|
||||
{onToggle && <SidebarCollapseToggle collapsed={collapsed} onToggle={onToggle} />}
|
||||
{onToggle && (
|
||||
<div className={cn('flex h-9 shrink-0 items-center pt-1', collapsed ? 'justify-center' : 'justify-end px-1.5')}>
|
||||
<SidebarCollapseToggle collapsed={collapsed} onToggle={onToggle} />
|
||||
</div>
|
||||
)}
|
||||
{showResizeHandle && (
|
||||
<div
|
||||
role="separator"
|
||||
@@ -132,13 +136,18 @@ export function Sidebar({
|
||||
aria-valuenow={width}
|
||||
aria-valuemin={SIDEBAR_MIN_WIDTH}
|
||||
aria-valuemax={SIDEBAR_MAX_WIDTH}
|
||||
className="absolute inset-y-0 -right-1 z-10 w-2 cursor-col-resize touch-none bg-transparent hover:bg-highlight/30 focus-visible:bg-highlight/30 focus-visible:outline-none"
|
||||
className="group absolute inset-y-0 -right-1 z-10 w-2 cursor-col-resize touch-none bg-transparent focus-visible:outline-none"
|
||||
onPointerDown={handlePointerDown}
|
||||
onPointerMove={handlePointerMove}
|
||||
onPointerUp={handlePointerEnd}
|
||||
onPointerCancel={handlePointerEnd}
|
||||
onKeyDown={handleKeyDown}
|
||||
/>
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="absolute inset-y-0 right-0.5 w-0.5 rounded-full bg-muted-foreground/30 transition-all duration-150 group-hover:w-1 group-hover:bg-highlight group-focus-visible:w-1 group-focus-visible:bg-highlight"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{children}
|
||||
</aside>
|
||||
@@ -231,41 +240,22 @@ export interface SidebarCollapseToggleProps {
|
||||
}
|
||||
|
||||
export function SidebarCollapseToggle({ collapsed, onToggle }: SidebarCollapseToggleProps) {
|
||||
const Chevron = collapsed ? ChevronRight : ChevronLeft
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onToggle}
|
||||
className={cn(
|
||||
'group absolute -right-3 top-1/2 z-20 h-16 w-6 -translate-y-1/2',
|
||||
'flex items-center justify-center bg-transparent',
|
||||
'inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors',
|
||||
'hover:bg-accent hover:text-foreground',
|
||||
'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background'
|
||||
)}
|
||||
title={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
|
||||
aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
|
||||
aria-expanded={!collapsed}
|
||||
>
|
||||
<span aria-hidden="true" className="relative flex items-center justify-center">
|
||||
<span
|
||||
className={cn(
|
||||
'h-8 w-1 rounded-full bg-highlight/60 transition-colors duration-150',
|
||||
'group-hover:bg-highlight group-focus-visible:bg-highlight'
|
||||
)}
|
||||
/>
|
||||
<ChevronLeft
|
||||
className={cn(
|
||||
'absolute left-full ml-0.5 h-3.5 w-3.5 text-muted-foreground opacity-0 transition-opacity duration-150',
|
||||
'group-hover:opacity-100 group-focus-visible:opacity-100',
|
||||
collapsed && 'hidden'
|
||||
)}
|
||||
/>
|
||||
<ChevronRight
|
||||
className={cn(
|
||||
'absolute left-full ml-0.5 h-3.5 w-3.5 text-muted-foreground opacity-0 transition-opacity duration-150',
|
||||
'group-hover:opacity-100 group-focus-visible:opacity-100',
|
||||
!collapsed && 'hidden'
|
||||
)}
|
||||
/>
|
||||
</span>
|
||||
<Chevron aria-hidden="true" className="h-4 w-4" />
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -9,7 +9,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
return (
|
||||
<textarea
|
||||
className={cn(
|
||||
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-[16px] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-[16px] placeholder:text-placeholder focus-visible:outline-none focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
||||
className
|
||||
)}
|
||||
ref={ref}
|
||||
|
||||
Reference in new issue
Block a user