b8e82008e3
- Added `toExtensionId()` method to all capability types for granular extension identification and disabling. - Added `disabledExtensions` and `includeDisabled` options to LoadOptions for filtering disabled capabilities by extension ID. - Added plugin manifest support for `extensions` entry points with automatic discovery from installed plugins. - Fixed skill loading to properly respect disabled skill names from custom directories. - Improved cross-platform path handling by using `path.basename()` instead of string splitting in context file and state manager. - Refactored capability index loading to validate source metadata and filter disabled extensions before processing.
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
/**
|
|
* Skills Capability
|
|
*
|
|
* Skills provide specialized knowledge or workflows that extend agent capabilities.
|
|
*/
|
|
import { defineCapability } from ".";
|
|
import type { SourceMeta } from "./types";
|
|
|
|
/**
|
|
* Parsed frontmatter from a skill file.
|
|
*/
|
|
export interface SkillFrontmatter {
|
|
name?: string;
|
|
description?: string;
|
|
globs?: string[];
|
|
alwaysApply?: boolean;
|
|
[key: string]: unknown;
|
|
}
|
|
|
|
/**
|
|
* A skill that provides specialized knowledge or workflows.
|
|
*/
|
|
export interface Skill {
|
|
/** Skill name (unique key, derived from filename or frontmatter) */
|
|
name: string;
|
|
/** Absolute path to skill file */
|
|
path: string;
|
|
/** Skill content (markdown) */
|
|
content: string;
|
|
/** Parsed frontmatter */
|
|
frontmatter?: SkillFrontmatter;
|
|
/** Source level */
|
|
level: "user" | "project";
|
|
/** Source metadata */
|
|
_source: SourceMeta;
|
|
}
|
|
|
|
export const skillCapability = defineCapability<Skill>({
|
|
id: "skills",
|
|
displayName: "Skills",
|
|
description: "Specialized knowledge and workflow files that extend agent capabilities",
|
|
key: skill => skill.name,
|
|
toExtensionId: skill => `skill:${skill.name}`,
|
|
validate: skill => {
|
|
if (!skill.name) return "Missing skill name";
|
|
if (!skill.path) return "Missing skill path";
|
|
return undefined;
|
|
},
|
|
});
|