mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-18 18:04:26 +00:00
Merge pull request #114 from RUFFY-369/feat/hermes-agent-native-support
feat: add Hermes agent adapter (Native Hermes Support)
This commit is contained in:
@@ -419,9 +419,9 @@ skillkit cicd init # CI/CD templates
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Plus 34 more</b></summary>
|
||||
<summary><b>Plus 35 more</b></summary>
|
||||
|
||||
Amp, Antigravity, Augment Code, Bolt, Clawdbot, Cline, CodeBuddy, CodeGPT, CommandCode, Continue, Crush, Droid, Factory, Goose, Kilo Code, Kiro CLI, Lovable, MCPJam, Mux, Neovate, OpenClaw, OpenHands, Pi, PlayCode, Qoder, Qwen, Replit Agent, Roo Code, Tabby, Tabnine, Trae, Vercel, Zencoder, Universal.
|
||||
Amp, Antigravity, Augment Code, Bolt, Clawdbot, Cline, CodeBuddy, CodeGPT, CommandCode, Continue, Crush, Droid, Factory, Goose, Hermes Agent, Kilo Code, Kiro CLI, Lovable, MCPJam, Mux, Neovate, OpenClaw, OpenHands, Pi, PlayCode, Qoder, Qwen, Replit Agent, Roo Code, Tabby, Tabnine, Trae, Vercel, Zencoder, Universal.
|
||||
</details>
|
||||
|
||||
[Full agent details](https://skillkit.sh/docs/agents)
|
||||
|
||||
@@ -35,10 +35,10 @@ const ALL_AGENTS = AgentType.options;
|
||||
|
||||
describe('Agent Adapters', () => {
|
||||
describe('getAllAdapters', () => {
|
||||
it('should return all 45 registered adapters', () => {
|
||||
it('should return all 46 registered adapters', () => {
|
||||
const adapters = getAllAdapters();
|
||||
expect(adapters).toBeInstanceOf(Array);
|
||||
expect(adapters.length).toBe(45);
|
||||
expect(adapters.length).toBe(46);
|
||||
});
|
||||
|
||||
it('should include common agents', () => {
|
||||
@@ -140,4 +140,43 @@ describe('Agent Adapters', () => {
|
||||
expect(typeof agent).toBe('string');
|
||||
});
|
||||
});
|
||||
|
||||
describe('HermesAdapter', () => {
|
||||
it('should generate valid XML config', () => {
|
||||
const adapter = getAdapter('hermes');
|
||||
const mockSkills = [
|
||||
{ name: 'test-skill', description: 'Testing', enabled: true, path: '', location: 'project' }
|
||||
];
|
||||
const config = adapter.generateConfig(mockSkills as any);
|
||||
|
||||
expect(config).toContain('<skills_system');
|
||||
expect(config).toContain('<name>test-skill</name>');
|
||||
expect(config).toContain('SKILLS_TABLE_START');
|
||||
});
|
||||
|
||||
it('should parse skill names from XML correctly within markers', () => {
|
||||
const adapter = getAdapter('hermes');
|
||||
const xml = `
|
||||
<!-- SKILLS_TABLE_START -->
|
||||
<available_skills><skill><name>git-ops</name></skill></available_skills>
|
||||
<!-- SKILLS_TABLE_END -->`;
|
||||
const names = adapter.parseConfig(xml);
|
||||
expect(names).toContain('git-ops');
|
||||
});
|
||||
|
||||
it('should ignore <name> tags outside of sync markers', () => {
|
||||
const adapter = getAdapter('hermes');
|
||||
const xml = `
|
||||
<mission><name>save-the-world</name></mission>
|
||||
<!-- SKILLS_TABLE_START -->
|
||||
<available_skills><skill><name>git-ops</name></skill></available_skills>
|
||||
<!-- SKILLS_TABLE_END -->
|
||||
<footer_meta><name>internal-id</name></footer_meta>`;
|
||||
const names = adapter.parseConfig(xml);
|
||||
expect(names).toHaveLength(1);
|
||||
expect(names).toContain('git-ops');
|
||||
expect(names).not.toContain('save-the-world');
|
||||
expect(names).not.toContain('internal-id');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,6 +33,7 @@ const AGENT_DISPLAY_NAMES: Partial<Record<AgentType, string>> = {
|
||||
'tabnine': 'Tabnine',
|
||||
'codegpt': 'CodeGPT',
|
||||
'playcode-agent': 'PlayCode Agent',
|
||||
'hermes': 'Hermes',
|
||||
};
|
||||
|
||||
export class GenericAgentAdapter implements AgentAdapter {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
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.hermes;
|
||||
|
||||
/**
|
||||
* Hermes Agent Adapter
|
||||
*
|
||||
* Hermes Agent is an advanced AI agent with support for XML-based skills.
|
||||
* It uses AGENTS.md for instructions and ~/.hermes/skills/ for global skills.
|
||||
*/
|
||||
export class HermesAdapter implements AgentAdapter {
|
||||
readonly type: AgentType = 'hermes';
|
||||
readonly name = 'Hermes Agent';
|
||||
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 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 startMarker = '<!-- SKILLS_TABLE_START -->';
|
||||
const endMarker = '<!-- SKILLS_TABLE_END -->';
|
||||
const startIndex = content.indexOf(startMarker);
|
||||
const endIndex = content.indexOf(endMarker);
|
||||
|
||||
if (startIndex === -1 || endIndex === -1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const scopedContent = content.substring(startIndex + startMarker.length, endIndex);
|
||||
const skillNames: string[] = [];
|
||||
const skillRegex = /<name>([^<]+)<\/name>/g;
|
||||
let match;
|
||||
|
||||
while ((match = skillRegex.exec(scopedContent)) !== null) {
|
||||
skillNames.push(match[1].trim());
|
||||
}
|
||||
|
||||
return skillNames;
|
||||
}
|
||||
|
||||
getInvokeCommand(skillName: string): string {
|
||||
return `skillkit read ${skillName}`;
|
||||
}
|
||||
|
||||
async isDetected(): Promise<boolean> {
|
||||
const projectHermes = join(process.cwd(), '.hermes');
|
||||
const globalHermes = join(homedir(), '.hermes');
|
||||
|
||||
return existsSync(projectHermes) || existsSync(globalHermes);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import { RooAdapter } from './roo.js';
|
||||
import { TraeAdapter } from './trae.js';
|
||||
import { WindsurfAdapter } from './windsurf.js';
|
||||
import { UniversalAdapter } from './universal.js';
|
||||
import { HermesAdapter } from './hermes.js';
|
||||
import { GenericAgentAdapter } from './generic.js';
|
||||
|
||||
export * from './base.js';
|
||||
@@ -41,6 +42,7 @@ export * from './roo.js';
|
||||
export * from './trae.js';
|
||||
export * from './windsurf.js';
|
||||
export * from './universal.js';
|
||||
export * from './hermes.js';
|
||||
export * from './generic.js';
|
||||
|
||||
// Agent features
|
||||
@@ -92,6 +94,7 @@ const adapters: Record<AgentType, AgentAdapter> = {
|
||||
tabnine: new GenericAgentAdapter('tabnine'),
|
||||
codegpt: new GenericAgentAdapter('codegpt'),
|
||||
'playcode-agent': new GenericAgentAdapter('playcode-agent'),
|
||||
hermes: new HermesAdapter(),
|
||||
};
|
||||
|
||||
export function getAdapter(type: AgentType): AgentAdapter {
|
||||
@@ -160,6 +163,7 @@ export async function detectAgent(): Promise<AgentType> {
|
||||
'tabnine',
|
||||
'codegpt',
|
||||
'playcode-agent',
|
||||
'hermes',
|
||||
'universal',
|
||||
];
|
||||
|
||||
|
||||
@@ -214,6 +214,10 @@ function updateConfigContent(existing: string, newConfig: string, agentType: Age
|
||||
start: '<!-- SKILLKIT_SKILLS_START -->',
|
||||
end: '<!-- SKILLKIT_SKILLS_END -->',
|
||||
},
|
||||
hermes: {
|
||||
start: '<!-- SKILLS_TABLE_START -->',
|
||||
end: '<!-- SKILLS_TABLE_END -->',
|
||||
},
|
||||
};
|
||||
|
||||
const agentMarkers = markers[agentType] || markers.universal;
|
||||
|
||||
@@ -477,6 +477,16 @@ export const AGENT_CONFIG: Record<AgentType, AgentDirectoryConfig> = {
|
||||
usesFrontmatter: true,
|
||||
supportsAutoDiscovery: true,
|
||||
},
|
||||
|
||||
// Hermes Agent
|
||||
hermes: {
|
||||
skillsDir: '.hermes/skills',
|
||||
configFile: 'AGENTS.md',
|
||||
globalSkillsDir: '~/.hermes/skills',
|
||||
configFormat: 'xml',
|
||||
usesFrontmatter: true,
|
||||
supportsAutoDiscovery: true,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -264,6 +264,7 @@ export const AGENT_DISCOVERY_PATHS: Record<AgentType, string[]> = {
|
||||
'tabnine': ['.tabnine/agents'],
|
||||
'codegpt': ['.codegpt/agents'],
|
||||
'playcode-agent': ['.playcode/agents'],
|
||||
'hermes': ['.hermes/agents'],
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -324,6 +325,7 @@ export const ALL_AGENT_DISCOVERY_PATHS = [
|
||||
'.tabnine/agents',
|
||||
'.codegpt/agents',
|
||||
'.playcode/agents',
|
||||
'.hermes/agents',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -375,4 +377,5 @@ export const CUSTOM_AGENT_FORMAT_MAP: Record<AgentType, AgentFormatCategory> = {
|
||||
'tabnine': 'universal',
|
||||
'codegpt': 'universal',
|
||||
'playcode-agent': 'universal',
|
||||
'hermes': 'claude-agent',
|
||||
};
|
||||
|
||||
@@ -332,6 +332,13 @@ const AGENT_FORMATS: Record<AgentType, AgentCommandFormat> = {
|
||||
supportsSlashCommands: false,
|
||||
supportsCommandFiles: true,
|
||||
},
|
||||
hermes: {
|
||||
agent: 'hermes',
|
||||
extension: '.md',
|
||||
directory: '.hermes/commands',
|
||||
supportsSlashCommands: true,
|
||||
supportsCommandFiles: true,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -593,6 +600,7 @@ export class CommandGenerator {
|
||||
case 'amp':
|
||||
case 'roo':
|
||||
case 'kiro-cli':
|
||||
case 'hermes':
|
||||
return this.generateClaudeCommands(commands);
|
||||
|
||||
case 'cursor':
|
||||
|
||||
@@ -286,6 +286,7 @@ export class ContextSync {
|
||||
const commonDirs = [
|
||||
'.claude/skills',
|
||||
'.cursor/skills',
|
||||
'.hermes/skills',
|
||||
'.agent/skills',
|
||||
'skills',
|
||||
];
|
||||
|
||||
@@ -203,4 +203,10 @@ export const AGENT_INSTRUCTION_TEMPLATES: Record<string, AgentInstructionTemplat
|
||||
format: 'markdown',
|
||||
sectionOrder: ['overview', 'stack', 'commands', 'conventions', 'guidelines'],
|
||||
},
|
||||
'hermes': {
|
||||
agent: 'hermes',
|
||||
filename: 'AGENTS.md',
|
||||
format: 'xml',
|
||||
sectionOrder: ['overview', 'stack', 'commands', 'conventions', 'structure', 'guidelines'],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -405,7 +405,7 @@ export function translateSkillToAll(
|
||||
'mcpjam', 'mux', 'neovate', 'openhands', 'pi', 'qoder', 'qwen',
|
||||
'vercel', 'zencoder', 'devin', 'aider', 'sourcegraph-cody', 'amazon-q',
|
||||
'augment-code', 'replit-agent', 'bolt', 'lovable', 'tabby', 'tabnine',
|
||||
'codegpt', 'playcode-agent',
|
||||
'codegpt', 'playcode-agent', 'hermes',
|
||||
];
|
||||
|
||||
for (const agent of agents) {
|
||||
|
||||
@@ -34,6 +34,7 @@ export const SKILL_DISCOVERY_PATHS = [
|
||||
'.gemini/skills',
|
||||
'.github/skills',
|
||||
'.goose/skills',
|
||||
'.hermes/skills',
|
||||
'.kilocode/skills',
|
||||
'.kiro/skills',
|
||||
'.lovable/skills',
|
||||
|
||||
@@ -59,6 +59,7 @@ export const AGENT_FORMAT_MAP: Record<AgentType, FormatCategory> = {
|
||||
'tabnine': 'skill-md',
|
||||
'codegpt': 'skill-md',
|
||||
'playcode-agent': 'external',
|
||||
'hermes': 'skill-md',
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,6 +46,7 @@ export const AgentType = z.enum([
|
||||
"tabnine",
|
||||
"codegpt",
|
||||
"playcode-agent",
|
||||
"hermes",
|
||||
]);
|
||||
export type AgentType = z.infer<typeof AgentType>;
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ const AGENT_DIR_MAP: Record<string, string[]> = {
|
||||
'claude-code': ['.claude/skills'], 'cursor': ['.cursor/skills'], 'codex': ['.codex/skills'],
|
||||
'gemini-cli': ['.gemini/skills'], 'opencode': ['.opencode/skills', '.config/opencode/skills'],
|
||||
'antigravity': ['.antigravity/skills'], 'amp': ['.amp/skills'], 'clawdbot': ['.clawdbot/skills'],
|
||||
'hermes': ['.hermes/skills'],
|
||||
'openclaw': ['.openclaw/skills', '.openclaw/workspace/skills', 'skills'], 'github-copilot': ['.github/skills'], 'goose': ['.goose/skills'],
|
||||
'kilo': ['.kilocode/skills'], 'kiro-cli': ['.kiro/skills'], 'roo': ['.roo/skills'],
|
||||
'trae': ['.trae/skills'], 'windsurf': ['.windsurf/skills', '.codeium/windsurf/skills'],
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
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 '../core/types.js';
|
||||
|
||||
/**
|
||||
* Hermes Agent Adapter (Legacy)
|
||||
*/
|
||||
export class HermesAdapter implements AgentAdapter {
|
||||
readonly type: AgentType = 'hermes';
|
||||
readonly name = 'Hermes Agent';
|
||||
readonly skillsDir = '.hermes/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 startMarker = '<!-- SKILLS_TABLE_START -->';
|
||||
const endMarker = '<!-- SKILLS_TABLE_END -->';
|
||||
const startIndex = content.indexOf(startMarker);
|
||||
const endIndex = content.indexOf(endMarker);
|
||||
|
||||
if (startIndex === -1 || endIndex === -1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const scopedContent = content.substring(startIndex + startMarker.length, endIndex);
|
||||
const skillNames: string[] = [];
|
||||
const skillRegex = /<name>([^<]+)<\/name>/g;
|
||||
let match;
|
||||
|
||||
while ((match = skillRegex.exec(scopedContent)) !== null) {
|
||||
skillNames.push(match[1].trim());
|
||||
}
|
||||
|
||||
return skillNames;
|
||||
}
|
||||
|
||||
getInvokeCommand(skillName: string): string {
|
||||
return `skillkit read ${skillName}`;
|
||||
}
|
||||
|
||||
async isDetected(): Promise<boolean> {
|
||||
const projectHermes = join(process.cwd(), '.hermes');
|
||||
const globalHermes = join(homedir(), '.hermes');
|
||||
|
||||
return existsSync(projectHermes) || existsSync(globalHermes);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { RooAdapter } from './roo.js';
|
||||
import { TraeAdapter } from './trae.js';
|
||||
import { WindsurfAdapter } from './windsurf.js';
|
||||
import { UniversalAdapter } from './universal.js';
|
||||
import { HermesAdapter } from './hermes.js';
|
||||
|
||||
export * from './base.js';
|
||||
export * from './claude-code.js';
|
||||
@@ -55,6 +56,7 @@ const adapters: Record<AgentType, AgentAdapter> = {
|
||||
trae: new TraeAdapter(),
|
||||
windsurf: new WindsurfAdapter(),
|
||||
universal: new UniversalAdapter(),
|
||||
hermes: new HermesAdapter(),
|
||||
};
|
||||
|
||||
export function getAdapter(type: AgentType): AgentAdapter {
|
||||
@@ -83,6 +85,7 @@ export async function detectAgent(): Promise<AgentType> {
|
||||
'roo',
|
||||
'trae',
|
||||
'windsurf',
|
||||
'hermes',
|
||||
'universal',
|
||||
];
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export class WindsurfAdapter implements AgentAdapter {
|
||||
readonly type: AgentType = 'windsurf';
|
||||
readonly name = 'Windsurf';
|
||||
readonly skillsDir = '.windsurf/skills';
|
||||
readonly configFile = 'AGENTS.md';
|
||||
readonly configFile = '.windsurf/rules/skills.md';
|
||||
readonly globalSkillsDir = join(homedir(), '.codeium', 'windsurf', 'skills');
|
||||
|
||||
generateConfig(skills: Skill[]): string {
|
||||
|
||||
@@ -18,6 +18,7 @@ export const AgentType = z.enum([
|
||||
'trae',
|
||||
'windsurf',
|
||||
'universal',
|
||||
'hermes',
|
||||
]);
|
||||
export type AgentType = z.infer<typeof AgentType>;
|
||||
|
||||
|
||||
+11
-2
@@ -140,13 +140,22 @@ describe('agents', () => {
|
||||
expect(adapter.type).toBe('windsurf');
|
||||
expect(adapter.name).toBe('Windsurf');
|
||||
expect(adapter.skillsDir).toBe('.windsurf/skills');
|
||||
expect(adapter.configFile).toBe('.windsurf/rules/skills.md');
|
||||
});
|
||||
|
||||
it('should return adapter for hermes', () => {
|
||||
const adapter = getAdapter('hermes');
|
||||
expect(adapter.type).toBe('hermes');
|
||||
expect(adapter.name).toBe('Hermes Agent');
|
||||
expect(adapter.skillsDir).toBe('.hermes/skills');
|
||||
expect(adapter.configFile).toBe('AGENTS.md');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getAllAdapters', () => {
|
||||
it('should return all 17 adapters', () => {
|
||||
it('should return all 18 adapters', () => {
|
||||
const adapters = getAllAdapters();
|
||||
expect(adapters.length).toBe(17);
|
||||
expect(adapters.length).toBe(18);
|
||||
expect(adapters.map(a => a.type)).toContain('claude-code');
|
||||
expect(adapters.map(a => a.type)).toContain('cursor');
|
||||
expect(adapters.map(a => a.type)).toContain('universal');
|
||||
|
||||
Reference in New Issue
Block a user