feat: directory files upload system, deferred restart model, cache invalidation consolidation, and misc improvements (#281)

* feat: show variant label on model picker and add folder upload for agents/commands

- Replace three-dot variant menu trigger with selected variant label
- Add POST /api/settings/opencode-directory-files/install endpoint
- Upload agents/commands markdown folders into .config/opencode/{agents,commands}/
- Reload OpenCode server after upload so files are picked up

* fix: revalidate branch/git caches when mobile sheet opens and on vcs.branch.updated SSE

- add shared invalidateRepoGitCaches() helper for consistent invalidation
- revalidate repo list when mobile repo quick-switch sheet opens
- revalidate current repo when mobile More drawer opens
- revalidate repo/git caches when Source Control dialog opens
- handle vcs.branch.updated SSE event with optimistic cache update
- use helper in branch create/switch mutations in useGit and BranchesTab

* style: make variant selector look more like a button with chevron and compact sizing

* refactor: consolidate settings editors, add folder upload support, and clean up unused code

* refactor: consolidate settings editors, add folder upload support, and clean up unused code

* feat: add opencode-directory-files listing service and consolidate settings editors

* fix: distinguish scroll from tap in suggestion popups on touch devices

* refactor: consolidate settings editors and add DirectoryFilesList component

* refactor: target repo status cache updates only to affected batch entries

* refactor: streamline settings, git hooks, and query invalidation logic
This commit is contained in:
Chris Scott authored and GitHub committed 2026-06-20 00:40:36 -04:00
1 parent e53b4fd32c
commit 617962f2dd
48 files changed
+1522 -293

No files matched your search

@@ -8,6 +8,7 @@ import { useUrlParams } from '@/hooks/useUrlParams'
import { useUIState } from '@/stores/uiStateStore'
import { useQuery } from '@tanstack/react-query'
import { getRepo } from '@/api/repos'
import { useRefreshOnOpen } from '@/hooks/useRefreshOnOpen'
import { OPENCODE_API_ENDPOINT } from '@/config'
import { SideDrawer, SideDrawerContent } from '@/components/ui/side-drawer'
import { FileBrowserSheet } from '@/components/file-browser/FileBrowserSheet'
@@ -51,12 +52,14 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
}
}, [isOpen, bind])
const { data: repo } = useQuery({
const { data: repo, refetch: refetchRepo } = useQuery({
queryKey: ['repo', repoId],
queryFn: () => repoId ? getRepo(repoId) : null,
enabled: !!repoId,
})
useRefreshOnOpen(isOpen && repoId != null, () => { void refetchRepo() })
const currentBranch = repo?.currentBranch || repo?.branch
const repoDisplayName = isAssistantRoute || isAssistantSession
? 'Assistant'
@@ -1,6 +1,7 @@
import { useState, useMemo } from 'react'
import { useNavigate, useLocation } from 'react-router-dom'
import { useQuery } from '@tanstack/react-query'
import { useRefreshOnOpen } from '@/hooks/useRefreshOnOpen'
import { Input } from '@/components/ui/input'
import { BottomSheet, BottomSheetHeader, BottomSheetContent } from '@/components/ui/bottom-sheet'
import { Button } from '@/components/ui/button'
@@ -30,12 +31,14 @@ export function RepoQuickSwitchSheet({ isOpen, onClose }: RepoQuickSwitchSheetPr
return match ? Number(match[1]) : null
}, [location.pathname])
const { data: repos, isLoading } = useQuery({
const { data: repos, isLoading, refetch } = useQuery({
queryKey: ['repos'],
queryFn: listRepos,
enabled: isOpen,
})
useRefreshOnOpen(isOpen, () => { void refetch() })
const regularRepos = useMemo(
() => repos?.filter((r) => r.id !== ASSISTANT_REPO_ID) ?? null,
[repos],