feat(commands): align built-in slash commands with OpenCode v2

Replace the split built-in command name list and switch with one typed
registry, so a registered command without a handler is a compile error.
Remove the broken themes/share/unshare/editor entries and the hardcoded
init; server and custom commands now win on a name clash and built-ins
dispatch by registry identity.

Add /copy, /btw, /rename, /fork (message picker), /timeline, /model,
/agent, /variants, /mcp, /skills, /settings and /connect. Open the model
picker through state so /model and the select-model shortcut work while a
response is running, load full session history in the fork picker, and
keep attachments when a built-in command is submitted.

Extract shared clipboard and primary-agent helpers, reuse CopyButton in
the manager token settings, and update the Quick Start and chat docs.
This commit is contained in:
Chris Scott committed 2026-10-02 09:53:57 -04:00
1 parent 7cac8baade
commit 7e93eb4c34
35 files changed
+2291 -767

No files matched your search

+15 -1
View File
@@ -5,6 +5,13 @@ import { renderHook } from '@testing-library/react'
import { MemoryRouter, useLocation } from 'react-router-dom'
import { vi } from 'vitest'
import type { useSettings } from '@/hooks/useSettings'
import { BUILTIN_COMMAND_ACTIONS, type CommandActions } from '@/lib/builtinCommands'
export function createCommandActionsMock(): CommandActions {
return Object.fromEntries(
BUILTIN_COMMAND_ACTIONS.map((action) => [action, vi.fn()]),
) as unknown as CommandActions
}
export function createUseSettingsMock(
overrides: Partial<ReturnType<typeof useSettings>> = {},
@@ -52,10 +59,17 @@ export function renderHookWithRouter<T>(renderFn: () => T, initialEntries?: stri
return renderHook(renderFn, { wrapper: createRouterWrapper(initialEntries) })
}
export function LocationCatcher({ capturedSearch }: { capturedSearch: { current: string } }) {
export function LocationCatcher({
capturedSearch,
capturedPathname,
}: {
capturedSearch: { current: string }
capturedPathname?: { current: string }
}) {
const location = useLocation()
useEffect(() => {
capturedSearch.current = location.search
if (capturedPathname) capturedPathname.current = location.pathname
})
return null
}