@builder.io/dev-tools
Version:
Builder.io Visual CMS Devtools
39 lines (38 loc) • 1.71 kB
TypeScript
/**
* Custom instruction/rules discovery utilities
* Handles finding and loading custom instructions from the filesystem
*/
import type { DevToolsSys } from "../../types";
import type { CustomInstruction } from "#ai-utils";
/**
* Get custom instructions from the filesystem
* Searches for instruction files in:
* - .cursor/rules/ - Rule files (.mdc or RULE.md only)
* - .builder/rules/ - Rule files (.mdc or RULE.md only)
* - .agents/rules/ - Rule files (.mdc or RULE.md only)
* - .claude/skills/ - SKILL.md files only (subdirectories supported)
* - .builder/skills/ - SKILL.md files only (subdirectories supported)
* - .agents/skills/ - SKILL.md files only (subdirectories supported)
* - .cursorrules, .builderrules, .windsurfrules
* - .github/copilot-instructions.md
*
* Also scans the equivalent folders under the user's home directory
* (`~/.builder/skills/`, `~/.claude/skills/`, etc.) so user-level skills
* and rules are available in every project.
*
* @param sys - System utilities
* @param projectDir - Project directory (used for relative paths)
* @param currentDir - Starting directory or directories for search
* @param rootDir - Root directory to stop search
* @param homeDir - Override for the user's home directory (for testing)
* @returns Array of discovered custom instructions (both rules and skills)
*/
export declare function getCustomInstructions({ sys, projectDir, currentDir, rootDir, allowedCommands, skipCommandSecurity, homeDir }: {
sys: DevToolsSys;
projectDir: string;
currentDir: string | string[];
rootDir: string;
allowedCommands?: RegExp[];
skipCommandSecurity?: boolean;
homeDir?: string;
}): Promise<CustomInstruction[]>;