Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src-tauri/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Replace hardcoded user-specific path with tilde notation.

The default skill_source_dir contains /Users/feng/.agents/skill-library, which is specific to user "feng" and will not work on other machines. Use tilde notation ~/.agents/skill-library instead, which will be expanded by the path utilities at runtime.

🛠️ Proposed fix
         Self {
-            skill_source_dir: "/Users/feng/.agents/skill-library".to_string(),
+            skill_source_dir: "~/.agents/skill-library".to_string(),
             mcp_source_dir: "~/.cc-workshop/mcps".to_string(),

As per coding guidelines, use expand_path() or expand_tilde() in src-tauri/src/utils/path.rs for cross-platform home directory handling.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src-tauri/src/types.rs` at line 482, The default value for skill_source_dir
is a hardcoded user-specific path ("/Users/feng/.agents/skill-library"); change
it to a tilde-based default like "~/.agents/skill-library" and ensure the code
that constructs or reads skill_source_dir uses the path expansion helper
(expand_path or expand_tilde from src-tauri/src/utils/path.rs) so the tilde is
resolved to the current user's home directory at runtime; update the
initialization of skill_source_dir to the tilde form and where skill_source_dir
is consumed, pass it through expand_path()/expand_tilde() (or call the helper
when setting the value) to achieve cross-platform, user-agnostic behavior.

mcp_source_dir: "~/.cc-workshop/mcps".to_string(),
claude_config_dir: "~/.claude".to_string(),
anthropic_api_key: None,
Expand Down Expand Up @@ -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");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update test assertion to use tilde notation.

The test assertion should be updated to expect ~/.agents/skill-library instead of the hardcoded user-specific path.

✅ Proposed fix
         let settings = AppSettings::default();
-        assert_eq!(settings.skill_source_dir, "/Users/feng/.agents/skill-library");
+        assert_eq!(settings.skill_source_dir, "~/.agents/skill-library");
         assert_eq!(settings.mcp_source_dir, "~/.cc-workshop/mcps");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
assert_eq!(settings.skill_source_dir, "/Users/feng/.agents/skill-library");
let settings = AppSettings::default();
assert_eq!(settings.skill_source_dir, "~/.agents/skill-library");
assert_eq!(settings.mcp_source_dir, "~/.cc-workshop/mcps");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src-tauri/src/types.rs` at line 1825, Update the test assertion that checks
settings.skill_source_dir to expect the tilde form instead of the hardcoded
absolute path: change the assertion comparing settings.skill_source_dir from
"/Users/feng/.agents/skill-library" to "~/.agents/skill-library" so the test is
user-agnostic (refer to the settings.skill_source_dir assertion in the test).

assert_eq!(settings.mcp_source_dir, "~/.cc-workshop/mcps");
assert_eq!(settings.claude_config_dir, "~/.claude");
assert_eq!(settings.terminal_app, "Terminal");
Expand Down
42 changes: 42 additions & 0 deletions src/pages/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -530,6 +550,28 @@ export function SettingsPage() {
<section>
<SectionHeader title="Storage" description="Manage application data and storage" />
<Card>
{/* Skill Source Directory */}
<Row>
<div className="flex min-w-0 flex-col gap-0.5">
<span className="text-[13px] font-medium text-[#18181B]">
Skill Source Directory
</span>
<span className="text-xs text-[#71717A]">{skillSourceKind}</span>
<span className="max-w-[380px] truncate font-mono text-[11px] text-[#A1A1AA]">
{skillSourceDir}
</span>
</div>
<div className="flex shrink-0 items-center gap-3">
<ActionButton
onClick={handleUseSkillManagerSource}
disabled={skillSourceDir === SKILL_MANAGER_LIBRARY_DIR}
>
Use skill-manager
</ActionButton>
<ActionButton onClick={handleChooseSkillSource}>Choose...</ActionButton>
</div>
</Row>

{/* Deleted Items */}
<Row noBorder>
<div className="flex flex-col gap-0.5">
Expand Down
6 changes: 3 additions & 3 deletions src/stores/__tests__/settingsStore.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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(() => {
// Reset store to defaults. V2 (D-Imp-12) flips `autoClassifyNewItems`
// 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: '',
Expand All @@ -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('');
Expand Down
5 changes: 4 additions & 1 deletion src/stores/settingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Comment on lines +73 to +74

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Replace hardcoded user-specific path with tilde notation.

SKILL_MANAGER_LIBRARY_DIR contains /Users/feng/.agents/skill-library, which is specific to user "feng" and will not work on other machines. Use tilde notation ~/.agents/skill-library instead so the path expands correctly for any user.

🛠️ Proposed fix
 export const LOCAL_SKILL_SOURCE_DIR = '~/.cc-workshop/skills';
-export const SKILL_MANAGER_LIBRARY_DIR = '/Users/feng/.agents/skill-library';
+export const SKILL_MANAGER_LIBRARY_DIR = '~/.agents/skill-library';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/stores/settingsStore.ts` around lines 73 - 74, Replace the hardcoded
user-specific path in SKILL_MANAGER_LIBRARY_DIR with a tilde-based path (e.g.,
'~/.agents/skill-library') so it is not bound to user "feng"; update the
exported constant SKILL_MANAGER_LIBRARY_DIR accordingly (similar to
LOCAL_SKILL_SOURCE_DIR) and ensure any runtime code that uses
SKILL_MANAGER_LIBRARY_DIR expands the tilde to the current user's home directory
when needed.


// Default values
const defaultSettings = {
skillSourceDir: '~/.cc-workshop/skills',
skillSourceDir: SKILL_MANAGER_LIBRARY_DIR,
mcpSourceDir: '~/.cc-workshop/mcps',
claudeConfigDir: '~/.claude',
anthropicApiKey: '',
Expand Down