Update skills UI components for managed skills (#165)

* ralph: ralph-repo-level-skills-dialog-skillseditor-fix completed after 4 iterations

* Remove parent session notification and child session tracking from Ralph loops

Sending promptAsync to parent sessions on loop completion could resume
work in previously inactive sessions. Removed parentSessionId from
RalphState, child session tracking maps, and all related event handling.
Watchdog stall detection still works via the session status API.

* Migrate global skills to workspace path

* Add skill injection to scheduled job prompts

* Refactor schedules UI with MultiSelect and tab menu

* Update skills UI components for managed skills
This commit is contained in:
Chris Scott authored and GitHub committed 2026-03-22 14:52:32 -04:00
1 parent 4bd0940ab9
commit c3cba72b51
22 files changed
+981 -337

No files matched your search

@@ -0,0 +1,36 @@
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { RepoSkillsList } from './RepoSkillsList'
import { useQuery } from '@tanstack/react-query'
import { settingsApi } from '@/api/settings'
interface RepoSkillsDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
repoId: number
}
export function RepoSkillsDialog({ open, onOpenChange, repoId }: RepoSkillsDialogProps) {
const { isLoading, data, error } = useQuery({
queryKey: ['settings', 'skills', repoId],
queryFn: () => settingsApi.listManagedSkills(repoId),
enabled: open && !!repoId,
staleTime: 30000,
})
if (!repoId) {
return null
}
const repoSkills = data?.filter(skill => skill.scope === 'project')
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent mobileFullscreen className="sm:max-w-2xl sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6 pb-safe">
<DialogHeader className="p-4 sm:p-6 border-b flex flex-row items-center justify-between space-y-0 shrink-0">
<DialogTitle>Skills</DialogTitle>
</DialogHeader>
<RepoSkillsList isLoading={isLoading} data={repoSkills} error={error} />
</DialogContent>
</Dialog>
)
}
@@ -0,0 +1,65 @@
import { AlertCircle, Loader2 } from 'lucide-react'
import type { SkillFileInfo } from '@opencode-manager/shared'
interface RepoSkillsListProps {
isLoading: boolean
data: SkillFileInfo[] | undefined
error: Error | null
}
export function RepoSkillsList({ isLoading, data, error }: RepoSkillsListProps) {
const formatSkillName = (name: string): string => {
const formatted = name.replace(/-/g, ' ')
return formatted.charAt(0).toUpperCase() + formatted.slice(1)
}
if (isLoading) {
return (
<div className="flex items-center justify-center py-8">
<Loader2 className="w-4 h-4 animate-spin text-blue-600 dark:text-blue-400" />
<span className="ml-2 text-sm text-muted-foreground">Loading...</span>
</div>
)
}
if (error) {
return (
<div className="text-center py-6 text-muted-foreground">
<AlertCircle className="w-10 h-10 mx-auto mb-3 opacity-50 text-red-500" />
<p className="text-sm">Failed to load skills</p>
<p className="text-xs mt-1">{error.message}</p>
</div>
)
}
if (!data || data.length === 0) {
return (
<div className="text-center py-6 text-muted-foreground">
<p className="text-sm">No skills available</p>
<p className="text-xs mt-1">Skills will appear here when configured in the project's .opencode/skills/ directory</p>
</div>
)
}
return (
<div className="flex-1 overflow-y-auto min-h-0 px-2 sm:px-4 py-2">
<div className="space-y-2">
{data.map((skill) => (
<div
key={skill.name}
className="p-2 rounded-lg border border-border bg-card"
>
<p className="text-sm font-medium truncate">
{formatSkillName(skill.name)}
</p>
{skill.description && (
<p className="text-xs text-muted-foreground truncate mt-0.5">
{skill.description}
</p>
)}
</div>
))}
</div>
</div>
)
}
@@ -12,7 +12,7 @@ interface JobsTabProps {
export function JobsTab({ jobs, selectedJobId, onSelectJob }: JobsTabProps) {
return (
<div className="h-full overflow-y-auto space-y-2 py-2">
<div className="h-full overflow-y-auto space-y-2 pt-2">
{jobs.map((job) => (
<button
key={job.id}
@@ -1,5 +1,5 @@
import type { ScheduleJob, ScheduleRun } from '@opencode-manager/shared/types'
import { useEffect, useState } from 'react'
import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Card, CardContent } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
@@ -111,11 +111,8 @@ export function RunHistoryTab({
onCancelRun,
cancelRunPending,
}: RunHistoryTabProps) {
const [expandedRunId, setExpandedRunId] = useState<number | null>(selectedRunId)
const [expandedRunId, setExpandedRunId] = useState<number | null>(null)
useEffect(() => {
setExpandedRunId(selectedRunId)
}, [selectedRunId])
function getRunStatusIcon(status: ScheduleRun['status']) {
if (status === 'completed') return <CheckCircle2 className="h-3.5 w-3.5 text-green-400" />
@@ -193,7 +190,7 @@ export function RunHistoryTab({
<p className="mt-0.5 truncate text-xs text-red-400/80">{run.errorText}</p>
)}
</div>
<ChevronDown className={`h-4 w-4 flex-shrink-0 text-muted-foreground transition-transform duration-200 ${expandedRunId === run.id ? 'rotate-180' : ''}`} />
<ChevronDown className={`h-6 w-6 flex-shrink-0 text-muted-foreground transition-transform duration-200 self-start ${expandedRunId === run.id ? 'rotate-180' : ''}`} />
</button>
{expandedRunId === run.id && (
<div className="border-t border-border/60 flex flex-col" style={{ maxHeight: 'calc(100vh - 200px)' }}>
@@ -9,6 +9,7 @@ import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Combobox, type ComboboxOption } from '@/components/ui/combobox'
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { MultiSelect } from '@/components/ui/multi-select'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Switch } from '@/components/ui/switch'
@@ -26,7 +27,6 @@ import {
weekdayOptions,
} from '@/components/schedules/schedule-utils'
import { Check, Info, Loader2, Pencil, Plus, Sparkles, Trash2 } from 'lucide-react'
import { cn } from '@/lib/utils'
import { usePromptTemplates, useDeletePromptTemplate } from '@/hooks/usePromptTemplates'
import { PromptTemplateDialog } from './PromptTemplateDialog'
import { DeleteDialog } from '@/components/ui/delete-dialog'
@@ -613,36 +613,12 @@ export function ScheduleJobDialog({ open, onOpenChange, job, isSaving, onSubmit
<p className="text-sm text-muted-foreground">No skills discovered. Configure skill paths in Settings to make skills available here.</p>
</div>
) : (
<div className="flex flex-wrap gap-2">
{skills.map((skill) => (
<button
key={skill.name}
type="button"
onClick={() => {
setSkillSlugs(prev =>
prev.includes(skill.name)
? prev.filter(s => s !== skill.name)
: [...prev, skill.name]
)
}}
className={cn(
'inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium transition-colors',
skillSlugs.includes(skill.name)
? 'border-primary bg-primary/10 text-primary'
: 'border-border bg-card text-muted-foreground hover:bg-accent hover:text-foreground'
)}
>
{skillSlugs.includes(skill.name) && <Check className="h-3 w-3" />}
{skill.name}
</button>
))}
</div>
)}
{skillSlugs.length > 0 && (
<div className="text-xs text-muted-foreground">
{skillSlugs.length} skill{skillSlugs.length !== 1 ? 's' : ''} selected
</div>
<MultiSelect
value={skillSlugs}
onChange={setSkillSlugs}
options={skills.map(s => ({ value: s.name, label: s.name, description: s.description }))}
placeholder="Search and select skills..."
/>
)}
<div className="space-y-2">
@@ -0,0 +1,56 @@
import { CalendarClock, History, Info } from 'lucide-react'
import { cn } from '@/lib/utils'
type TabType = 'jobs' | 'detail' | 'runs'
interface ScheduleTabMenuProps {
activeTab: TabType
onTabChange: (tab: TabType) => void
className?: string
}
export function ScheduleTabMenu({ activeTab, onTabChange, className }: ScheduleTabMenuProps) {
return (
<div className={cn('flex border-t border-border bg-card/80 backdrop-blur-sm pb-1', className)}>
<button
type="button"
className={cn(
'flex-1 flex flex-col items-center gap-0.5 pt-2.5 pb-2 pb-safe text-xs font-medium transition-colors',
activeTab === 'jobs'
? 'bg-primary/10 text-primary'
: 'bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50'
)}
onClick={() => onTabChange('jobs')}
>
<CalendarClock className="h-4 w-4" />
<span>Jobs</span>
</button>
<button
type="button"
className={cn(
'flex-1 flex flex-col items-center gap-0.5 pt-2.5 pb-2 pb-safe text-xs font-medium transition-colors',
activeTab === 'detail'
? 'bg-primary/10 text-primary'
: 'bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50'
)}
onClick={() => onTabChange('detail')}
>
<Info className="h-4 w-4" />
<span>Detail</span>
</button>
<button
type="button"
className={cn(
'flex-1 flex flex-col items-center gap-0.5 pt-1.5 py-2 pb-safe text-xs font-medium transition-colors',
activeTab === 'runs'
? 'bg-primary/10 text-primary'
: 'bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50'
)}
onClick={() => onTabChange('runs')}
>
<History className="h-4 w-4" />
<span>Run History</span>
</button>
</div>
)
}
@@ -3,3 +3,4 @@ export { JobDetailTab } from './JobDetailTab'
export { RunHistoryTab } from './RunHistoryTab'
export { ScheduleJobDialog } from './ScheduleJobDialog'
export { ScheduleRunMarkdown } from './ScheduleRunMarkdown'
export { ScheduleTabMenu } from './ScheduleTabMenu'
@@ -17,7 +17,7 @@ import { SkillsEditor } from './SkillsEditor'
import { VersionSelectDialog } from './VersionSelectDialog'
import { MemoryPluginConfig } from './MemoryPluginConfig'
import { settingsApi } from '@/api/settings'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { useServerHealth } from '@/hooks/useServerHealth'
import { parseJsonc, hasJsoncComments } from '@/lib/jsonc'
import { showToast } from '@/lib/toast'
@@ -77,6 +77,12 @@ export function OpenCodeConfigManager() {
const skillsRef = useRef<HTMLButtonElement>(null)
const mcpRef = useRef<HTMLButtonElement>(null)
const { data: managedSkills = [] } = useQuery({
queryKey: ['managed-skills'],
queryFn: () => settingsApi.listManagedSkills(),
staleTime: 5 * 60 * 1000,
})
const scrollToSection = (ref: React.RefObject<HTMLButtonElement | null>) => {
if (ref.current) {
ref.current.scrollIntoView({
@@ -563,7 +569,7 @@ export function OpenCodeConfigManager() {
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0 mb-6">
<button
ref={agentsMdRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.agentsMd ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.agentsMd
setExpandedSections(prev => ({ ...prev, agentsMd: isExpanding }))
@@ -620,7 +626,7 @@ export function OpenCodeConfigManager() {
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0">
<button
ref={commandsRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.commands ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.commands
setExpandedSections(prev => ({ ...prev, commands: isExpanding }))
@@ -657,7 +663,7 @@ export function OpenCodeConfigManager() {
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0">
<button
ref={agentsRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.agents ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.agents
setExpandedSections(prev => ({ ...prev, agents: isExpanding }))
@@ -694,7 +700,7 @@ export function OpenCodeConfigManager() {
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0">
<button
ref={skillsRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.skills ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.skills
setExpandedSections(prev => ({ ...prev, skills: isExpanding }))
@@ -706,33 +712,34 @@ export function OpenCodeConfigManager() {
<div className="flex items-center gap-3 min-w-0">
<h4 className="text-sm font-medium truncate">Skills</h4>
<span className="text-xs text-muted-foreground">
{(selectedConfig.content?.skills?.paths?.length ?? 0) + (selectedConfig.content?.skills?.urls?.length ?? 0)} configured
{managedSkills.length + (selectedConfig.content?.skills?.paths?.length ?? 0) + (selectedConfig.content?.skills?.urls?.length ?? 0)} configured
</span>
</div>
<ChevronDown className={`h-4 w-4 transition-transform ${expandedSections.skills ? 'rotate-90' : ''}`} />
</button>
<div className={`${expandedSections.skills ? 'block' : 'hidden'} border-t border-border`}>
<div className="p-4 max-h-[50vh] overflow-y-auto">
<SkillsEditor
skills={selectedConfig.content?.skills}
onChange={(skills) => {
const paths = skills?.paths?.filter(Boolean)
const urls = skills?.urls?.filter(Boolean)
const updatedContent = {
...selectedConfig.content,
skills: (paths?.length || urls?.length) ? { paths: paths?.length ? paths : undefined, urls: urls?.length ? urls : undefined } : undefined
}
updateConfigContent(selectedConfig.name, updatedContent)
}}
/>
<div className={`${expandedSections.skills ? 'block' : 'hidden'} border-t border-border`}>
<div className="p-4 max-h-[50vh] overflow-y-auto">
<SkillsEditor
skills={selectedConfig.content?.skills}
managedSkills={managedSkills}
onChange={(skills) => {
const paths = skills?.paths?.filter(Boolean)
const urls = skills?.urls?.filter(Boolean)
const updatedContent = {
...selectedConfig.content,
skills: (paths?.length || urls?.length) ? { paths: paths?.length ? paths : undefined, urls: urls?.length ? urls : undefined } : undefined
}
updateConfigContent(selectedConfig.name, updatedContent)
}}
/>
</div>
</div>
</div>
</div>
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0">
<button
ref={mcpRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.mcp ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.mcp
setExpandedSections(prev => ({ ...prev, mcp: isExpanding }))
@@ -115,7 +115,7 @@ export function SkillDialog({ open, onOpenChange, onSubmit, editingSkill }: Skil
return (
<Dialog open={open} onOpenChange={handleOpenChange}>
<DialogContent mobileFullscreen className="sm:max-w-2xl sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6">
<DialogContent mobileFullscreen className="sm:max-w-2xl sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6 pb-safe">
<DialogHeader className="p-4 sm:p-6 border-b flex flex-row items-center justify-between space-y-0">
<DialogTitle>{editingSkill ? 'Edit Skill' : 'Create Skill'}</DialogTitle>
</DialogHeader>
@@ -270,7 +270,7 @@ export function SkillDialog({ open, onOpenChange, onSubmit, editingSkill }: Skil
</Form>
</div>
<DialogFooter className="p-3 sm:p-4 border-t gap-2 pb-4">
<DialogFooter className="flex flex-row gap-2 pt-2 border-t border-border sm:justify-end pb-4 p-3">
<Button variant="outline" onClick={() => handleOpenChange(false)} className="flex-1 sm:flex-none">
Cancel
</Button>
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { Plus, Trash2, Loader2, Pencil, ChevronDown, ChevronRight, Save, X } from 'lucide-react'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { Plus, Trash2, Pencil, ChevronDown, ChevronRight, Save, X } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Input } from '@/components/ui/input'
@@ -14,6 +14,7 @@ import { toast } from 'sonner'
interface SkillsEditorProps {
skills?: OpenCodeConfigInput['skills']
managedSkills?: SkillFileInfo[]
onChange?: (skills: OpenCodeConfigInput['skills']) => void
}
@@ -77,7 +78,7 @@ function SkillPathEditor({ items, onChange, onAddItem, onRemoveItem, label, plac
)
}
export function SkillsEditor({ skills, onChange }: SkillsEditorProps) {
export function SkillsEditor({ skills, managedSkills = [], onChange }: SkillsEditorProps) {
const [dialogOpen, setDialogOpen] = useState(false)
const [editingSkill, setEditingSkill] = useState<SkillFileInfo | null>(null)
const [collapsiblesOpen, setCollapsiblesOpen] = useState({
@@ -98,12 +99,6 @@ export function SkillsEditor({ skills, onChange }: SkillsEditorProps) {
const queryClient = useQueryClient()
const { data: managedSkills = [], isLoading: isLoadingManaged } = useQuery({
queryKey: ['managed-skills'],
queryFn: () => settingsApi.listManagedSkills(),
staleTime: 5 * 60 * 1000,
})
const createMutation = useMutation({
mutationFn: (data: CreateSkillRequest) => settingsApi.createSkill(data),
onSuccess: () => {
@@ -238,11 +233,7 @@ export function SkillsEditor({ skills, onChange }: SkillsEditorProps) {
{collapsiblesOpen.managed && (
<>
{isLoadingManaged ? (
<div className="flex items-center justify-center py-8">
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
) : managedSkills.length === 0 ? (
{managedSkills.length === 0 ? (
<Card>
<CardContent className="p-6">
<div className="flex items-center gap-2 mb-2">
+220
View File
@@ -0,0 +1,220 @@
import { useState, useRef, useEffect, useCallback } from 'react'
import { cn } from '@/lib/utils'
import { Check, ChevronDown, X } from 'lucide-react'
export interface MultiSelectOption {
value: string
label: string
description?: string
}
interface MultiSelectProps {
value: string[]
onChange: (values: string[]) => void
options: MultiSelectOption[]
placeholder?: string
disabled?: boolean
className?: string
}
export function MultiSelect({
value,
onChange,
options,
placeholder = 'Select...',
disabled = false,
className,
}: MultiSelectProps) {
const [isOpen, setIsOpen] = useState(false)
const [search, setSearch] = useState('')
const [highlightedIndex, setHighlightedIndex] = useState(0)
const containerRef = useRef<HTMLDivElement>(null)
const inputRef = useRef<HTMLInputElement>(null)
const triggerRef = useRef<HTMLDivElement>(null)
const filteredOptions = options.filter(option =>
option.label.toLowerCase().includes(search.toLowerCase()) ||
option.value.toLowerCase().includes(search.toLowerCase()) ||
(option.description?.toLowerCase().includes(search.toLowerCase()))
)
useEffect(() => {
if (!isOpen) return
const handleClickOutside = (e: MouseEvent) => {
if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
setIsOpen(false)
setSearch('')
}
}
document.addEventListener('mousedown', handleClickOutside)
return () => document.removeEventListener('mousedown', handleClickOutside)
}, [isOpen])
useEffect(() => {
setHighlightedIndex(0)
}, [search])
const handleToggle = useCallback((optionValue: string) => {
if (value.includes(optionValue)) {
onChange(value.filter(v => v !== optionValue))
} else {
onChange([...value, optionValue])
}
}, [value, onChange])
const handleRemove = useCallback((optionValue: string, e: React.MouseEvent) => {
e.stopPropagation()
onChange(value.filter(v => v !== optionValue))
}, [value, onChange])
const handleOpen = () => {
if (disabled) return
setIsOpen(true)
setTimeout(() => inputRef.current?.focus(), 0)
}
const handleTriggerKeyDown = useCallback((e: React.KeyboardEvent) => {
if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {
e.preventDefault()
if (!isOpen) {
setIsOpen(true)
setTimeout(() => inputRef.current?.focus(), 0)
}
} else if (e.key === 'Escape') {
setIsOpen(false)
setSearch('')
}
}, [isOpen])
const handleInputKeyDown = useCallback((e: React.KeyboardEvent) => {
if (e.key === 'Escape') {
e.preventDefault()
setIsOpen(false)
setSearch('')
triggerRef.current?.focus()
} else if (e.key === 'ArrowDown') {
e.preventDefault()
setHighlightedIndex(prev => Math.min(prev + 1, filteredOptions.length - 1))
} else if (e.key === 'ArrowUp') {
e.preventDefault()
setHighlightedIndex(prev => Math.max(prev - 1, 0))
} else if (e.key === 'Enter') {
e.preventDefault()
if (filteredOptions[highlightedIndex]) {
handleToggle(filteredOptions[highlightedIndex].value)
}
} else if (e.key === 'Tab') {
setIsOpen(false)
setSearch('')
}
}, [highlightedIndex, filteredOptions, handleToggle])
return (
<div ref={containerRef} className={cn('relative', className)}>
<div
ref={triggerRef}
role="combobox"
aria-expanded={isOpen}
aria-haspopup="listbox"
aria-activedescendant={isOpen ? `option-${highlightedIndex}` : undefined}
tabIndex={disabled ? -1 : 0}
onClick={handleOpen}
onKeyDown={handleTriggerKeyDown}
className={cn(
'flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent px-3 py-1.5 text-sm shadow-sm transition-colors cursor-pointer',
'focus-within:outline-none focus-within:ring-1 focus-within:ring-ring',
disabled && 'cursor-not-allowed opacity-50',
value.length === 0 && 'pr-8'
)}
>
{value.length === 0 && (
<span className="text-muted-foreground text-sm">{placeholder}</span>
)}
{value.map(v => {
const option = options.find(o => o.value === v)
return (
<span
key={v}
className="inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium"
>
{option?.label ?? v}
<button
type="button"
onClick={(e) => handleRemove(v, e)}
disabled={disabled}
className="text-muted-foreground hover:text-foreground disabled:pointer-events-none"
aria-label={`Remove ${option?.label ?? v}`}
>
<X className="h-3 w-3" />
</button>
</span>
)
})}
<ChevronDown className={cn(
'ml-auto h-4 w-4 shrink-0 text-muted-foreground transition-transform',
isOpen && 'rotate-180'
)} />
</div>
{isOpen && (
<div className="absolute z-[150] mt-1 w-full bg-popover border border-border rounded-md shadow-lg">
<div className="p-2 border-b border-border">
<input
ref={inputRef}
type="text"
value={search}
onChange={e => setSearch(e.target.value)}
onKeyDown={handleInputKeyDown}
placeholder="Search skills..."
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',
'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring'
)}
/>
</div>
<div className="max-h-52 overflow-y-auto" role="listbox">
{filteredOptions.length === 0 ? (
<div className="px-3 py-4 text-center text-sm text-muted-foreground">No skills found</div>
) : (
filteredOptions.map((option, index) => {
const isSelected = value.includes(option.value)
const isHighlighted = index === highlightedIndex
return (
<button
key={option.value}
id={`option-${index}`}
type="button"
role="option"
aria-selected={isSelected}
onClick={() => handleToggle(option.value)}
className={cn(
'flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted',
isSelected && 'bg-primary/5',
isHighlighted && 'bg-accent'
)}
>
<div className={cn(
'flex h-4 w-4 shrink-0 items-center justify-center rounded border',
isSelected ? 'border-primary bg-primary text-primary-foreground' : 'border-border'
)}>
{isSelected && <Check className="h-3 w-3" />}
</div>
<div className="min-w-0 flex-1">
<div className="font-medium truncate">{option.label}</div>
{option.description && (
<div className="text-xs text-muted-foreground truncate">{option.description}</div>
)}
</div>
</button>
)
})
)}
</div>
</div>
)}
</div>
)
}
+21 -1
View File
@@ -8,6 +8,7 @@ import { FileBrowserSheet } from "@/components/file-browser/FileBrowserSheet";
import { Header } from "@/components/ui/header";
import { SwitchConfigDialog } from "@/components/repo/SwitchConfigDialog";
import { RepoMcpDialog } from "@/components/repo/RepoMcpDialog";
import { RepoSkillsDialog } from "@/components/repo/RepoSkillsDialog";
import { SourceControlPanel } from "@/components/source-control";
import { useCreateSession } from "@/hooks/useOpenCode";
import { useSSE } from "@/hooks/useSSE";
@@ -16,7 +17,7 @@ import { useSwipeBack } from "@/hooks/useMobile";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
import { Plug, FolderOpen, Plus, GitBranch, GitCommitHorizontal, ShieldOff, Brain, Loader2, CalendarClock } from "lucide-react";
import { Plug, FolderOpen, Plus, GitBranch, GitCommitHorizontal, ShieldOff, Brain, Loader2, CalendarClock, Sparkles } from "lucide-react";
import { ResetPermissionsDialog } from "@/components/repo/ResetPermissionsDialog";
import { PendingActionsGroup } from "@/components/notifications/PendingActionsGroup";
import { invalidateConfigCaches } from "@/lib/queryInvalidation";
@@ -29,6 +30,7 @@ export function RepoDetail() {
const [fileBrowserOpen, setFileBrowserOpen] = useState(false);
const [switchConfigOpen, setSwitchConfigOpen] = useState(false);
const [mcpDialogOpen, setMcpDialogOpen] = useState(false);
const [skillsDialogOpen, setSkillsDialogOpen] = useState(false);
const [sourceControlOpen, setSourceControlOpen] = useState(false);
const [resetPermissionsOpen, setResetPermissionsOpen] = useState(false);
const pageRef = useRef<HTMLDivElement>(null);
@@ -146,6 +148,15 @@ export function RepoDetail() {
<Plug className="w-4 h-4 sm:mr-2" />
<span className="hidden sm:inline">MCP</span>
</Button>
<Button
variant="outline"
onClick={() => setSkillsDialogOpen(true)}
size="sm"
className="hidden md:flex text-foreground border-border hover:bg-accent transition-all duration-200 hover:scale-105"
>
<Sparkles className="w-4 h-4 sm:mr-2" />
<span className="hidden sm:inline">Skills</span>
</Button>
<Button
variant="outline"
onClick={() => setSourceControlOpen(true)}
@@ -205,6 +216,9 @@ export function RepoDetail() {
<DropdownMenuItem onClick={() => setMcpDialogOpen(true)}>
<Plug className="w-4 h-4 mr-2" /> MCP
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setSkillsDialogOpen(true)}>
<Sparkles className="w-4 h-4 mr-2" /> Skills
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setResetPermissionsOpen(true)}>
<ShieldOff className="w-4 h-4 mr-2" /> Reset Permissions
</DropdownMenuItem>
@@ -251,6 +265,12 @@ export function RepoDetail() {
directory={repoDirectory}
/>
<RepoSkillsDialog
open={skillsDialogOpen}
onOpenChange={setSkillsDialogOpen}
repoId={repoId}
/>
<SourceControlPanel
repoId={repoId}
isOpen={sourceControlOpen}
+3 -44
View File
@@ -14,8 +14,7 @@ import {
useRunRepoSchedule,
useUpdateRepoSchedule,
} from '@/hooks/useSchedules'
import { ScheduleJobDialog } from '@/components/schedules/ScheduleJobDialog'
import { JobsTab, JobDetailTab, RunHistoryTab } from '@/components/schedules'
import { ScheduleJobDialog, JobsTab, JobDetailTab, RunHistoryTab, ScheduleTabMenu } from '@/components/schedules'
import { toUpdateScheduleRequest, getJobStatusTone } from '@/components/schedules/schedule-utils'
import { Header } from '@/components/ui/header'
import { Button } from '@/components/ui/button'
@@ -23,7 +22,7 @@ import { Badge } from '@/components/ui/badge'
import { Card, CardContent } from '@/components/ui/card'
import { DeleteDialog } from '@/components/ui/delete-dialog'
import { getRepoDisplayName, cn } from '@/lib/utils'
import { CalendarClock, History, Info, Loader2, Plus } from 'lucide-react'
import { CalendarClock, Loader2, Plus } from 'lucide-react'
export function Schedules() {
const { id } = useParams<{ id: string }>()
@@ -270,47 +269,7 @@ export function Schedules() {
</div>
{hasJobs && (
<div className="flex border-t border-border bg-card/80 backdrop-blur-sm pb-[env(safe-area-inset-bottom)]">
<button
type="button"
className={cn(
'flex-1 flex flex-col items-center gap-1 py-2 text-xs font-medium transition-colors',
activeTab === 'jobs'
? 'bg-primary/10 text-primary'
: 'bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50'
)}
onClick={() => setActiveTab('jobs')}
>
<CalendarClock className="h-5 w-5" />
<span>Jobs</span>
</button>
<button
type="button"
className={cn(
'flex-1 flex flex-col items-center gap-1 py-2 text-xs font-medium transition-colors',
activeTab === 'detail'
? 'bg-primary/10 text-primary'
: 'bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50'
)}
onClick={() => setActiveTab('detail')}
>
<Info className="h-5 w-5" />
<span>Detail</span>
</button>
<button
type="button"
className={cn(
'flex-1 flex flex-col items-center gap-1 py-2 text-xs font-medium transition-colors',
activeTab === 'runs'
? 'bg-primary/10 text-primary'
: 'bg-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50'
)}
onClick={() => setActiveTab('runs')}
>
<History className="h-5 w-5" />
<span>Run History</span>
</button>
</div>
<ScheduleTabMenu activeTab={activeTab} onTabChange={setActiveTab} />
)}
<ScheduleJobDialog
+21 -1
View File
@@ -5,7 +5,7 @@ import { getRepo } from "@/api/repos";
import { MessageThread } from "@/components/message/MessageThread";
import { PromptInput, type PromptInputHandle } from "@/components/message/PromptInput";
import { FloatingTTSButton } from '@/components/message/FloatingTTSButton'
import { X, FolderOpen, Plug, Settings, CornerUpLeft, GitCommitHorizontal, Brain, ShieldOff, Code } from "lucide-react";
import { X, FolderOpen, Plug, Settings, CornerUpLeft, GitCommitHorizontal, Brain, ShieldOff, Code, Sparkles } from "lucide-react";
import { ModelSelectDialog } from "@/components/model/ModelSelectDialog";
import { Header } from "@/components/ui/header";
import { SessionList } from "@/components/session/SessionList";
@@ -37,6 +37,7 @@ import { RepoMcpDialog } from "@/components/repo/RepoMcpDialog";
import { ResetPermissionsDialog } from "@/components/repo/ResetPermissionsDialog";
import { LspStatusButton } from "@/components/repo/LspStatusButton";
import { RepoLspDialog } from "@/components/repo/RepoLspDialog";
import { RepoSkillsDialog } from "@/components/repo/RepoSkillsDialog";
import { createOpenCodeClient } from "@/api/opencode";
import { useSessionStatus, useSessionStatusForSession } from "@/stores/sessionStatusStore";
import { useQuestions } from "@/contexts/EventContext";
@@ -66,6 +67,7 @@ export function SessionDetail() {
const [fileBrowserOpen, setFileBrowserOpen] = useState(false);
const [lspDialogOpen, setLspDialogOpen] = useState(false);
const [mcpDialogOpen, setMcpDialogOpen] = useState(false);
const [skillsDialogOpen, setSkillsDialogOpen] = useState(false);
const [sourceControlOpen, setSourceControlOpen] = useState(false);
const [resetPermissionsOpen, setResetPermissionsOpen] = useState(false);
const [selectedFilePath, setSelectedFilePath] = useState<string | undefined>();
@@ -386,6 +388,15 @@ export function SessionDetail() {
directory={repoDirectory}
onClick={() => setLspDialogOpen(true)}
/>
<Button
variant="outline"
size="sm"
onClick={() => setSkillsDialogOpen(true)}
className="hidden md:flex text-foreground border-border hover:bg-accent transition-all duration-200 hover:scale-105"
>
<Sparkles className="w-4 h-4 sm:mr-2" />
<span className="hidden sm:inline">Skills</span>
</Button>
<Button
variant="outline"
size="sm"
@@ -441,6 +452,9 @@ export function SessionDetail() {
<DropdownMenuItem onClick={() => setMcpDialogOpen(true)}>
<Plug className="w-4 h-4 mr-2" /> MCP
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setSkillsDialogOpen(true)}>
<Sparkles className="w-4 h-4 mr-2" /> Skills
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setLspDialogOpen(true)}>
<Code className="w-4 h-4 mr-2" /> LSP
</DropdownMenuItem>
@@ -576,6 +590,12 @@ export function SessionDetail() {
directory={repoDirectory}
/>
<RepoSkillsDialog
open={skillsDialogOpen}
onOpenChange={setSkillsDialogOpen}
repoId={repoId}
/>
<RepoMcpDialog
open={mcpDialogOpen}
onOpenChange={setMcpDialogOpen}