/**
 * CLI Marketplace Utilities
 *
 * Self-contained marketplace logic for the CLI. Fetches the registry from the
 * marketing site, downloads and installs skill archives, and manages the local
 * installed-items manifest. Does not depend on the backend server being running.
 *
 * @module cli/utils/marketplace
 */
/** A single item in the marketplace registry */
export interface MarketplaceItem {
    id: string;
    type: 'skill' | 'model' | 'role';
    name: string;
    description: string;
    author: string;
    version: string;
    category: string;
    tags: string[];
    license: string;
    icon?: string;
    downloads: number;
    rating: number;
    createdAt: string;
    updatedAt: string;
    assets: {
        archive?: string;
        checksum?: string;
        sizeBytes?: number;
        model?: string;
    };
    metadata?: Record<string, unknown>;
}
/** The full registry response */
export interface MarketplaceRegistry {
    schemaVersion: number;
    lastUpdated: string;
    cdnBaseUrl: string;
    items: MarketplaceItem[];
}
/** A record of an installed item */
export interface InstalledItemRecord {
    id: string;
    type: string;
    name: string;
    version: string;
    installedAt: string;
    installPath: string;
    checksum?: string;
}
/** The on-disk manifest of installed items */
export interface InstalledItemsManifest {
    schemaVersion: number;
    items: InstalledItemRecord[];
}
/**
 * Fetches the marketplace registry from both public (GitHub) and premium (stevesprompt) sources.
 * Merges results, with premium items taking priority on ID conflict.
 * Both sources are fetched in parallel for efficiency.
 *
 * @returns The full marketplace registry
 * @throws Error if both fetches fail
 */
export declare function fetchRegistry(): Promise<MarketplaceRegistry>;
/**
 * Loads the installed-items manifest from disk.
 * Returns an empty manifest if the file doesn't exist.
 *
 * @returns The installed items manifest
 */
export declare function loadManifest(): Promise<InstalledItemsManifest>;
/**
 * Saves the installed-items manifest to disk.
 *
 * @param manifest - The manifest to persist
 */
export declare function saveManifest(manifest: InstalledItemsManifest): Promise<void>;
/**
 * Returns the local install path for a marketplace item.
 *
 * @param type - Item type (skill, model, role)
 * @param id - Item ID (must be lowercase alphanumeric with hyphens)
 * @returns Absolute path to the install directory
 * @throws Error if id contains invalid characters (path traversal prevention)
 */
export declare function getInstallPath(type: 'skill' | 'model' | 'role', id: string): string;
/**
 * Downloads and installs a single marketplace item.
 *
 * For skill archives (.tar.gz), extracts the contents into the install directory.
 * After installation, ensures _common/lib.sh files are present.
 * Cleans up partial installs on failure.
 *
 * @param item - The marketplace item to install
 * @returns Object with success status and message
 */
export declare function downloadAndInstall(item: MarketplaceItem): Promise<{
    success: boolean;
    message: string;
}>;
/**
 * Ensures _common/lib.sh files exist in the marketplace directory.
 *
 * Copies the agent-level and root-level _common/lib.sh from the bundled
 * package into the marketplace directory so installed skills can source them.
 */
export declare function ensureCommonLibs(): Promise<void>;
/**
 * Checks how many marketplace skills are installed locally.
 *
 * Compares the remote registry against the local manifest to determine
 * how many skills are already present.
 *
 * @returns Object with `installed` and `total` counts
 */
export declare function checkSkillsInstalled(): Promise<{
    installed: number;
    total: number;
}>;
/**
 * Installs all skills from the marketplace registry.
 *
 * Downloads and installs each skill sequentially. An optional progress
 * callback is invoked after each skill to allow callers to display progress.
 *
 * @param onProgress - Optional callback invoked with (skillName, currentIndex, totalCount)
 * @returns The number of successfully installed skills
 */
export declare function installAllSkills(onProgress?: (name: string, index: number, total: number) => void): Promise<number>;
/**
 * Counts the number of bundled core agent skills shipped with the Crewly package.
 *
 * Looks in config/skills/agent/core/ for subdirectories.
 * Used as a fallback when the marketplace is unreachable.
 *
 * @returns The number of bundled core skill directories
 */
export declare function countBundledSkills(): number;
/**
 * Formats a byte count into a human-readable string.
 *
 * @param bytes - Size in bytes
 * @returns Formatted string like "18.4 KB"
 */
export declare function formatBytes(bytes: number): string;
//# sourceMappingURL=marketplace.d.ts.map