@reliverse/rse-sdk
Version:
@reliverse/rse-sdk allows you to create new plugins for @reliverse/rse CLI, interact with reliverse.org, and even extend your own CLI functionality (you may also try @reliverse/dler-sdk for this case).
62 lines (61 loc) • 2.83 kB
TypeScript
/**
* Converts a TypeScript rule file to markdown content (.mdc).
* It removes redundant declarations, import statements, and unwanted blocks.
*
* @param content - The raw TypeScript file content.
* @param filePath - The source file path.
* @returns The converted markdown content.
*/
export declare function convertTsToMdc(content: string, filePath: string): string;
/**
* Checks if the Cursor rules directory exists in the given working directory.
* @param cwd - Current working directory.
* @returns Boolean indicating if the directory exists.
*/
export declare function hasCursorRulesDir(cwd: string): Promise<boolean>;
/**
* Checks if at least one installed .mdc rule file exists in the .cursor/rules folder.
* @param cwd - Current working directory.
* @returns Boolean indicating if at least one .mdc file exists.
*/
export declare function hasInstalledRules(cwd: string): Promise<boolean>;
/**
* Checks if updates are available for a given rule repository.
* @param repoId - Repository ID in format "owner/repo".
* @returns Boolean indicating if an update is available.
*/
export declare function checkRulesRepoUpdate(repoId: string): Promise<boolean>;
/**
* Checks for updates only for rule repositories that are installed (i.e. their cache exists).
* @param isDev - Flag indicating development mode.
* @returns Boolean indicating if any updates are available.
*/
export declare function checkForRuleUpdates(isDev: boolean): Promise<boolean>;
/**
* Downloads rules from a repository.
* Presents a multiselect prompt with all available rule files. Files that already exist
* in the cache will be labeled with a "(cached)" hint and will simply be reused.
* Files not cached will be downloaded (and converted if needed) and then saved.
*
* @param repoId - Repository identifier ("owner/repoName").
* @param isDev - Flag indicating development mode.
* @returns Array of file names (cached filenames) that will be installed.
*/
export declare function downloadRules(repoId: string, isDev: boolean): Promise<string[]>;
/**
* Installs selected rules into the Cursor rules directory.
* Copies the cached files (with .mdc extension) into .cursor/rules,
* automatically overwriting any existing file.
*
* @param files - Array of cached file names to install.
* @param owner - Repository owner.
* @param cwd - Current working directory.
*/
export declare function installRules(files: string[], owner: string, cwd: string): Promise<void>;
/**
* Handles rule updates by checking, downloading, and installing updates.
* Only processes repositories that are installed (where the cache directory exists).
* @param cwd - Current working directory.
* @param isDev - Flag indicating development mode.
*/
export declare function handleRuleUpdates(cwd: string, isDev: boolean): Promise<void>;