From 3af97e461de0ebc47f10026d70ab85bc5419d89d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 5 Nov 2025 23:48:06 -0600 Subject: [PATCH] Fix skills with hypens --- docs/PLUGINS.md | 8 ++++---- src/lib/plugins.test.ts | 8 +++++--- src/lib/plugins.ts | 6 +++--- src/lib/tools/SkillTool.ts | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/PLUGINS.md b/docs/PLUGINS.md index 51a71738..ad394e29 100644 --- a/docs/PLUGINS.md +++ b/docs/PLUGINS.md @@ -71,15 +71,15 @@ This can include: #### Required Frontmatter Fields -- **`name`**: Skill identifier (must be alphanumeric lowercase only, e.g., `myskill`, `skill123`) +- **`name`**: Skill identifier (must be lowercase alphanumeric with hyphens, e.g., `myskill`, `skill-123`, `condition-based-waiting`) - **`description`**: Human-readable description of what the skill does #### Skill Name Validation Skill names must: -- Contain only lowercase letters (a-z) and numbers (0-9) -- No spaces, hyphens, underscores, or special characters -- Examples: ✅ `myskill`, `skill123`, `abc` | ❌ `My-Skill`, `skill_name`, `SKILL` +- Contain only lowercase letters (a-z), numbers (0-9), and hyphens (-) +- No spaces, underscores, uppercase letters, or other special characters +- Examples: ✅ `myskill`, `skill-123`, `condition-based-waiting` | ❌ `My-Skill`, `skill_name`, `SKILL` ## How It Works diff --git a/src/lib/plugins.test.ts b/src/lib/plugins.test.ts index 5bfa4133..6350820a 100644 --- a/src/lib/plugins.test.ts +++ b/src/lib/plugins.test.ts @@ -19,18 +19,20 @@ describe('plugins', () => { }); describe('isValidSkillName', () => { - it('should validate alphanumeric lowercase names', () => { + it('should validate alphanumeric lowercase names with hyphens', () => { expect(isValidSkillName('test')).toBe(true); expect(isValidSkillName('test123')).toBe(true); expect(isValidSkillName('abc')).toBe(true); + expect(isValidSkillName('test-name')).toBe(true); + expect(isValidSkillName('test-123')).toBe(true); + expect(isValidSkillName('condition-based-waiting')).toBe(true); }); it('should reject invalid names', () => { expect(isValidSkillName('Test')).toBe(false); - expect(isValidSkillName('test-name')).toBe(false); expect(isValidSkillName('test_name')).toBe(false); expect(isValidSkillName('test name')).toBe(false); - expect(isValidSkillName('test-123')).toBe(false); + expect(isValidSkillName('Test-Name')).toBe(false); }); }); diff --git a/src/lib/plugins.ts b/src/lib/plugins.ts index e087e22e..4c832ad9 100644 --- a/src/lib/plugins.ts +++ b/src/lib/plugins.ts @@ -20,10 +20,10 @@ export interface SkillFrontmatter { } /** - * Validates a skill name (alphanumeric lowercase only) + * Validates a skill name (alphanumeric lowercase with hyphens) */ export function isValidSkillName(name: string): boolean { - return /^[a-z0-9]+$/.test(name); + return /^[a-z0-9-]+$/.test(name); } /** @@ -84,7 +84,7 @@ export async function getPluginSkills( // Validate skill name format if (!isValidSkillName(frontmatter.name)) { - console.warn(`Skill at ${skillPath} has invalid name "${frontmatter.name}" (must be alphanumeric lowercase only)`); + console.warn(`Skill at ${skillPath} has invalid name "${frontmatter.name}" (must be lowercase alphanumeric with hyphens)`); continue; } diff --git a/src/lib/tools/SkillTool.ts b/src/lib/tools/SkillTool.ts index 7806f019..c07e868c 100644 --- a/src/lib/tools/SkillTool.ts +++ b/src/lib/tools/SkillTool.ts @@ -14,7 +14,7 @@ export class SkillTool implements Tool { readonly description = 'Load and execute a skill from the configured plugins. Skills are reusable AI workflows that can be invoked by name.'; readonly inputSchema = z.object({ - name: z.string().describe('The name of the skill to execute (alphanumeric lowercase only)'), + name: z.string().describe('The name of the skill to execute (lowercase alphanumeric with hyphens)'), }); constructor(fs: JSRuntimeFS, pluginsPath: string) {