feat(settings): group agents and skills sidebar by subfolder (#464)
* feat(settings): group agents and skills by subfolder in sidebar - Server: fix getUserAgentPath() to walk subfolders so grouped agent layouts (e.g. agents/business/ceo.md) are correctly resolved - Store: add 'group' field to AgentWithExtras and DiscoveredSkill, parsed from file path at load time - UI: add collapsible SidebarGroup component with localStorage-persisted expand/collapse state - AgentsSidebar: render custom agents grouped by subfolder name - SkillsSidebar: render project/user skills grouped by domain folder - Ungrouped items (flat root) fall through and render normally * fix(settings): normalize group paths and add agent lookup caching parity --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
3cd6d051cb
commit
b2101acfbf
@@ -64,6 +64,23 @@ export interface DiscoveredSkill {
|
||||
scope: SkillScope;
|
||||
source: SkillSource;
|
||||
description?: string;
|
||||
/** Domain folder parsed from file path, e.g. "automation-ai", "lark-ecosystem" */
|
||||
group?: string;
|
||||
}
|
||||
|
||||
/** Parse the domain group folder from a skill file path.
|
||||
* e.g. "~/.config/opencode/skills/automation-ai/ai-production/SKILL.md" → "automation-ai"
|
||||
* e.g. "~/.config/opencode/skills/theme-system/SKILL.md" → undefined (flat)
|
||||
*/
|
||||
function parseSkillGroup(path: string): string | undefined {
|
||||
const normalizedPath = path.replace(/\\/g, '/');
|
||||
const idx = normalizedPath.lastIndexOf('/skills/');
|
||||
if (idx === -1) return undefined;
|
||||
const relative = normalizedPath.substring(idx + '/skills/'.length);
|
||||
const parts = relative.split('/');
|
||||
// Grouped layout: <group>/<name>/SKILL.md → parts.length >= 3
|
||||
// Flat layout: <name>/SKILL.md → parts.length == 2
|
||||
return parts.length >= 3 ? parts[0] : undefined;
|
||||
}
|
||||
|
||||
// Raw skill response from API before transformation
|
||||
@@ -185,6 +202,7 @@ export const useSkillsStore = create<SkillsStore>()(
|
||||
scope: s.scope ?? 'user',
|
||||
source: s.source ?? 'opencode',
|
||||
description: s.sources?.md?.description || '',
|
||||
group: parseSkillGroup(s.path),
|
||||
}));
|
||||
|
||||
set({ skills, isLoading: false });
|
||||
|
||||
Reference in New Issue
Block a user