import type { GeneratedPackageDomain, GeneratedPackageAlias, GeneratedPackageName, GeneratedPackageVersions } from './generated-package-names';
import type { Packages } from './packages/index';
// Type guards
export declare function isPackageAlias(name: string): name is PackageAlias;
export declare function isPackageDomain(name: string): name is PackageDomain;
export declare function isValidPackageName(name: string): name is PackageName;
export declare function isSupportedPlatform(platform: string): platform is SupportedPlatform;
export declare function isSupportedArchitecture(arch: string): arch is SupportedArchitecture;
// Utility functions
export declare function getAllPackageAliases(): PackageAlias[];
export declare function getAllPackageDomains(): PackageDomain[];
export declare function resolvePackageName(name: string): PackageResolution;
export declare function parsePackageSpec(spec: string): ParsedPackageSpec;
export declare function formatPackageSpec(name: PackageName, version?: string): PackageSpec;
export declare function detectPlatform(): PlatformInfo;
export declare function createInstallationContext(packageName: PackageName, version?: string, platformInfo?: PlatformInfo): InstallationContext;
// Helper to get packages by category
export declare function getPackagesByCategory(category: keyof typeof PACKAGE_CATEGORIES): readonly string[];
// Helper to check if a package is in a specific category
export declare function isPackageInCategory(packageName: string, category: keyof typeof PACKAGE_CATEGORIES): boolean;
/**
 * Version validation function that forces TypeScript to check the version at the call site
 * This moves the error from the property name to the function argument
 *
 * @param version - The version constraint to validate
 * @returns The same version if valid, causes compile error if invalid
 *
 * @example
 * const deps = {
 *   'bun.com': v('^1.2.19'),     // ✅ Valid
 *   'bun.com': v('^1.2.999'),    // ❌ Error highlights the version string
 * }
 */
export declare function v<K extends PackageName>(version: StrictVersionConstraint<K>): StrictVersionConstraint<K>;
/**
 * Package dependency validation function with enhanced error messages
 * Validates both package name and version at the call site
 *
 * @param packageName - The package name to validate
 * @param version - The version constraint to validate
 * @returns Tuple of [packageName, version] if valid
 *
 * @example
 * const [pkg, ver] = pkg('bun.com', '^1.2.19')    // ✅ Valid
 * const [pkg, ver] = pkg('bun.com', '^1.2.999')   // ❌ Error on version argument
 * const [pkg, ver] = pkg('invalid', '^1.2.19')    // ❌ Error on package argument
 */
export declare function pkg<K extends PackageName>(packageName: K, version: StrictVersionConstraint<K>): [K, StrictVersionConstraint<K>];
/**
 * Enhanced dependency object builder with precise error highlighting
 *
 * @example
 * const deps = dependencies({
 *   'bun.com': '^1.2.19',      // ✅ Valid
 *   'bun.com': '^1.2.999',     // ❌ Error highlights the version value
 * })
 */
