mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-19 02:13:58 +00:00
- 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
75 lines
2.1 KiB
TypeScript
75 lines
2.1 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';
|
|
|
|
export class GitHubCopilotAdapter implements AgentAdapter {
|
|
readonly type: AgentType = 'github-copilot';
|
|
readonly name = 'GitHub Copilot';
|
|
readonly skillsDir = '.github/skills';
|
|
readonly configFile = 'AGENTS.md';
|
|
|
|
generateConfig(skills: Skill[]): string {
|
|
const enabledSkills = skills.filter(s => s.enabled);
|
|
|
|
if (enabledSkills.length === 0) {
|
|
return '';
|
|
}
|
|
|
|
const skillsXml = enabledSkills.map(createSkillXml).join('\n\n');
|
|
|
|
return `<skills_system priority="1">
|
|
|
|
## Available Skills
|
|
|
|
<!-- SKILLS_TABLE_START -->
|
|
<usage>
|
|
When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
|
|
|
|
How to use skills:
|
|
- Invoke: \`skillkit read <skill-name>\` or \`npx skillkit read <skill-name>\`
|
|
- The skill content will load with detailed instructions on how to complete the task
|
|
- Base directory provided in output for resolving bundled resources (references/, scripts/, assets/)
|
|
|
|
Usage notes:
|
|
- Only use skills listed in <available_skills> below
|
|
- Do not invoke a skill that is already loaded in your context
|
|
- Each skill invocation is stateless
|
|
</usage>
|
|
|
|
<available_skills>
|
|
|
|
${skillsXml}
|
|
|
|
</available_skills>
|
|
<!-- SKILLS_TABLE_END -->
|
|
|
|
</skills_system>`;
|
|
}
|
|
|
|
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 projectGithub = join(process.cwd(), '.github', 'skills');
|
|
const globalCopilot = join(homedir(), '.copilot');
|
|
|
|
return existsSync(projectGithub) || existsSync(globalCopilot);
|
|
}
|
|
}
|