mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-10 16:35:43 +08:00
refactor: add mcp and skills to llmService
- Deleted the llmSkillsService implementation and its associated methods for listing provider skills. - Updated tests to use llmService instead of llmMcpService and llmSkillsService for handling MCP and skills functionalities. - Adjusted test cases to reflect the new service structure while maintaining existing functionality.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
import type { IProviderSkillsRuntime, ProviderSkill, ProviderSkillScope } from '@/modules/llm/providers/provider.interface.js';
|
||||
import {
|
||||
deduplicateDirectories,
|
||||
deduplicateSkills,
|
||||
listSkillsFromDirectory,
|
||||
} from '@/modules/llm/providers/runtimes/skills-runtime.utils.js';
|
||||
|
||||
/**
|
||||
* Cursor skills runtime backed by user/project skill directories.
|
||||
*/
|
||||
export class CursorSkillsRuntime implements IProviderSkillsRuntime {
|
||||
/**
|
||||
* Lists all available Cursor skills from documented directories.
|
||||
*/
|
||||
async listSkills(options?: { workspacePath?: string }): Promise<ProviderSkill[]> {
|
||||
const workspacePath = path.resolve(options?.workspacePath ?? process.cwd());
|
||||
const home = os.homedir();
|
||||
const candidateDirectories: Array<{ scope: ProviderSkillScope; directory: string }> = [
|
||||
{ scope: 'project', directory: path.join(workspacePath, '.agents', 'skills') },
|
||||
{ scope: 'project', directory: path.join(workspacePath, '.cursor', 'skills') },
|
||||
{ scope: 'user', directory: path.join(home, '.cursor', 'skills') },
|
||||
];
|
||||
|
||||
const skills: ProviderSkill[] = [];
|
||||
for (const candidate of deduplicateDirectories(candidateDirectories)) {
|
||||
const loadedSkills = await listSkillsFromDirectory({
|
||||
provider: 'cursor',
|
||||
scope: candidate.scope,
|
||||
skillsDirectory: candidate.directory,
|
||||
invocationPrefix: '/',
|
||||
});
|
||||
skills.push(...loadedSkills);
|
||||
}
|
||||
|
||||
return deduplicateSkills(skills);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user