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.
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
/**
|
|
* Slash Commands Capability
|
|
*
|
|
* File-based slash commands defined as markdown files.
|
|
*/
|
|
import { defineCapability } from ".";
|
|
import type { SourceMeta } from "./types";
|
|
|
|
/**
|
|
* A file-based slash command.
|
|
*/
|
|
export interface SlashCommand {
|
|
/** Command name (without leading slash) */
|
|
name: string;
|
|
/** Absolute path to command file */
|
|
path: string;
|
|
/** Command content (markdown template) */
|
|
content: string;
|
|
/** Source level */
|
|
level: "user" | "project" | "native";
|
|
/** Source metadata */
|
|
_source: SourceMeta;
|
|
}
|
|
|
|
export const slashCommandCapability = defineCapability<SlashCommand>({
|
|
id: "slash-commands",
|
|
displayName: "Slash Commands",
|
|
description: "Custom slash commands defined as markdown files",
|
|
key: cmd => cmd.name,
|
|
toExtensionId: cmd => `slash-command:${cmd.name}`,
|
|
validate: cmd => {
|
|
if (!cmd.name) return "Missing name";
|
|
if (!cmd.path) return "Missing path";
|
|
if (cmd.content === undefined) return "Missing content";
|
|
if (cmd.level !== "user" && cmd.level !== "project" && cmd.level !== "native") {
|
|
return "Invalid level: must be 'user', 'project', or 'native'";
|
|
}
|
|
return undefined;
|
|
},
|
|
});
|