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:
Haileyesus
2026-04-07 13:24:01 +03:00
parent cb3304b60c
commit b09ce9dc60
23 changed files with 1693 additions and 1273 deletions

View File

@@ -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);
}
}