qraft
Version:
A powerful CLI tool to qraft structured project setups from GitHub template repositories
109 lines • 4.21 kB
TypeScript
import { BoxInfo, BoxReference, RegistryConfig, RegistryManagerConfig } from '../types';
/**
* RegistryManager handles GitHub API integration for remote template repositories
*/
export declare class RegistryManager {
private config;
private octokitInstances;
constructor(config: RegistryManagerConfig);
/**
* Parse a box reference string into registry and box name components
* @param reference Box reference (e.g., "n8n", "myorg/n8n", "aws/lambda")
* @param overrideRegistry Optional registry to override the parsed registry
* @returns BoxReference Parsed reference information
*/
parseBoxReference(reference: string, overrideRegistry?: string): BoxReference;
/**
* Resolve registry name to full registry configuration
* @param registryName Registry name or alias
* @returns RegistryConfig Registry configuration
*/
resolveRegistry(registryName: string): RegistryConfig;
/**
* Get the effective registry for a box reference
* @param reference Box reference
* @param overrideRegistry Optional registry override
* @returns string Effective registry name
*/
getEffectiveRegistry(reference: string, overrideRegistry?: string): string;
/**
* Get or create an Octokit instance for a specific registry
* @param registryName Name of the registry
* @returns Promise<Octokit> Configured Octokit instance
*/
private getOctokitInstance;
/**
* Get authentication token for a registry
* @param registryName Name of the registry
* @returns string | undefined Authentication token or undefined if not available
*/
private getAuthToken;
/**
* Check if a registry has authentication configured
* @param registryName Name of the registry
* @returns boolean True if authentication is available
*/
hasAuthentication(registryName: string): boolean;
/**
* Test authentication for a registry
* @param registryName Name of the registry
* @returns Promise<{authenticated: boolean, user?: string, error?: string}> Authentication test result
*/
testAuthentication(registryName: string): Promise<{
authenticated: boolean;
user?: string;
error?: string;
}>;
/**
* Recursively discover all boxes in a repository
* @param octokit GitHub API instance
* @param owner Repository owner
* @param repo Repository name
* @param path Current path to search (default: '')
* @param maxDepth Maximum recursion depth (default: 5)
* @returns Promise<string[]> Array of box paths
*/
private discoverBoxesRecursively;
/**
* List all boxes available in a registry
* @param registryName Name of the registry (optional, uses default if not provided)
* @returns Promise<string[]> Array of box names
*/
listBoxes(registryName?: string): Promise<string[]>;
/**
* Get box information from a registry
* @param boxRef Box reference
* @returns Promise<BoxInfo | null> Box information or null if not found
*/
getBoxInfo(boxRef: BoxReference): Promise<BoxInfo | null>;
/**
* Get list of files in a box
* @param boxRef Box reference
* @returns Promise<string[]> Array of relative file paths
*/
getBoxFiles(boxRef: BoxReference): Promise<string[]>;
/**
* Download a file from a box
* @param boxRef Box reference
* @param filePath Relative file path within the box
* @returns Promise<Buffer> File content as buffer
*/
downloadFile(boxRef: BoxReference, filePath: string): Promise<Buffer>;
/**
* Check if a box exists in a registry
* @param boxRef Box reference
* @returns Promise<boolean> True if box exists
*/
boxExists(boxRef: BoxReference): Promise<boolean>;
/**
* Get the default registry name
* @returns string Default registry name
*/
getDefaultRegistry(): string;
/**
* Get all configured registries
* @returns Record<string, RegistryConfig> Map of registry configurations
*/
getRegistries(): Record<string, RegistryConfig>;
}
//# sourceMappingURL=registryManager.d.ts.map