diff --git a/src-tauri/src/types.rs b/src-tauri/src/types.rs index d5dbb48..ff6aecd 100644 --- a/src-tauri/src/types.rs +++ b/src-tauri/src/types.rs @@ -479,7 +479,7 @@ fn default_claude_md_distribution_path() -> ClaudeMdDistributionPath { impl Default for AppSettings { fn default() -> Self { Self { - skill_source_dir: "~/.cc-workshop/skills".to_string(), + skill_source_dir: "/Users/feng/.agents/skill-library".to_string(), mcp_source_dir: "~/.cc-workshop/mcps".to_string(), claude_config_dir: "~/.claude".to_string(), anthropic_api_key: None, @@ -1822,7 +1822,7 @@ mod tests { #[test] fn test_app_settings_default() { let settings = AppSettings::default(); - assert_eq!(settings.skill_source_dir, "~/.cc-workshop/skills"); + assert_eq!(settings.skill_source_dir, "/Users/feng/.agents/skill-library"); assert_eq!(settings.mcp_source_dir, "~/.cc-workshop/mcps"); assert_eq!(settings.claude_config_dir, "~/.claude"); assert_eq!(settings.terminal_app, "Terminal"); diff --git a/src/pages/SettingsPage.tsx b/src/pages/SettingsPage.tsx index 884f503..4c0fd54 100644 --- a/src/pages/SettingsPage.tsx +++ b/src/pages/SettingsPage.tsx @@ -12,6 +12,7 @@ import { useScenesStore, useProjectsStore, } from '@/stores'; +import { LOCAL_SKILL_SOURCE_DIR, SKILL_MANAGER_LIBRARY_DIR } from '@/stores/settingsStore'; import { useClaudeMdStore } from '@/stores/claudeMdStore'; import { useRulesStore } from '@/stores/rulesStore'; import Modal from '@/components/common/Modal'; @@ -266,15 +267,18 @@ export function SettingsPage() { terminalApp, claudeCommand, warpOpenMode, + skillSourceDir, claudeMdDistributionPath, autoClassifyNewItems, classifyModel, setTerminalApp, setClaudeCommand, setWarpOpenMode, + setSkillSourceDir, setClaudeMdDistributionPath, setAutoClassifyNewItems, setClassifyModel, + selectDirectory, } = useSettingsStore(); // Get reload functions from stores to refresh data after recovery / reset @@ -294,6 +298,12 @@ export function SettingsPage() { // terminal is active. Avoids the awkward sentence-start lowercase brand // ("cmux Open Mode") that the per-brand label flavor would produce. const terminalOpenModeLabel = 'Open new sessions as'; + const skillSourceKind = + skillSourceDir === SKILL_MANAGER_LIBRARY_DIR + ? 'skill-manager canonical library' + : skillSourceDir === LOCAL_SKILL_SOURCE_DIR + ? 'CC Workshop local library' + : 'Custom source'; // R2-8e: validate the user-selected terminal app whenever it changes. // `null` = not yet checked (initial mount / between checks), so we @@ -334,6 +344,16 @@ export function SettingsPage() { ]); }, [loadSkills, loadMcps, loadClaudeMdFiles, loadRules, loadScenes, loadProjects]); + const handleUseSkillManagerSource = useCallback(async () => { + setSkillSourceDir(SKILL_MANAGER_LIBRARY_DIR); + await loadSkills(); + }, [loadSkills, setSkillSourceDir]); + + const handleChooseSkillSource = useCallback(async () => { + await selectDirectory('skill'); + await loadSkills(); + }, [loadSkills, selectDirectory]); + // Reset every auto-classify-produced classification (categories, tags, // and all item ↔ classification links). Items themselves stay; their // category / tag assignments are cleared. Used by the Settings "Reset @@ -530,6 +550,28 @@ export function SettingsPage() {
+ {/* Skill Source Directory */} + +
+ + Skill Source Directory + + {skillSourceKind} + + {skillSourceDir} + +
+
+ + Use skill-manager + + Choose... +
+
+ {/* Deleted Items */}
diff --git a/src/stores/__tests__/settingsStore.test.ts b/src/stores/__tests__/settingsStore.test.ts index 168f757..a78afb5 100644 --- a/src/stores/__tests__/settingsStore.test.ts +++ b/src/stores/__tests__/settingsStore.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, beforeEach } from 'vitest'; -import { useSettingsStore } from '../settingsStore'; +import { SKILL_MANAGER_LIBRARY_DIR, useSettingsStore } from '../settingsStore'; describe('settingsStore - utility methods and state', () => { beforeEach(() => { @@ -7,7 +7,7 @@ describe('settingsStore - utility methods and state', () => { // default to `true` so Marketplace installs auto-classify without the // user having to opt in. useSettingsStore.setState({ - skillSourceDir: '~/.cc-workshop/skills', + skillSourceDir: SKILL_MANAGER_LIBRARY_DIR, mcpSourceDir: '~/.cc-workshop/mcps', claudeConfigDir: '~/.claude', anthropicApiKey: '', @@ -27,7 +27,7 @@ describe('settingsStore - utility methods and state', () => { describe('initial state', () => { it('has correct default values', () => { const state = useSettingsStore.getState(); - expect(state.skillSourceDir).toBe('~/.cc-workshop/skills'); + expect(state.skillSourceDir).toBe(SKILL_MANAGER_LIBRARY_DIR); expect(state.mcpSourceDir).toBe('~/.cc-workshop/mcps'); expect(state.claudeConfigDir).toBe('~/.claude'); expect(state.anthropicApiKey).toBe(''); diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts index a2c6695..8757200 100644 --- a/src/stores/settingsStore.ts +++ b/src/stores/settingsStore.ts @@ -70,9 +70,12 @@ export interface SettingsState { hasApiKey: () => boolean; } +export const LOCAL_SKILL_SOURCE_DIR = '~/.cc-workshop/skills'; +export const SKILL_MANAGER_LIBRARY_DIR = '/Users/feng/.agents/skill-library'; + // Default values const defaultSettings = { - skillSourceDir: '~/.cc-workshop/skills', + skillSourceDir: SKILL_MANAGER_LIBRARY_DIR, mcpSourceDir: '~/.cc-workshop/mcps', claudeConfigDir: '~/.claude', anthropicApiKey: '',