From 535de2fcedcc52d1da9dbc2c5ae369bd5bb44807 Mon Sep 17 00:00:00 2001 From: Willie Date: Thu, 8 Oct 2026 12:01:42 +0800 Subject: [PATCH] feat(ui): install missing entries, prune deleted skills, and calmer sync and skills pages Installing what config records still needed the CLI, and skills deleted upstream showed as updates with nothing to update. The Update page and install dialog now offer Install all for missing entries, and stale skills get Prune / Prune all, which move them to trash in one request. A sync of hundreds of changes was a wall of identical rows per target. Sync now groups targets that receive the same changes into one card listing names by folder, keeps its action bar and summary sticky, and adds Discard all, which moves skills that were never synced anywhere to trash after a confirmation. The Skills page keeps its toolbar and group heads in view while scrolling, folds New skill and Link folder into the Install menu, remembers filters in the browser, and moves Update repo into the repo menu. --- ui/src/api/install.ts | 5 +- ui/src/api/types/install.ts | 15 ++ ui/src/api/types/update.ts | 12 - ui/src/api/update.ts | 12 +- ui/src/components.css | 24 +- ui/src/components/ConfigInstallPanel.tsx | 81 +++++++ ui/src/components/InstallDialog.tsx | 17 +- ui/src/components/TargetMenu.tsx | 11 +- .../skill-editor/FrontmatterEditor.tsx | 2 +- ui/src/components/sync/syncView.test.ts | 27 ++- ui/src/components/sync/syncView.ts | 40 +++- ui/src/hooks/useInstallFromConfig.ts | 105 +++++++++ ui/src/hooks/useSyncMatrix.ts | 3 +- ui/src/i18n/locales/de.json | 50 +++- ui/src/i18n/locales/en.json | 58 ++++- ui/src/i18n/locales/es.json | 50 +++- ui/src/i18n/locales/fa.json | 50 +++- ui/src/i18n/locales/fr.json | 50 +++- ui/src/i18n/locales/id.json | 50 +++- ui/src/i18n/locales/ja.json | 50 +++- ui/src/i18n/locales/ko.json | 50 +++- ui/src/i18n/locales/pt-BR.json | 50 +++- ui/src/i18n/locales/zh-CN.json | 50 +++- ui/src/i18n/locales/zh-TW.json | 50 +++- ui/src/lib/queryEvents.test.ts | 6 +- ui/src/lib/queryEvents.ts | 4 +- ui/src/lib/queryKeys.ts | 4 +- ui/src/pages/ResourcesPage.test.tsx | 37 ++- ui/src/pages/ResourcesPage.tsx | 185 +++++++++++---- ui/src/pages/SyncPage.test.tsx | 23 +- ui/src/pages/SyncPage.tsx | 213 +++++++++++++----- ui/src/pages/UpdatePage.test.tsx | 35 ++- ui/src/pages/UpdatePage.tsx | 170 +++++++++++--- 33 files changed, 1323 insertions(+), 266 deletions(-) create mode 100644 ui/src/components/ConfigInstallPanel.tsx create mode 100644 ui/src/hooks/useInstallFromConfig.ts diff --git a/ui/src/api/install.ts b/ui/src/api/install.ts index 77811e77f..b8950c3ff 100644 --- a/ui/src/api/install.ts +++ b/ui/src/api/install.ts @@ -1,5 +1,5 @@ import { apiFetch, BASE, createSSEStream } from './http'; -import type { BatchInstallResult, CheckResult, DiscoverResult, DiscoveredSkill, HubConfigResponse, HubIndex, HubSavedEntry, InstallResult, SearchResult, SkillPreview } from './types/install'; +import type { BatchInstallResult, CheckResult, ConfigEntry, DiscoverResult, DiscoveredSkill, HubConfigResponse, HubIndex, HubSavedEntry, InstallFromConfigResult, InstallResult, SearchResult, SkillPreview } from './types/install'; export const installApi = { hubIndex: () => apiFetch('/hub/index'), @@ -48,6 +48,9 @@ export const installApi = { method: 'POST', body: JSON.stringify(opts), }), + // Entries recorded in config but not on disk (bare `skillshare install`) + missingConfigEntries: () => apiFetch<{ entries: ConfigEntry[]; file: string }>('/install/missing'), + installFromConfig: () => apiFetch('/install/from-config', { method: 'POST' }), installBatch: (opts: { source: string; skills: DiscoveredSkill[]; force?: boolean; skipAudit?: boolean; into?: string; name?: string; branch?: string; kind?: 'skill' | 'agent' }) => apiFetch('/install/batch', { method: 'POST', diff --git a/ui/src/api/types/install.ts b/ui/src/api/types/install.ts index bb24ea1dd..d7f30ec46 100644 --- a/ui/src/api/types/install.ts +++ b/ui/src/api/types/install.ts @@ -92,6 +92,21 @@ export interface SkillCheckResult { message?: string; } +export interface ConfigEntry { + name: string; + source: string; + tracked: boolean; + branch?: string; +} + +export interface InstallFromConfigResult { + installed: number; + installedRepos: number; + installedRepoSkills: number; + skipped: number; + failed: string[]; +} + export interface CheckResult { linked_repos?: LinkedRepo[]; tracked_repos: RepoCheckResult[]; diff --git a/ui/src/api/types/update.ts b/ui/src/api/types/update.ts index 7880f26fa..f46b23c78 100644 --- a/ui/src/api/types/update.ts +++ b/ui/src/api/types/update.ts @@ -8,23 +8,11 @@ export interface UpdateResultItem { auditRiskLabel?: string; } -export interface MissingTrackedRepo { - name: string; - source: string; - branch?: string; -} - export interface UpdateStreamSummary { updated: number; upToDate: number; blocked: number; errors: number; skipped: number; - missingTrackedRepos?: MissingTrackedRepo[]; } -export interface RehydrateResultItem { - name: string; - action: string; // "rehydrated" | "error" - error?: string; -} diff --git a/ui/src/api/update.ts b/ui/src/api/update.ts index 24f1ba74c..1709e47c9 100644 --- a/ui/src/api/update.ts +++ b/ui/src/api/update.ts @@ -1,9 +1,9 @@ import { apiFetch, BASE, createSSEStream } from './http'; -import type { MissingTrackedRepo, RehydrateResultItem, UpdateResultItem, UpdateStreamSummary } from './types/update'; +import type { UpdateResultItem, UpdateStreamSummary } from './types/update'; export const updateApi = { update: (opts: { name?: string; kind?: 'skill' | 'agent'; force?: boolean; all?: boolean; skipAudit?: boolean }) => - apiFetch<{ results: UpdateResultItem[]; missingTrackedRepos?: MissingTrackedRepo[] }>('/update', { + apiFetch<{ results: UpdateResultItem[] }>('/update', { method: 'POST', body: JSON.stringify(opts), }), @@ -24,12 +24,4 @@ export const updateApi = { done: onDone, }, onError, 'Update stream failed'); }, - // Tracked repos declared in metadata but absent on disk (issue #212) - missingTrackedRepos: () => - apiFetch<{ repos: MissingTrackedRepo[] }>('/update/missing-tracked-repos'), - // Rehydrate tracked repos declared in metadata but absent on disk (issue #212) - rehydrateTrackedRepos: () => - apiFetch<{ results: RehydrateResultItem[] }>('/update/rehydrate', { - method: 'POST', - }), }; diff --git a/ui/src/components.css b/ui/src/components.css index 925f4350f..49dd2b97e 100644 --- a/ui/src/components.css +++ b/ui/src/components.css @@ -233,6 +233,15 @@ svg.lucide { flex: none; stroke-width: var(--isw); } .ss-gh { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 16px; background: var(--sunken); border-top: var(--sep); font-size: 13px; } .ss-gh:first-child { border-top: 0; } .ss-plain .ss-r { padding-left: 0; padding-right: 0; min-height: 44px; } +/* A toolbar that sticks to the top while its list scrolls; .stick lists keep their header and group heads under it */ +.ss-stickbar { position: sticky; top: 0; z-index: 20; margin: 0 -12px; padding: 12px; background: var(--bg); } +.ss-stickbar.stuck { box-shadow: 0 1px 0 var(--line); } +.ss-btnpair { display: inline-flex; } +.ss-btnpair>.ss-btn:first-child:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 12px; } +.ss-btnpair>.ss-btn:last-child:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 9px; border-left: 1px solid color-mix(in srgb, var(--on-pri) 22%, transparent); } +.ss-list.stick { overflow: clip; } +.ss-list.stick>.ss-lh { position: sticky; top: var(--stick, 0px); z-index: 3; } +.ss-list.stick>.ss-gh { position: sticky; top: calc(var(--stick, 0px) + 34px); z-index: 2; } /* Update progress: a bar on the status card, a moving line under the row being updated, and a pop when a row finishes */ .ss-update-icon { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; background: var(--sunken); color: var(--ink); } .ss-update-icon.ok { background: var(--ok-bg); color: var(--ok); } @@ -249,9 +258,20 @@ svg.lucide { flex: none; stroke-width: var(--isw); } @keyframes ss-indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } } @keyframes ss-flash { from { background: var(--ok-bg); } to { background: transparent; } } @keyframes ss-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } } +/* Collapse a block to nothing: wrap it in .ss-collapse and add .shut */ +.ss-collapse { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .45s cubic-bezier(.3,.7,.3,1), opacity .3s; } +.ss-collapse>* { overflow: hidden; min-height: 0; } +.ss-collapse.shut { grid-template-rows: 0fr; opacity: 0; } +/* A removed row slides out, then its .ss-collapse wrapper closes the gap */ +.ss-collapse.out { grid-template-rows: 0fr; transition-delay: .2s; } +.ss-collapse.out .ss-r { transform: translateX(-32px); opacity: 0; } +.ss-collapse .ss-r { transition: transform .26s cubic-bezier(.5,0,.75,0), opacity .22s, background .3s; } +.ss-note.ok { background: var(--ok-bg); border-color: transparent; } +.ss-note.ok>svg { color: var(--ok); } +.ss-note.live { position: relative; overflow: hidden; transition: background .45s; } @media (prefers-reduced-motion: reduce) { .ss-bar.indet>span, .ss-rowbar::after, .ss-r.flash, .ss-pop { animation: none; } - .ss-bar>span { transition: none; } + .ss-bar>span, .ss-collapse, .ss-collapse .ss-r, .ss-note.live { transition: none; } } .ss-note { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); font-size: 13px; line-height: 1.5; } :root[data-theme="playful"] .ss-note { border: 2px solid var(--line); border-radius: 12px; } @@ -462,6 +482,8 @@ span.bad, b.bad, svg.bad { color: var(--bad); } :root[data-theme="playful"] .ss-gh { background: var(--pe); border-top: 2px solid var(--line); border-bottom: 1.5px dashed var(--line); } :root[data-theme="playful"] .ss-gh:first-child { border-top: 0; } :root[data-theme="playful"] .ss-lh+.ss-gh { border-top: 0; } +:root[data-theme="playful"] .ss-list.stick>.ss-lh { background: var(--surface); } +:root[data-theme="playful"] .ss-list.stick>.ss-gh { top: calc(var(--stick, 0px) + 36px); } :root[data-theme="playful"] .ss-gh+.ss-r { border-top: 0; } :root[data-theme="playful"] .ss-tabs { border-bottom: 0; gap: 8px; } :root[data-theme="playful"] .ss-tabs>* { margin: 0; padding: 0 14px; height: 34px; border: 2px solid transparent; border-radius: 999px; } diff --git a/ui/src/components/ConfigInstallPanel.tsx b/ui/src/components/ConfigInstallPanel.tsx new file mode 100644 index 000000000..c7e391d96 --- /dev/null +++ b/ui/src/components/ConfigInstallPanel.tsx @@ -0,0 +1,81 @@ +import type { CSSProperties, ReactNode } from 'react'; +import { Check, CircleAlert, Download, FolderDown, GitBranch, Loader2, Puzzle, X } from 'lucide-react'; +import Button from './Button'; +import { parseRemoteURL } from '../lib/parseRemoteURL'; +import { plural, useT } from '../i18n'; +import { useInstallFromConfig } from '../hooks/useInstallFromConfig'; + +/** Rows finish one after another, so results read top to bottom. */ +const stagger = (i: number): CSSProperties => ({ animationDelay: `${i * 90}ms`, animationFillMode: 'both' }); + +/** Install dialog section: what config records but the disk lacks, installed in one go. */ +export default function ConfigInstallPanel() { + const t = useT(); + const { entries, file, phase, done, failed, summary, contents, error, run, dismiss } = useInstallFromConfig(); + if (entries.length === 0) return null; + + let icon = ; + let tone = ''; + let title = t(plural('install.fromConfig.title', entries.length), { count: entries.length, file }); + let sub = t('install.fromConfig.hint', { items: contents }); + let action: ReactNode = ; + if (phase === 'running') { + icon = ; + title = t('install.fromConfig.installing', { file }); + sub = t('install.audited'); + action = null; + } else if (done) { + icon = failed.size ? : ; + tone = failed.size ? 'warn' : 'ok'; + title = summary; + sub = t(failed.size ? 'install.fromConfig.failedHint' : 'install.fromConfig.syncHint', { file }); + action = failed.size + ? + : ; + } else if (error) { + tone = 'bad'; + icon = ; + sub = error; + } + + return ( +
+
+
+ {icon} +
+ {title} + {sub} +
+ {action} +
+ {phase === 'running' &&
} +
+
+ {entries.map((e, i) => { + const bad = done && failed.has(e.name); + const row = phase === 'running' ? 'updating' : done && !bad ? 'flash' : ''; + return ( +
+ {e.tracked + ? + : } + {e.name} + {e.tracked && tracked} + {parseRemoteURL(e.source)?.ownerRepo ?? e.source} + + {phase === 'running' && } + {done && (bad + ? + : )} + + {phase === 'running' && } +
+ ); + })} +
+
+
+
+ ); +} diff --git a/ui/src/components/InstallDialog.tsx b/ui/src/components/InstallDialog.tsx index 2c20a5e4b..a46367855 100644 --- a/ui/src/components/InstallDialog.tsx +++ b/ui/src/components/InstallDialog.tsx @@ -33,6 +33,7 @@ import { queryKeys, staleTimes } from '../lib/queryKeys'; import { formatSkillDisplayName } from '../lib/resourceNames'; import { useI18n, useT } from '../i18n'; import Button from './Button'; +import ConfigInstallPanel from './ConfigInstallPanel'; import { Checkbox } from './Checkbox'; import DialogShell from './DialogShell'; import EmptyState from './EmptyState'; @@ -58,6 +59,7 @@ const COMMUNITY_HUB: HubSavedEntry = { builtIn: true, }; const STEP = 10; +/** Past this many found items, a filter box shows. */ const FOUND_PREVIEW = 5; /** Backend error code for a mixed-track-repo ambiguity (see internal/server/handler_install.go). */ const TRACK_KIND_AMBIGUOUS = 'install.track_kind_ambiguous'; @@ -136,7 +138,6 @@ export default function InstallDialog({ kind, initialTab, initialSource, onClose const [wanted, setWanted] = useState(null); const [selected, setSelected] = useState>(new Set()); const [filter, setFilter] = useState(''); - const [expanded, setExpanded] = useState(false); const [kindChoice, setKindChoice] = useState(null); const [kindPick, setKindPick] = useState(kind); @@ -297,7 +298,6 @@ export default function InstallDialog({ kind, initialTab, initialSource, onClose const preselected = requestedSkills(wanted, from, items) ?? items.filter((i) => !isInstalled(i.kind ?? 'skill', discoveredSource(from, i.path))); setSelected(new Set(preselected.map((i) => i.path))); setFilter(''); - setExpanded(false); setTab('url'); setView(null); }; @@ -630,6 +630,7 @@ export default function InstallDialog({ kind, initialTab, initialSource, onClose } body = ( <> + {!isAgent && } {tabs}