diff --git a/README.md b/README.md index 03e2d77..10a8b0f 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ npx openskills install anthropics/skills --universal ```bash npx openskills install [options] # Install from GitHub, local path, or private repo -npx openskills sync [-y] [-o ] # Update AGENTS.md (or custom output) +npx openskills sync [-y] [-o ] [--cli-tool ] # Update AGENTS.md (or custom output) with your agent's CLI tool name npx openskills list # Show installed skills npx openskills read # Load skill (for agents) npx openskills update [name...] # Update installed skills (default: all) @@ -186,6 +186,7 @@ npx openskills remove # Remove specific skill - `--universal` — Install to `.agent/skills/` instead of `.claude/skills/` - `-y, --yes` — Skip prompts (useful for CI) - `-o, --output ` — Output file for sync (default: `AGENTS.md`) +- `--cli-tool ` — Redefining the CLI tool name used by the agent to invoke openskills (default: `Bash`) --- diff --git a/src/cli.ts b/src/cli.ts index 41d0c95..65b936c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -64,6 +64,7 @@ program .description('Update AGENTS.md with installed skills (interactive, pre-selects current state)') .option('-y, --yes', 'Skip interactive selection, sync all skills') .option('-o, --output ', 'Output file path (default: AGENTS.md)') + .option('-t, --cli-tool ', 'Custom tool name to use instead of "Bash" (e.g., "bash", "Bash", "Shell")') .action(syncAgentsMd); program diff --git a/src/commands/sync.ts b/src/commands/sync.ts index d8746eb..21bca63 100644 --- a/src/commands/sync.ts +++ b/src/commands/sync.ts @@ -10,6 +10,7 @@ import type { Skill } from '../types.js'; export interface SyncOptions { yes?: boolean; output?: string; + cliTool?: string; } /** @@ -92,7 +93,7 @@ export async function syncAgentsMd(options: SyncOptions = {}): Promise { } } - const xml = generateSkillsXml(skills); + const xml = generateSkillsXml(skills, { tool: options.cliTool }); const content = readFileSync(outputPath, 'utf-8'); const updated = replaceSkillsSection(content, xml); diff --git a/src/utils/agents-md.ts b/src/utils/agents-md.ts index 136bc86..2f70628 100644 --- a/src/utils/agents-md.ts +++ b/src/utils/agents-md.ts @@ -19,8 +19,12 @@ export function parseCurrentSkills(content: string): string[] { /** * Generate skills XML section for AGENTS.md + * @param skills - Array of skills to include + * @param options - Generation options + * @param options.tool - Custom tool name to use instead of "Bash" (default: "Bash") */ -export function generateSkillsXml(skills: Skill[]): string { +export function generateSkillsXml(skills: Skill[], options: { tool?: string } = {}): string { + const toolName = options.tool || 'Bash'; const skillTags = skills .map( (s) => ` @@ -40,8 +44,7 @@ export function generateSkillsXml(skills: Skill[]): string { 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: \`npx openskills read \` (run in your shell) - - For multiple: \`npx openskills read skill-one,skill-two\` +- Invoke: ${toolName}("openskills read ") - 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/) diff --git a/tests/commands/sync.test.ts b/tests/commands/sync.test.ts index a6ebc70..d6e8848 100644 --- a/tests/commands/sync.test.ts +++ b/tests/commands/sync.test.ts @@ -35,7 +35,7 @@ describe('sync utilities (agents-md.ts)', () => { expect(xml).toContain(''); }); - it('should include usage instructions', () => { + it('should include usage instructions with default tool name', () => { const skills: Skill[] = [ { name: 'test', description: 'Test skill', location: 'project', path: '/path' }, ]; @@ -43,7 +43,19 @@ describe('sync utilities (agents-md.ts)', () => { const xml = generateSkillsXml(skills); expect(xml).toContain(''); - expect(xml).toContain('npx openskills read'); + expect(xml).toContain('Bash("openskills read ")'); + expect(xml).toContain(''); + }); + + it('should include usage instructions with custom tool name', () => { + const skills: Skill[] = [ + { name: 'test', description: 'Test skill', location: 'project', path: '/path' }, + ]; + + const xml = generateSkillsXml(skills, { tool: 'Shell' }); + + expect(xml).toContain(''); + expect(xml).toContain('Shell("openskills read ")'); expect(xml).toContain(''); });