/** * Skills System - predefined workflows and commands */ import { ProjectContext } from './project'; export interface SkillStep { type: 'prompt' | 'command' | 'confirm' | 'notify' | 'agent'; content: string; optional?: boolean; /** * A parameter that stands in for this step. When the user gives it, the * step does not run and the parameter's value becomes the step's output — * `${_prev}` for the steps after it. */ skipIf?: string; } export interface SkillParameter { name: string; description: string; required?: boolean; default?: string; } export interface Skill { name: string; description: string; shortcut?: string; category: SkillCategory; steps: SkillStep[]; parameters?: SkillParameter[]; requiresWriteAccess?: boolean; requiresGit?: boolean; } export type SkillCategory = 'git' | 'testing' | 'documentation' | 'refactoring' | 'debugging' | 'deployment' | 'generation' | 'devops' | 'custom'; export interface SkillExecutionResult { success: boolean; output: string; steps: { step: SkillStep; result: string; success: boolean; }[]; } export interface SkillChain { skills: string[]; stopOnError: boolean; } /** * Get all built-in skills */ export declare function getBuiltInSkills(): Skill[]; /** A custom skill file that could not be used, and why. */ export interface SkippedSkillFile { file: string; problem: string; } /** * Load custom skills from disk */ export declare function loadCustomSkills(): Skill[]; /** Custom skill files the latest load could not use. */ export declare function getSkippedCustomSkills(): SkippedSkillFile[]; /** One line per skipped file, naming where it is and what is wrong with it. */ export declare function formatSkippedCustomSkills(skipped: SkippedSkillFile[]): string; /** * Whether ~/.codeep/skills/.json exists, whether or not it loads. A * file that fails to load is invisible to findSkill, and creating a skill of * that name would write over what the user wrote by hand. */ export declare function customSkillFileExists(name: string): boolean; /** * Get all skills (built-in + custom) */ export declare function getAllSkills(): Skill[]; /** * Find skill by name or shortcut */ export declare function findSkill(nameOrShortcut: string): Skill | null; /** * Parse skill chain (e.g., "commit+push" → ["commit", "push"]) */ export declare function parseSkillChain(input: string): SkillChain | null; /** * Parse skill parameters from args string * Supports: "value" for first param, key=value, key="value with spaces" */ export declare function parseSkillArgs(args: string, skill: Skill): Record; /** * Interpolate parameters into skill step content */ export declare function interpolateParams(content: string, params: Record): string; /** * Save a custom skill */ export declare function saveCustomSkill(skill: Skill): void; /** * Delete a custom skill */ export declare function deleteCustomSkill(name: string): boolean; /** * Generate prompt for a skill with parameters */ export declare function generateSkillPrompt(skill: Skill, context: ProjectContext, additionalContext?: string, params?: Record): string; /** * Get skill steps that need execution */ export declare function getExecutableSteps(skill: Skill): SkillStep[]; /** * Skill execution callbacks */ export interface SkillExecutionCallbacks { /** Run a shell command, return stdout */ onCommand: (cmd: string) => Promise; /** Send a prompt to AI chat, return AI response */ onPrompt: (prompt: string) => Promise; /** Run an agent task autonomously */ onAgent: (task: string) => Promise; /** Show confirmation dialog, return true if user confirms */ onConfirm: (message: string) => Promise; /** Show a notification to the user */ onNotify: (message: string) => void; } /** * Execute a skill's steps sequentially. * The latest command, prompt or agent output is available as ${_prev} in later * steps' content; confirm and notify steps leave it unchanged. * Returns the collected results from all steps. */ export declare function executeSkill(skill: Skill, params: Record, callbacks: SkillExecutionCallbacks): Promise; /** * Format skills list for display */ export declare function formatSkillsList(skills: Skill[], skipped?: SkippedSkillFile[]): string; /** * Format skill help */ export declare function formatSkillHelp(skill: Skill): string; /** * Create a custom skill from template */ export declare function createSkillTemplate(name: string): Skill; /** * Wizard step for creating custom skills */ export interface WizardStep { field: 'name' | 'description' | 'shortcut' | 'step_type' | 'step_content' | 'add_another' | 'done'; prompt: string; validate?: (input: string) => string | null; } export declare const WIZARD_STEPS: WizardStep[]; /** * Parse skill definition from YAML-like string */ export declare function parseSkillDefinition(content: string): Skill | null; /** * Get skill categories summary */ export declare function getSkillsSummary(): Record; /** * Search skills by keyword */ export declare function searchSkills(query: string): Skill[]; /** * Track skill usage */ export declare function trackSkillUsage(skillName: string, success?: boolean): void; /** * Get recently used skills */ export declare function getRecentSkills(limit?: number): string[]; /** * Get most frequently used skills */ export declare function getMostUsedSkills(limit?: number): Array<{ name: string; count: number; }>; /** * Get skill usage statistics */ export declare function getSkillStats(): { totalUsage: number; uniqueSkills: number; successRate: number; }; /** * Clear skill usage history */ export declare function clearSkillHistory(): void;