mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Fix skills with hypens
This commit is contained in:
4 files changed
+13
-11
No files matched your search
+4
-4
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export class SkillTool implements Tool<SkillParams> {
|
||||
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) {
|
||||
|
||||
Reference in new issue
Block a user