mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-20 12:23:29 +00:00
* feat: update agent adapters for 2026 compatibility - Add new skill-translator module for cross-agent skill translation - Update Cursor adapter to use .cursor/rules/*.mdc format with YAML frontmatter - Update Windsurf adapter to use .windsurf/rules/*.md with mode field - Update GitHub Copilot to use .github/copilot-instructions.md - Update Trae to use .trae/rules/project_rules.md with YAML frontmatter - Update OpenCode global path to ~/.config/opencode/ - Add new discovery paths for Cursor, Kilo, Roo, Windsurf, GitHub Copilot - Improve agent detection with additional config file checks BREAKING CHANGE: Config file paths have changed for Cursor, Windsurf, Trae, and GitHub Copilot adapters to match their 2026 specifications. * feat: add e2e tests for skill-translator and fix translation issues - Add comprehensive e2e tests for skill translator (86 tests) - Fix translateSkillToAll to include all 17 agents - Fix writeTranslatedSkill to check for failed translations - Update vitest config to resolve workspace packages - Remove unnecessary 2026 comments from agent adapters and skill-translator * fix: improve agent detection and add overwrite option to translator Agent detection fixes: - github-copilot: Remove overly broad .github dir check, only detect Copilot-specific artifacts (copilot-instructions.md, instructions, ~/.copilot) - kilo: Fix modes path from .kilocodemodes to .kilocode/modes - roo: Fix modes path from .roomodes to .roo/modes Translator improvements: - Add overwrite option to writeTranslatedSkill() to prevent accidental overwrites - Return skipped flag when file exists and overwrite=false Refactoring: - Centralize agent config in packages/core/src/agent-config.ts - Update all agent adapters to use shared AGENT_CONFIG - Re-export utility functions for backwards compatibility * fix: update clawdbot test and use workspace dependency - Update clawdbot test to expect new standardized skillsDir (.clawdbot/skills) - Change @skillkit/core dependency to workspace:* for proper monorepo linking * fix: address CodeRabbit and Devin review suggestions - Remove AGENTS.md from detection in Kilo, Roo, Trae adapters (prevents false positives) - Fix AmpAdapter detection path (check .amp instead of .agents) - Fix regex pattern in parseConfig for markdown adapters to match any skill name format - Add hooks and permissionMode to specialFields for proper extraction - Add path traversal protection in writeTranslatedSkill - Fix boolean field preservation using 'in' check instead of truthy checks - Add mode field preservation for Windsurf - Add permissionMode support for Roo adapter
86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
import { existsSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import { homedir } from 'node:os';
|
|
import type { AgentAdapter } from './base.js';
|
|
import { createSkillXml } from './base.js';
|
|
import type { Skill, AgentType } from '@skillkit/core';
|
|
import { AGENT_CONFIG } from '@skillkit/core';
|
|
|
|
const config = AGENT_CONFIG.cursor;
|
|
|
|
export class CursorAdapter implements AgentAdapter {
|
|
readonly type: AgentType = 'cursor';
|
|
readonly name = 'Cursor';
|
|
readonly skillsDir = config.skillsDir;
|
|
readonly configFile = config.configFile;
|
|
|
|
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 `---
|
|
description: SkillKit skills integration - provides specialized capabilities and domain knowledge
|
|
globs: "**/*"
|
|
alwaysApply: true
|
|
---
|
|
# 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 cursorDir = join(process.cwd(), '.cursor');
|
|
const cursorRulesDir = join(process.cwd(), '.cursor', 'rules');
|
|
// Legacy .cursorrules file (deprecated but still supported)
|
|
const cursorRulesFile = join(process.cwd(), '.cursorrules');
|
|
// Global Cursor config
|
|
const globalCursor = join(homedir(), '.cursor');
|
|
|
|
return existsSync(cursorDir) || existsSync(cursorRulesDir) ||
|
|
existsSync(cursorRulesFile) || existsSync(globalCursor);
|
|
}
|
|
}
|