UNPKG

vibe-rules

Version:

A utility for managing Cursor rules, Windsurf rules, and other AI prompts

42 lines (41 loc) 1.97 kB
import { RuleConfig, RuleType, StoredRuleConfig } from "../types.js"; /** * Saves a rule definition to the internal storage (~/.vibe-rules/<ruleType>/<name>.txt). * @param ruleType - The type of the rule, determining the subdirectory. * @param config - The rule configuration object containing name and content. * @returns The full path where the rule was saved. * @throws Error if file writing fails. */ export declare function saveInternalRule(ruleType: RuleType, config: RuleConfig): Promise<string>; /** * Loads a rule definition from the internal storage. * @param ruleType - The type of the rule. * @param name - The name of the rule to load. * @returns The RuleConfig object if found, otherwise null. */ export declare function loadInternalRule(ruleType: RuleType, name: string): Promise<RuleConfig | null>; /** * Lists the names of all rules stored internally for a given rule type. * @param ruleType - The type of the rule. * @returns An array of rule names. */ export declare function listInternalRules(ruleType: RuleType): Promise<string[]>; /** * Saves a rule with metadata to the common storage (~/.vibe-rules/rules/<name>.json). * @param config - The stored rule configuration object containing name, content, and metadata. * @returns The full path where the rule was saved. * @throws Error if validation or file writing fails. */ export declare function saveCommonRule(config: StoredRuleConfig): Promise<string>; /** * Loads a rule with metadata from the common storage. * Falls back to legacy .txt format for backwards compatibility. * @param name - The name of the rule to load. * @returns The StoredRuleConfig object if found, otherwise null. */ export declare function loadCommonRule(name: string): Promise<StoredRuleConfig | null>; /** * Lists the names of all rules stored in the common storage (both JSON and legacy .txt). * @returns An array of rule names. */ export declare function listCommonRules(): Promise<string[]>;