Files
oh-my-pi/packages/coding-agent/src/capability/slash-command.ts
T
can1357 0438f01fd5 feat(coding-agent): added multi-tool config discovery across 8 AI IDEs
- Added unified capability-based discovery system for loading configuration from 8 AI coding tools (Cursor, Windsurf, Cline, GitHub Copilot, Gemini, Codex, Claude, VS Code).
- Added Discovery settings tab in interactive mode for enabling/disabling configuration providers.
- Added provider source attribution showing which tool contributed each configuration item.
- Added support for tool-specific rule formats including Cursor MDC, Windsurf global_rules, and Cline .clinerules.
- Changed MCP tool name parsing to use last underscore separator for improved server name handling.
- Refactored core loaders (skills, hooks, custom tools, slash commands) to use capability API instead of manual directory scanning.
2026-01-03 18:26:07 +01:00

41 lines
1.1 KiB
TypeScript

/**
* Slash Commands Capability
*
* File-based slash commands defined as markdown files.
*/
import { defineCapability } from "./index";
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,
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;
},
});