Adds Hermes Agent as a supported installation target. Users can run
\`npx get-shit-done-cc --hermes\` to install all 86 GSD commands as
skills under \`~/.hermes/skills/gsd-*/SKILL.md\`, following the same
open skill standard as Claude Code 2.1.88+, Qwen Code, Antigravity,
Trae, Augment, and Codebuddy.
Hermes Agent is an open-source AI agent framework by Nous Research
(NousResearch/hermes-agent, MIT). Its skill loader accepts the Claude
skill format as-is: frontmatter parsed with PyYAML SafeLoader (unknown
keys like \`allowed-tools\` / \`argument-hint\` ignored), body XML tags
(\`<objective>\`, \`<execution_context>\`, \`<process>\`) passed directly
to the model. Compatibility proven end-to-end with all 86 GSD skills
loading cleanly, \`skill_view()\` returning full bodies, and
\`build_skills_system_prompt()\` emitting them into the agent system
prompt — zero Hermes code changes required.
Changes:
- \`bin/install.js\`: --hermes flag, getDirName/getGlobalDir/getConfigDirFromHome
support, HERMES_HOME env var (native to Hermes — used for profile
mode / Docker deploys), install/uninstall pipelines, interactive
picker option 10 (alphabetical: between Gemini and Kilo), .hermes
path replacements in copyCommandsAsClaudeSkills and
copyWithPathReplacement, legacy commands/gsd cleanup, CLAUDE.md ->
HERMES.md and "Claude Code" -> "Hermes Agent" content rewrites in
skills/agents/hooks, runtime-appropriate finish message.
- \`get-shit-done/bin/lib/core.cjs\`: add hermes to KNOWN_RUNTIMES;
add RUNTIME_PROFILE_MAP.hermes with OpenRouter-slug defaults
(Hermes is provider-agnostic; these defaults resolve across
OpenRouter, native Anthropic, and Copilot via Hermes' aggregator-
aware resolver, and are overridable per-tier via
model_profile_overrides.hermes.{opus,sonnet,haiku}).
- \`README.md\`: Hermes Agent in tagline, runtime list, verification
command, install/uninstall examples, \`--hermes\` flag reference.
- \`tests/hermes-install.test.cjs\`: new, 14 tests covering directory
mapping, HERMES_HOME env var precedence, install/uninstall
lifecycle, user-skill preservation, engine cleanup.
- \`tests/hermes-skills-migration.test.cjs\`: new, 11 tests covering
frontmatter conversion, path replacement (~/.claude/ ->
\$HERMES_HOME/skills/), CLAUDE.md -> HERMES.md, "Claude Code" ->
"Hermes Agent", stale skill cleanup, SKILL.md format validation.
- \`tests/multi-runtime-select.test.cjs\`: updated for new option
numbering (hermes=10, kilo=11, opencode=12, qwen=13, trae=14,
windsurf=15, all=16).
- \`tests/kilo-install.test.cjs\`: updated assertions for Kilo having
moved from option 10 to option 11.
Closes #2841
Implementation notes:
- Zero custom code paths: Hermes reuses copyCommandsAsClaudeSkills()
identical to Qwen Code / Antigravity pattern.
- Path replacement: ~/.claude/, \$HOME/.claude/, ./.claude/ ->
.hermes equivalents in skill/agent/hook content.
- Config precedence: --config-dir > HERMES_HOME > ~/.hermes (matches
how Hermes itself resolves its home directory).
- Legacy cleanup: removes commands/gsd/ if present from a prior
install, preserving dev-preferences.md (same as Qwen).
- No external dependencies added.
Testing: 5841 / 5841 tests pass (0 failures, 0 regressions)
- 14 new tests in hermes-install.test.cjs
- 11 new tests in hermes-skills-migration.test.cjs
- multi-runtime-select.test.cjs renumbered + 1 new test (single choice for hermes)
288 lines
9.8 KiB
JavaScript
288 lines
9.8 KiB
JavaScript
/**
|
|
* GSD Tools Tests - Hermes Agent Skills Migration
|
|
*
|
|
* Tests for installing GSD for Hermes Agent using the standard
|
|
* skills/gsd-xxx/SKILL.md format (same open standard as Claude Code 2.1.88+).
|
|
*
|
|
* Uses node:test and node:assert (NOT Jest).
|
|
*/
|
|
|
|
process.env.GSD_TEST_MODE = '1';
|
|
|
|
const { test, describe, beforeEach, afterEach } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const path = require('path');
|
|
const os = require('os');
|
|
const fs = require('fs');
|
|
|
|
const {
|
|
convertClaudeCommandToClaudeSkill,
|
|
copyCommandsAsClaudeSkills,
|
|
} = require('../bin/install.js');
|
|
|
|
// ─── convertClaudeCommandToClaudeSkill (used by Hermes via copyCommandsAsClaudeSkills) ──
|
|
|
|
describe('Hermes Agent: convertClaudeCommandToClaudeSkill', () => {
|
|
test('preserves allowed-tools multiline YAML list', () => {
|
|
const input = [
|
|
'---',
|
|
'name: gsd:next',
|
|
'description: Advance to the next step',
|
|
'allowed-tools:',
|
|
' - Read',
|
|
' - Bash',
|
|
' - Grep',
|
|
'---',
|
|
'',
|
|
'Body content here.',
|
|
].join('\n');
|
|
|
|
const result = convertClaudeCommandToClaudeSkill(input, 'gsd-next');
|
|
assert.ok(result.includes('allowed-tools:'), 'allowed-tools field is present');
|
|
assert.ok(result.includes('Read'), 'Read tool preserved');
|
|
assert.ok(result.includes('Bash'), 'Bash tool preserved');
|
|
assert.ok(result.includes('Grep'), 'Grep tool preserved');
|
|
});
|
|
|
|
test('preserves argument-hint', () => {
|
|
const input = [
|
|
'---',
|
|
'name: gsd:debug',
|
|
'description: Debug issues',
|
|
'argument-hint: "[issue description]"',
|
|
'allowed-tools:',
|
|
' - Read',
|
|
' - Bash',
|
|
'---',
|
|
'',
|
|
'Debug body.',
|
|
].join('\n');
|
|
|
|
const result = convertClaudeCommandToClaudeSkill(input, 'gsd-debug');
|
|
assert.ok(result.includes('argument-hint:'), 'argument-hint field is present');
|
|
assert.ok(
|
|
result.includes('[issue description]'),
|
|
'argument-hint value preserved'
|
|
);
|
|
});
|
|
|
|
test('emits hyphen-form name (gsd-<cmd>) from hyphen-form dir (#2808)', () => {
|
|
const input = [
|
|
'---',
|
|
'name: gsd:next',
|
|
'description: Advance workflow',
|
|
'---',
|
|
'',
|
|
'Body.',
|
|
].join('\n');
|
|
|
|
// Directory name is gsd-next (hyphen, Windows-safe), frontmatter name is
|
|
// gsd-next (hyphen, #2808 — canonical invocation form for Claude Code autocomplete).
|
|
const result = convertClaudeCommandToClaudeSkill(input, 'gsd-next');
|
|
assert.ok(result.includes('name: gsd-next'), 'frontmatter name uses hyphen form (#2808)');
|
|
});
|
|
|
|
test('preserves body content unchanged', () => {
|
|
const body = '\n<objective>\nDo the thing.\n</objective>\n\n<process>\nStep 1.\nStep 2.\n</process>\n';
|
|
const input = [
|
|
'---',
|
|
'name: gsd:test',
|
|
'description: Test command',
|
|
'---',
|
|
body,
|
|
].join('');
|
|
|
|
const result = convertClaudeCommandToClaudeSkill(input, 'gsd-test');
|
|
assert.ok(result.includes('<objective>'), 'objective tag preserved');
|
|
assert.ok(result.includes('Do the thing.'), 'body text preserved');
|
|
assert.ok(result.includes('<process>'), 'process tag preserved');
|
|
});
|
|
|
|
test('produces valid SKILL.md frontmatter starting with ---', () => {
|
|
const input = [
|
|
'---',
|
|
'name: gsd:plan',
|
|
'description: Plan a phase',
|
|
'---',
|
|
'',
|
|
'Plan body.',
|
|
].join('\n');
|
|
|
|
const result = convertClaudeCommandToClaudeSkill(input, 'gsd-plan');
|
|
assert.ok(result.startsWith('---\n'), 'frontmatter starts with ---');
|
|
assert.ok(result.includes('\n---\n'), 'frontmatter closes with ---');
|
|
});
|
|
});
|
|
|
|
// ─── copyCommandsAsClaudeSkills (used for Hermes skills install) ─────────────
|
|
|
|
describe('Hermes Agent: copyCommandsAsClaudeSkills', () => {
|
|
let tmpDir;
|
|
|
|
beforeEach(() => {
|
|
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-hermes-test-'));
|
|
});
|
|
|
|
afterEach(() => {
|
|
if (fs.existsSync(tmpDir)) {
|
|
fs.rmSync(tmpDir, { recursive: true });
|
|
}
|
|
});
|
|
|
|
test('creates skills/gsd-xxx/SKILL.md directory structure', () => {
|
|
// Create source command files
|
|
const srcDir = path.join(tmpDir, 'src', 'commands', 'gsd');
|
|
fs.mkdirSync(srcDir, { recursive: true });
|
|
fs.writeFileSync(path.join(srcDir, 'quick.md'), [
|
|
'---',
|
|
'name: gsd:quick',
|
|
'description: Execute a quick task',
|
|
'allowed-tools:',
|
|
' - Read',
|
|
' - Bash',
|
|
'---',
|
|
'',
|
|
'<objective>Quick task body</objective>',
|
|
].join('\n'));
|
|
|
|
const skillsDir = path.join(tmpDir, 'dest', 'skills');
|
|
copyCommandsAsClaudeSkills(srcDir, skillsDir, 'gsd', '/test/prefix/', 'hermes', false);
|
|
|
|
// Verify SKILL.md was created
|
|
const skillPath = path.join(skillsDir, 'gsd-quick', 'SKILL.md');
|
|
assert.ok(fs.existsSync(skillPath), 'gsd-quick/SKILL.md exists');
|
|
|
|
// Verify content
|
|
const content = fs.readFileSync(skillPath, 'utf8');
|
|
assert.ok(content.includes('name: gsd-quick'), 'frontmatter name uses hyphen form (#2808)');
|
|
assert.ok(content.includes('description:'), 'description present');
|
|
assert.ok(content.includes('allowed-tools:'), 'allowed-tools preserved');
|
|
assert.ok(content.includes('<objective>'), 'body content preserved');
|
|
});
|
|
|
|
test('replaces ~/.claude/ paths with pathPrefix', () => {
|
|
const srcDir = path.join(tmpDir, 'src', 'commands', 'gsd');
|
|
fs.mkdirSync(srcDir, { recursive: true });
|
|
fs.writeFileSync(path.join(srcDir, 'next.md'), [
|
|
'---',
|
|
'name: gsd:next',
|
|
'description: Next step',
|
|
'---',
|
|
'',
|
|
'Reference: @~/.claude/get-shit-done/workflows/next.md',
|
|
].join('\n'));
|
|
|
|
const skillsDir = path.join(tmpDir, 'dest', 'skills');
|
|
copyCommandsAsClaudeSkills(srcDir, skillsDir, 'gsd', '$HOME/.hermes/', 'hermes', false);
|
|
|
|
const content = fs.readFileSync(path.join(skillsDir, 'gsd-next', 'SKILL.md'), 'utf8');
|
|
assert.ok(content.includes('$HOME/.hermes/'), 'path replaced to .hermes/');
|
|
assert.ok(!content.includes('~/.claude/'), 'old claude path removed');
|
|
});
|
|
|
|
test('replaces $HOME/.claude/ paths with pathPrefix', () => {
|
|
const srcDir = path.join(tmpDir, 'src', 'commands', 'gsd');
|
|
fs.mkdirSync(srcDir, { recursive: true });
|
|
fs.writeFileSync(path.join(srcDir, 'plan.md'), [
|
|
'---',
|
|
'name: gsd:plan',
|
|
'description: Plan phase',
|
|
'---',
|
|
'',
|
|
'Reference: $HOME/.claude/get-shit-done/workflows/plan.md',
|
|
].join('\n'));
|
|
|
|
const skillsDir = path.join(tmpDir, 'dest', 'skills');
|
|
copyCommandsAsClaudeSkills(srcDir, skillsDir, 'gsd', '$HOME/.hermes/', 'hermes', false);
|
|
|
|
const content = fs.readFileSync(path.join(skillsDir, 'gsd-plan', 'SKILL.md'), 'utf8');
|
|
assert.ok(content.includes('$HOME/.hermes/'), 'path replaced to .hermes/');
|
|
assert.ok(!content.includes('$HOME/.claude/'), 'old claude path removed');
|
|
});
|
|
|
|
test('removes stale gsd- skills before installing new ones', () => {
|
|
const srcDir = path.join(tmpDir, 'src', 'commands', 'gsd');
|
|
fs.mkdirSync(srcDir, { recursive: true });
|
|
fs.writeFileSync(path.join(srcDir, 'quick.md'), [
|
|
'---',
|
|
'name: gsd:quick',
|
|
'description: Quick task',
|
|
'---',
|
|
'',
|
|
'Body',
|
|
].join('\n'));
|
|
|
|
const skillsDir = path.join(tmpDir, 'dest', 'skills');
|
|
// Pre-create a stale skill
|
|
fs.mkdirSync(path.join(skillsDir, 'gsd-old-skill'), { recursive: true });
|
|
fs.writeFileSync(path.join(skillsDir, 'gsd-old-skill', 'SKILL.md'), 'old');
|
|
|
|
copyCommandsAsClaudeSkills(srcDir, skillsDir, 'gsd', '/test/', 'hermes', false);
|
|
|
|
assert.ok(!fs.existsSync(path.join(skillsDir, 'gsd-old-skill')), 'stale skill removed');
|
|
assert.ok(fs.existsSync(path.join(skillsDir, 'gsd-quick', 'SKILL.md')), 'new skill installed');
|
|
});
|
|
|
|
test('preserves agent field in frontmatter', () => {
|
|
const srcDir = path.join(tmpDir, 'src', 'commands', 'gsd');
|
|
fs.mkdirSync(srcDir, { recursive: true });
|
|
fs.writeFileSync(path.join(srcDir, 'execute.md'), [
|
|
'---',
|
|
'name: gsd:execute',
|
|
'description: Execute phase',
|
|
'agent: gsd-executor',
|
|
'allowed-tools:',
|
|
' - Read',
|
|
' - Bash',
|
|
' - Task',
|
|
'---',
|
|
'',
|
|
'Execute body',
|
|
].join('\n'));
|
|
|
|
const skillsDir = path.join(tmpDir, 'dest', 'skills');
|
|
copyCommandsAsClaudeSkills(srcDir, skillsDir, 'gsd', '/test/', 'hermes', false);
|
|
|
|
const content = fs.readFileSync(path.join(skillsDir, 'gsd-execute', 'SKILL.md'), 'utf8');
|
|
assert.ok(content.includes('agent: gsd-executor'), 'agent field preserved');
|
|
});
|
|
});
|
|
|
|
// ─── Integration: SKILL.md format validation ────────────────────────────────
|
|
|
|
describe('Hermes Agent: SKILL.md format validation', () => {
|
|
test('SKILL.md frontmatter is valid YAML structure', () => {
|
|
const input = [
|
|
'---',
|
|
'name: gsd:review',
|
|
'description: Code review with quality checks',
|
|
'argument-hint: "[PR number or branch]"',
|
|
'agent: gsd-code-reviewer',
|
|
'allowed-tools:',
|
|
' - Read',
|
|
' - Grep',
|
|
' - Bash',
|
|
'---',
|
|
'',
|
|
'<objective>Review code</objective>',
|
|
].join('\n');
|
|
|
|
const result = convertClaudeCommandToClaudeSkill(input, 'gsd-review');
|
|
|
|
// Parse the frontmatter
|
|
const fmMatch = result.match(/^---\n([\s\S]*?)\n---/);
|
|
assert.ok(fmMatch, 'has frontmatter block');
|
|
|
|
const fmLines = fmMatch[1].split('\n');
|
|
const hasName = fmLines.some(l => l.startsWith('name: gsd-review'));
|
|
const hasDesc = fmLines.some(l => l.startsWith('description:'));
|
|
const hasAgent = fmLines.some(l => l.startsWith('agent:'));
|
|
const hasTools = fmLines.some(l => l.startsWith('allowed-tools:'));
|
|
|
|
assert.ok(hasName, 'name field correct');
|
|
assert.ok(hasDesc, 'description field present');
|
|
assert.ok(hasAgent, 'agent field present');
|
|
assert.ok(hasTools, 'allowed-tools field present');
|
|
});
|
|
});
|