mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
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:
1 parent
7cac8baade
commit
7e93eb4c34
35 files changed
+2291
-767
No files matched your search
@@ -1,9 +1,10 @@
|
||||
import { useState } from 'react'
|
||||
import { useManagerToken } from '@/hooks/useManagerToken'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Button, buttonVariants } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert'
|
||||
import { AlertTriangle, Check, Copy, Eye, EyeOff, RefreshCw } from 'lucide-react'
|
||||
import { AlertTriangle, Eye, EyeOff, RefreshCw } from 'lucide-react'
|
||||
import { CopyButton } from '@/components/ui/copy-button'
|
||||
import { SettingsDisclosure } from './SettingsDisclosure'
|
||||
|
||||
interface ManagerTokenSettingsProps {
|
||||
@@ -14,23 +15,11 @@ interface ManagerTokenSettingsProps {
|
||||
export function ManagerTokenSettings({ isOpen: controlledOpen, onToggle }: ManagerTokenSettingsProps = {}) {
|
||||
const { token, isLoading, rotate } = useManagerToken()
|
||||
const [showToken, setShowToken] = useState(false)
|
||||
const [copied, setCopied] = useState(false)
|
||||
const [confirmRotate, setConfirmRotate] = useState(false)
|
||||
const [uncontrolledOpen, setUncontrolledOpen] = useState(true)
|
||||
const isOpen = controlledOpen ?? uncontrolledOpen
|
||||
const handleToggle = onToggle ?? (() => setUncontrolledOpen((open) => !open))
|
||||
|
||||
const handleCopy = async () => {
|
||||
if (!token) return
|
||||
try {
|
||||
await navigator.clipboard.writeText(token)
|
||||
setCopied(true)
|
||||
setTimeout(() => setCopied(false), 2000)
|
||||
} catch {
|
||||
// clipboard may be unavailable; user can copy manually from the input
|
||||
}
|
||||
}
|
||||
|
||||
const handleRotate = () => {
|
||||
if (!confirmRotate) {
|
||||
setConfirmRotate(true)
|
||||
@@ -73,15 +62,11 @@ export function ManagerTokenSettings({ isOpen: controlledOpen, onToggle }: Manag
|
||||
{showToken ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
|
||||
</button>
|
||||
</div>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
type="button"
|
||||
onClick={handleCopy}
|
||||
disabled={!token}
|
||||
>
|
||||
{copied ? <Check className="h-4 w-4 text-success" /> : <Copy className="h-4 w-4" />}
|
||||
</Button>
|
||||
<CopyButton
|
||||
content={token ?? ''}
|
||||
title="Copy"
|
||||
className={buttonVariants({ variant: 'outline', size: 'icon' })}
|
||||
/>
|
||||
<Button
|
||||
variant={confirmRotate ? 'destructive' : 'outline'}
|
||||
size="icon"
|
||||
|
||||
Reference in new issue
Block a user