import os from 'node:os';
import type { Dependency, DependencyResolutionResult, DependencyResolverOptions } from './dependency-resolver';
// Export types for external use
export type { Dependency, DependencyResolutionResult, DependencyResolverOptions };
/**
 * Main API function for Pantry to resolve dependencies from a file
 *
 * @param filePath Path to dependency file (deps.yaml, pkgx.yaml, etc.)
 * @param options Resolution options
 * @returns Promise with install information
 *
 * @example
 * ```typescript
 * import { resolveDependencies } from 'ts-pantry'
 *
 * const result = await resolveDependencies('./deps.yaml', {
 *   targetOs: 'darwin',
 *   includeOsSpecific: true
 * })
 *
 * console.log(`Installing ${result.totalCount} packages...`)
 * console.log(result.pantryCommand)
 *
 * // Install each package
 * for (const pkg of result.packages) {
 *   await pantry.install(pkg.name, pkg.version)
 * }
 * ```
 */
export declare function resolveDependencies(filePath: string, options?: PantryResolverOptions): Promise<PantryInstallResult>;
/**
 * Resolve dependencies from a YAML string directly
 *
 * @param yamlContent YAML content as string
 * @param options Resolution options
 * @returns Promise with install information
 *
 * @example
 * ```typescript
 * const yamlContent = `
 * global: true
 * dependencies:
 *   bun.sh: ^1.2.16
 *   gnu.org/grep: ^3.12.0
 * `
 *
 * const result = await resolveDependenciesFromYaml(yamlContent)
 * console.log(result.packages) // Array of resolved packages
 * ```
 */
export declare function resolveDependenciesFromYaml(yamlContent: string, options?: PantryResolverOptions): Promise<PantryInstallResult>;
/**
 * Resolve transitive dependencies for a single package
 *
 * @param packageName Package domain name (e.g., 'bun.sh', 'gnu.org/grep')
 * @param options Resolution options
 * @returns Promise with all transitive dependencies
 *
 * @example
 * ```typescript
 * const deps = await resolvePackageDependencies('gnu.org/grep')
 * console.log(deps) // ['pcre.org/v2@10.44.0', 'zlib.net@1.3.1', ...]
 * ```
 */
export declare function resolvePackageDependencies(packageName: string, options?: PantryResolverOptions): Promise<PantryPackage[]>;
/**
 * Get install command for a list of packages
 *
 * @param packages Array of package names (should be direct deps only)
 * @param format Command format ('pkgx' or 'pantry')
 * @returns Install command string
 *
 * @note Both pkgx and pantry auto-resolve transitive dependencies
 */
export declare function getInstallCommand(packages: string[], format?: 'pkgx' | 'pantry'): string;
/**
 * Read project dependencies from the pantry directory and pantry.lock.
 * This is a synchronous API suitable for use in STX server-side scripts.
 *
 * @param projectRoot Path to the project root (containing pantry/ and pantry.lock)
 * @returns Project dependency information
 *
 * @example
 * ```typescript
 * const deps = readProjectDependencies('/path/to/project')
 * console.log(`${deps.thirdPartyCount} third-party packages`)
 * ```
 */
export declare function readProjectDependencies(projectRoot: string): ProjectDependencies;
/**
 * Simplified package info for Pantry
 */
export declare interface PantryPackage {
  name: string
  version: string
  constraint: string
  isOsSpecific: boolean
  os?: 'linux' | 'darwin' | 'windows'
}
/**
 * Result returned by Pantry API
 */
export declare interface PantryInstallResult {
  packages: PantryPackage[]
  directCount: number
  totalCount: number
  conflicts: Array<{
    package: string
    versions: string[]
    resolved: string
  }>
  pantryCommand: string
}
/**
 * Options for Pantry dependency resolution
 */
export declare interface PantryResolverOptions {
  targetOs?: 'linux' | 'darwin' | 'windows'
  includeOsSpecific?: boolean
  maxDepth?: number
  verbose?: boolean
}
/**
 * Information about a project dependency from the pantry directory
 */
export declare interface ProjectDependency {
  name: string
  version: string
  isWorkspace: boolean
  isScoped: boolean
}
/**
 * Summary of a project's pantry dependencies
 */
export declare interface ProjectDependencies {
  packages: ProjectDependency[]
  thirdPartyCount: number
  workspaceCount: number
  totalCount: number
}