export declare function dependencies<T extends Dependencies>(deps: T): T;
// Constants for common version specifications
export declare const VERSION_SPECS: {
  LATEST: 'latest';
  ANY: '*'
};
// Constants for common package categories
export declare const PACKAGE_CATEGORIES: {
  RUNTIME: readonly ['nodejs.org', 'python.org', 'go.dev', 'rust-lang.org'];
  BUILD_TOOLS: readonly ['cmake.org', 'ninja-build.org', 'gradle.org', 'maven.apache.org'];
  DATABASES: readonly ['postgresql.org', 'mysql.com', 'redis.io', 'mongodb.com'];
  EDITORS: readonly ['neovim.io', 'vim.org', 'code.visualstudio.com'];
  CLI_TOOLS: readonly ['cli.github.com', 'curl.se', 'wget.gnu.org', 'jq.dev']
};
// Package information interface
export declare interface PackageInfo {
  name: string
  domain: string
  description: string
  latestVersion: string
  totalVersions: number
  programs: string[]
  dependencies: string[]
  companions: string[]
  versions: string[]
}
// Package resolution result
export declare interface PackageResolution {
  originalName: string
  resolvedDomain: string
  isAlias: boolean
  version?: string
}
// Package specification parsing result
export declare interface ParsedPackageSpec {
  name: string
  version?: string
  versionSpec?: VersionSpec
}
// Platform detection result
export declare interface PlatformInfo {
  platform: SupportedPlatform
  architecture: SupportedArchitecture
  isSupported: boolean
}
// Package installation context
export declare interface InstallationContext {
  packageName: PackageName
  version: string
  platform: SupportedPlatform
  architecture: SupportedArchitecture
  format: SupportedFormat
}
// Use pre-generated types to avoid TypeScript limitations with large unions
export type PackageAlias = GeneratedPackageAlias;
export type PackageDomain = GeneratedPackageDomain;
export type PackageName = GeneratedPackageName;
// Type for package with optional version specification
export type PackageSpec = `${PackageName}` | `${PackageName}@${string}`;
// Supported distribution formats
export type SupportedFormat = 'tar.xz' | 'tar.gz' | 'zip' | 'dmg' | 'pkg' | 'msi' | 'deb' | 'rpm';
// Supported platforms
export type SupportedPlatform = 'darwin' | 'linux' | 'windows';
// Supported architectures
export type SupportedArchitecture = 'x86_64' | 'aarch64' | 'armv7l' | 'i686';
// Version specification types
export type VersionSpec = | 'latest'
  | `^${string}`
  | `~${string}`
  | `>=${string}`
  | `<=${string}`
  | `>${string}`
  | `<${string}`
  | `=${string}`
  | string;
/**
 * Extract available versions for a specific package
 * Uses pre-generated version mappings for domains to avoid TypeScript performance issues
 */
export type PackageVersions<T extends PackageName> = Packages[T & keyof Packages] extends { versions: readonly (infer V)[] }
  ? V extends string
    ? V
    : never
  : T extends keyof GeneratedPackageVersions
    ? GeneratedPackageVersions[T]
    : never;
/**
 * Strict version constraint that only allows valid versions for a package
 */
export type StrictVersionConstraint<T extends PackageName> = | PackageVersions<T>
  | `^${PackageVersions<T>}`
  | `~${PackageVersions<T>}`
  | `>=${PackageVersions<T>}`
  | `<=${PackageVersions<T>}`
  | `>${PackageVersions<T>}`
  | `<${PackageVersions<T>}`
  | 'latest'
  | '*';
/**
 * Forces value-level type checking by using function parameter inference
 * This utility type helps highlight errors at the value location rather than property name
 */
export type ValidateVersion<K extends PackageName, V> = V extends StrictVersionConstraint<K>
    ? V
    : {
        readonly __error: `❌ Invalid version "${V & string}" for package "${K}"`
        readonly __expected: StrictVersionConstraint<K>
      }
/**
 * Create a type that uses excess property checking to force errors on values
 * This exploits how TypeScript handles object literal excess property checking
 */
export type ExactDependency<K extends PackageName, V> = V extends StrictVersionConstraint<K>
    ? { [P in K]: V }
    : V extends { version?: any, global?: boolean }
      ? V extends { version?: StrictVersionConstraint<K>, global?: boolean }
        ? { [P in K]: V }
        : never
      : never;
/**
 * Clean dependencies type with explicit version expansion for better IntelliSense
 * This version shows actual valid versions when hovering over package names
 */
export type CleanDependencies = {
  readonly [K in PackageName]?:
    | PackageVersions<K>
    | `^${PackageVersions<K>}`
    | `~${PackageVersions<K>}`
    | `>=${PackageVersions<K>}`
    | `<=${PackageVersions<K>}`
    | `>${PackageVersions<K>}`
    | `<${PackageVersions<K>}`
    | 'latest'
    | '*'
    | {
        version?:
          | PackageVersions<K>
          | `^${PackageVersions<K>}`
          | `~${PackageVersions<K>}`
          | `>=${PackageVersions<K>}`
          | `<=${PackageVersions<K>}`
          | `>${PackageVersions<K>}`
          | `<${PackageVersions<K>}`
          | 'latest'
          | '*'
        global?: boolean
      }
}
/**
 * Advanced dependency object type with version validation
 * Usage: const deps: Dependencies = { 'bun.com': '^1.2.19' }
 */
export type Dependencies = CleanDependencies;
