Files
skillkit/packages/agents/src/cursor.ts
T
Rohit Ghumare 160d2b1534 feat: add TUI enhancements and monorepo structure (#2)
* feat: add TUI enhancements and monorepo structure

- Add Translate screen for cross-agent skill translation
- Add Context screen for project context management
- Add Recommend screen with smart skill recommendations
- Fix TUI screen duplication by using fixed height container
- Clean up unnecessary comments following code-simplifier principles
- Refactor to monorepo structure with @skillkit/core, @skillkit/cli,
  @skillkit/tui, and @skillkit/agents packages
- Add comprehensive tests for translator, context, and recommend features
- Update license to Apache-2.0
- Add CONTRIBUTING.md with contribution guidelines

* ci: switch from npm to pnpm for monorepo support

* ci: use pnpm version from package.json

* fix: remove unused import in TUI helpers
2026-01-23 09:41:15 +00:00

72 lines
1.8 KiB
TypeScript

import { existsSync } from 'node:fs';
import { join } from 'node:path';
import type { AgentAdapter } from './base.js';
import { createSkillXml } from './base.js';
import type { Skill, AgentType } from '@skillkit/core';
export class CursorAdapter implements AgentAdapter {
readonly type: AgentType = 'cursor';
readonly name = 'Cursor';
readonly skillsDir = '.cursor/skills';
readonly configFile = '.cursorrules';
generateConfig(skills: Skill[]): string {
const enabledSkills = skills.filter(s => s.enabled);
if (enabledSkills.length === 0) {
return '';
}
const skillsList = enabledSkills
.map(s => `- **${s.name}**: ${s.description}`)
.join('\n');
const skillsXml = enabledSkills.map(createSkillXml).join('\n\n');
return `# Skills System
You have access to specialized skills that can help complete tasks. Use the skillkit CLI to load skill instructions when needed.
## Available Skills
${skillsList}
## How to Use Skills
When a task matches a skill's description, load it with:
\`\`\`bash
skillkit read <skill-name>
\`\`\`
The skill will provide detailed instructions for completing the task.
<!-- SKILLS_DATA_START -->
${skillsXml}
<!-- SKILLS_DATA_END -->
`;
}
parseConfig(content: string): string[] {
const skillNames: string[] = [];
const skillRegex = /<name>([^<]+)<\/name>/g;
let match;
while ((match = skillRegex.exec(content)) !== null) {
skillNames.push(match[1].trim());
}
return skillNames;
}
getInvokeCommand(skillName: string): string {
return `skillkit read ${skillName}`;
}
async isDetected(): Promise<boolean> {
const cursorRules = join(process.cwd(), '.cursorrules');
const cursorDir = join(process.cwd(), '.cursor');
return existsSync(cursorRules) || existsSync(cursorDir);
}
}