()
| 169 | export const subscribe = skillsChanged.subscribe |
| 170 | |
| 171 | async function getWatchablePaths(): Promise<string[]> { |
| 172 | const fs = getFsImplementation() |
| 173 | const paths: string[] = [] |
| 174 | |
| 175 | // User skills directory (~/.claude/skills) |
| 176 | const userSkillsPath = getSkillsPath('userSettings', 'skills') |
| 177 | if (userSkillsPath) { |
| 178 | try { |
| 179 | await fs.stat(userSkillsPath) |
| 180 | paths.push(userSkillsPath) |
| 181 | } catch { |
| 182 | // Path doesn't exist, skip it |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | // User commands directory (~/.claude/commands) |
| 187 | const userCommandsPath = getSkillsPath('userSettings', 'commands') |
| 188 | if (userCommandsPath) { |
| 189 | try { |
| 190 | await fs.stat(userCommandsPath) |
| 191 | paths.push(userCommandsPath) |
| 192 | } catch { |
| 193 | // Path doesn't exist, skip it |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | // Project skills directory (.claude/skills) |
| 198 | const projectSkillsPath = getSkillsPath('projectSettings', 'skills') |
| 199 | if (projectSkillsPath) { |
| 200 | try { |
| 201 | // For project settings, resolve to absolute path |
| 202 | const absolutePath = platformPath.resolve(projectSkillsPath) |
| 203 | await fs.stat(absolutePath) |
| 204 | paths.push(absolutePath) |
| 205 | } catch { |
| 206 | // Path doesn't exist, skip it |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | // Project commands directory (.claude/commands) |
| 211 | const projectCommandsPath = getSkillsPath('projectSettings', 'commands') |
| 212 | if (projectCommandsPath) { |
| 213 | try { |
| 214 | // For project settings, resolve to absolute path |
| 215 | const absolutePath = platformPath.resolve(projectCommandsPath) |
| 216 | await fs.stat(absolutePath) |
| 217 | paths.push(absolutePath) |
| 218 | } catch { |
| 219 | // Path doesn't exist, skip it |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | // Additional directories (--add-dir) skills |
| 224 | for (const dir of getAdditionalDirectoriesForClaudeMd()) { |
| 225 | const additionalSkillsPath = platformPath.join(dir, '.claude', 'skills') |
| 226 | try { |
| 227 | await fs.stat(additionalSkillsPath) |
| 228 | paths.push(additionalSkillsPath) |
no test coverage detected