UNPKG

qraft

Version:

A powerful CLI tool to qraft structured project setups from GitHub template repositories

192 lines 7.56 kB
import { BoxInfo, BoxOperationConfig, BoxOperationResult, BoxReference } from '../types'; import { ConfigManager } from '../utils/config'; import { LocalManifestEntry, ManifestManager } from './manifestManager'; /** * BoxManager that supports both local and remote GitHub repositories */ export declare class BoxManager { private configManager; private registryManager; private cacheManager; private manifestManager; constructor(configManager?: ConfigManager); /** * Initialize the managers (lazy loading) */ private initializeManagers; /** * Parse a box reference string and resolve registry * @param reference Box reference (e.g., "n8n", "myorg/n8n") * @param overrideRegistry Optional registry to override the parsed registry * @returns Promise<BoxReference> Parsed and resolved reference */ parseBoxReference(reference: string, overrideRegistry?: string): Promise<BoxReference>; /** * Resolve registry name to configuration * @param registryName Registry name * @returns Promise<RegistryConfig> Registry configuration */ resolveRegistry(registryName: string): Promise<import("../types").RegistryConfig>; /** * Get the effective registry for a box reference * @param reference Box reference * @param overrideRegistry Optional registry override * @returns Promise<string> Effective registry name */ getEffectiveRegistry(reference: string, overrideRegistry?: string): Promise<string>; /** * Discover all available boxes from the default registry * @param registryName Optional registry name (uses default if not provided) * @returns Promise<BoxInfo[]> Array of discovered boxes */ discoverBoxes(registryName?: string): Promise<BoxInfo[]>; /** * Get information about a specific box * @param boxRef Box reference or string * @returns Promise<BoxInfo | null> Box information or null if not found */ getBoxInfo(boxRef: BoxReference | string): Promise<BoxInfo | null>; /** * Check if a box exists * @param boxRef Box reference or string * @returns Promise<boolean> True if box exists */ boxExists(boxRef: BoxReference | string): Promise<boolean>; /** * List all available boxes with their basic information * @param registryName Optional registry name * @returns Promise<Array<{name: string, description: string, version: string}>> Simple list of boxes */ listBoxes(registryName?: string): Promise<Array<{ name: string; description: string; version: string; }>>; /** * Copy a box to a target directory with GitHub support * @param config Box operation configuration * @param overrideRegistry Optional registry to override the parsed registry * @returns Promise<BoxOperationResult> Result of the operation */ copyBox(config: BoxOperationConfig, overrideRegistry?: string): Promise<BoxOperationResult>; /** * Download files from GitHub and copy them to target directory * @param boxRef Box reference * @param boxInfo Box information * @param targetDir Target directory * @param force Whether to force overwrite * @returns Promise<Array> File operation results */ private downloadAndCopyFiles; /** * Check if a file should be excluded based on patterns * @param filePath Relative file path * @param excludePatterns Array of patterns to match against * @returns boolean True if file should be excluded */ private shouldExcludeFile; /** * Copy a box by name with simplified parameters * @param boxName Name of the box to copy * @param targetDirectory Target directory (optional) * @param force Whether to force overwrite existing files * @param overrideRegistry Optional registry to override the parsed registry * @param nosync Whether to skip creating .qraft directory (no sync tracking) * @returns Promise<BoxOperationResult> Result of the operation */ copyBoxByName(boxName: string, targetDirectory?: string, force?: boolean, overrideRegistry?: string, nosync?: boolean): Promise<BoxOperationResult>; /** * List all configured registries * @returns Promise<Array<{name: string, repository: string, isDefault: boolean}>> List of registries */ listRegistries(): Promise<Array<{ name: string; repository: string; isDefault: boolean; }>>; /** * Get the default registry name * @returns Promise<string> Default registry name */ getDefaultRegistry(): Promise<string>; /** * Check if a registry has authentication configured * @param registryName Name of the registry * @returns Promise<boolean> True if authentication is available */ hasAuthentication(registryName: string): Promise<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; }>; /** * Set authentication token for a registry * @param registryName Name of the registry * @param token GitHub token * @returns Promise<void> */ setRegistryToken(registryName: string, token: string): Promise<void>; /** * Set global authentication token * @param token GitHub token * @returns Promise<void> */ setGlobalToken(token: string): Promise<void>; /** * Get GitHub token for a registry * @param registryName Name of the registry * @returns Promise<string | undefined> GitHub token */ getGitHubToken(registryName: string): Promise<string | undefined>; /** * Store manifest locally in the target directory * @param boxRef Box reference * @param boxInfo Box information * @param targetDir Target directory * @returns Promise<void> */ private storeManifestLocally; /** * Check if a box is new or updated compared to local manifest * @param boxInfo Remote box information * @param targetDir Target directory * @returns Promise<'new' | 'updated' | 'identical' | 'unknown'> */ detectBoxState(boxInfo: BoxInfo, targetDir: string): Promise<'new' | 'updated' | 'identical' | 'unknown'>; /** * Get local manifest for a directory * @param targetDir Target directory * @returns Promise<LocalManifestEntry | null> */ getLocalManifest(targetDir: string): Promise<LocalManifestEntry | null>; /** * Check if local manifest exists * @param targetDir Target directory * @returns Promise<boolean> */ hasLocalManifest(targetDir: string): Promise<boolean>; /** * Synchronize local manifest with remote * @param boxRef Box reference * @param targetDir Target directory * @returns Promise<boolean> True if sync was needed and performed */ syncManifest(boxRef: BoxReference, targetDir: string): Promise<boolean>; /** * Get manifest manager instance * @returns ManifestManager Manifest manager instance */ getManifestManager(): ManifestManager; /** * Get configuration manager * @returns ConfigManager Configuration manager instance */ getConfigManager(): ConfigManager; } //# sourceMappingURL=boxManager.d.ts.map