Brixyy commited on
Commit
2ffa63d
·
unverified ·
1 Parent(s): 28f45a6

fix: add workspace skill root to skill-sync.ts (#411)

Browse files

Fixes #410 — getSkillRoots() in skill-sync.ts was not updated when #408 added workspace support to route.ts, causing the scheduler sync to never populate workspace skills (always showing 0).

Files changed (1) hide show
  1. src/lib/skill-sync.ts +3 -2
src/lib/skill-sync.ts CHANGED
@@ -1,7 +1,7 @@
1
  /**
2
  * Skill Sync — Bidirectional disk ↔ DB synchronization for agent skills.
3
  *
4
- * Scans 4 skill roots for directories containing SKILL.md, hashes content,
5
  * and upserts into the `skills` DB table. UI edits write through to disk
6
  * and update the content hash so the next sync cycle skips them.
7
  *
@@ -66,6 +66,7 @@ function getSkillRoots(): Array<{ source: string; path: string }> {
66
  { source: 'project-agents', path: process.env.MC_SKILLS_PROJECT_AGENTS_DIR || join(cwd, '.agents', 'skills') },
67
  { source: 'project-codex', path: process.env.MC_SKILLS_PROJECT_CODEX_DIR || join(cwd, '.codex', 'skills') },
68
  { source: 'openclaw', path: process.env.MC_SKILLS_OPENCLAW_DIR || join(openclawState, 'skills') },
 
69
  ]
70
  }
71
 
@@ -126,7 +127,7 @@ export async function syncSkillsFromDisk(): Promise<{ ok: boolean; message: stri
126
  }
127
 
128
  // Fetch current DB rows (only local sources, not registry-installed via slug)
129
- const localSources = ['user-agents', 'user-codex', 'project-agents', 'project-codex', 'openclaw']
130
  const dbRows = db.prepare(
131
  `SELECT * FROM skills WHERE source IN (${localSources.map(() => '?').join(',')})`
132
  ).all(...localSources) as SkillRow[]
 
1
  /**
2
  * Skill Sync — Bidirectional disk ↔ DB synchronization for agent skills.
3
  *
4
+ * Scans 5 skill roots for directories containing SKILL.md, hashes content,
5
  * and upserts into the `skills` DB table. UI edits write through to disk
6
  * and update the content hash so the next sync cycle skips them.
7
  *
 
66
  { source: 'project-agents', path: process.env.MC_SKILLS_PROJECT_AGENTS_DIR || join(cwd, '.agents', 'skills') },
67
  { source: 'project-codex', path: process.env.MC_SKILLS_PROJECT_CODEX_DIR || join(cwd, '.codex', 'skills') },
68
  { source: 'openclaw', path: process.env.MC_SKILLS_OPENCLAW_DIR || join(openclawState, 'skills') },
69
+ { source: 'workspace', path: process.env.MC_SKILLS_WORKSPACE_DIR || join(process.env.OPENCLAW_WORKSPACE_DIR || process.env.MISSION_CONTROL_WORKSPACE_DIR || join(openclawState, 'workspace'), 'skills') },
70
  ]
71
  }
72
 
 
127
  }
128
 
129
  // Fetch current DB rows (only local sources, not registry-installed via slug)
130
+ const localSources = ['user-agents', 'user-codex', 'project-agents', 'project-codex', 'openclaw', 'workspace']
131
  const dbRows = db.prepare(
132
  `SELECT * FROM skills WHERE source IN (${localSources.map(() => '?').join(',')})`
133
  ).all(...localSources) as SkillRow[]