import { PackageJson } from '../../project/package'; import { DetectionSource } from '..'; export { DetectionSource } from '..'; /** * Filesystem layout describing where applications and libraries live in a monorepo. */ interface WorkspaceLayout { /** Applications directory */ appsDir: string; /** Libraries directory */ libsDir: string; } /** * Monorepo detection result. */ interface MonorepoDetection { /** Tool identifier */ id: string; /** Human-readable name */ name: string; /** Detected version */ version?: string; /** Config file path */ configPath?: string; /** Detection confidence (0-100) */ confidence: number; /** Detection sources */ detectedFrom: DetectionSource[]; /** Workspace layout */ workspaceLayout?: WorkspaceLayout; /** Detected project paths */ projects?: string[]; } /** * Monorepo detector interface. */ interface MonorepoDetector { /** Tool identifier */ id: string; /** Human-readable name */ name: string; /** Check if tool is present */ detect(workspacePath: string, packageJson?: PackageJson): MonorepoDetection | null; } /** All monorepo detectors */ declare const monorepoDetectors: MonorepoDetector[]; /** * Detect all monorepo tools in project. * * @param workspacePath - Workspace directory path * @param packageJson - Optional pre-loaded package.json * @returns Array of detected monorepo tools, sorted by confidence * * @example Detecting monorepo tools * ```typescript * const detections = detectMonorepoTools('/path/to/project') * // => [ * // { id: 'nx', name: 'NX', confidence: 90, configPath: 'nx.json', detectedFrom: [...] }, * // { id: 'npm-workspaces', name: 'npm Workspaces', confidence: 80, ... } * // ] * ``` */ declare function detectMonorepoTools(workspacePath: string, packageJson?: PackageJson): MonorepoDetection[]; /** * Detect Lerna in project. * * @param workspacePath - Workspace directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Lerna monorepo * ```typescript * // Project with lerna.json config file * const result = lernaDetector('/path/to/lerna-project') * // => { * // id: 'lerna', * // name: 'Lerna', * // confidence: 80, * // configPath: 'lerna.json', * // detectedFrom: [{ type: 'config-file', path: 'lerna.json' }] * // } * ``` */ declare function lernaDetector(workspacePath: string, packageJson?: PackageJson): MonorepoDetection | null; /** * Detect npm workspaces in project. * * @param workspacePath - Workspace directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting npm workspaces * ```typescript * // Project with workspaces in package.json and package-lock.json * const result = npmWorkspacesDetector('/path/to/npm-project') * // => { * // id: 'npm-workspaces', * // name: 'npm Workspaces', * // confidence: 90, * // configPath: 'package.json', * // detectedFrom: [ * // { type: 'package.json', field: 'workspaces' }, * // { type: 'lockfile', path: 'package-lock.json' } * // ] * // } * ``` */ declare function npmWorkspacesDetector(workspacePath: string, packageJson?: PackageJson): MonorepoDetection | null; /** * Detect NX in project. * * @param workspacePath - Workspace directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting NX workspace * ```typescript * // Project with nx.json and apps/libs directories * const result = nxDetector('/path/to/nx-workspace') * // => { * // id: 'nx', * // name: 'NX', * // confidence: 100, * // configPath: 'nx.json', * // version: '17.0.0', * // workspaceLayout: { appsDir: 'apps', libsDir: 'libs' }, * // detectedFrom: [ * // { type: 'config-file', path: 'nx.json' }, * // { type: 'package.json', field: 'dependencies.nx' }, * // { type: 'directory', path: 'apps/ or libs/' } * // ] * // } * ``` */ declare function nxDetector(workspacePath: string, packageJson?: PackageJson): MonorepoDetection | null; /** * Detect pnpm workspaces in project. * * @param workspacePath - Workspace directory path * @returns Detection result or null if not detected * * @example Detecting pnpm workspaces * ```typescript * // Project with pnpm-workspace.yaml * const result = pnpmWorkspacesDetector('/path/to/pnpm-project') * // => { * // id: 'pnpm-workspaces', * // name: 'pnpm Workspaces', * // confidence: 100, * // configPath: 'pnpm-workspace.yaml', * // detectedFrom: [ * // { type: 'config-file', path: 'pnpm-workspace.yaml' }, * // { type: 'lockfile', path: 'pnpm-lock.yaml' } * // ] * // } * ``` */ declare function pnpmWorkspacesDetector(workspacePath: string): MonorepoDetection | null; /** * Detect Rush in project. * * @param workspacePath - Workspace directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Rush monorepo * ```typescript * // Project with rush.json config file * const result = rushDetector('/path/to/rush-project') * // => { * // id: 'rush', * // name: 'Rush', * // confidence: 90, * // configPath: 'rush.json', * // detectedFrom: [{ type: 'config-file', path: 'rush.json' }] * // } * ``` */ declare function rushDetector(workspacePath: string, packageJson?: PackageJson): MonorepoDetection | null; /** * Detect Turborepo in project. * * @param workspacePath - Workspace directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting Turborepo monorepo * ```typescript * // Project with turbo.json and turbo dependency * const result = turborepoDetector('/path/to/turbo-project') * // => { * // id: 'turborepo', * // name: 'Turborepo', * // confidence: 95, * // configPath: 'turbo.json', * // version: '2.0.0', * // detectedFrom: [ * // { type: 'config-file', path: 'turbo.json' }, * // { type: 'package.json', field: 'dependencies.turbo' } * // ] * // } * ``` */ declare function turborepoDetector(workspacePath: string, packageJson?: PackageJson): MonorepoDetection | null; /** * Detect yarn workspaces in project. * * @param workspacePath - Workspace directory path * @param packageJson - Optional pre-loaded package.json * @returns Detection result or null if not detected * * @example Detecting yarn workspaces * ```typescript * // Project with workspaces in package.json and yarn.lock * const result = yarnWorkspacesDetector('/path/to/yarn-project') * // => { * // id: 'yarn-workspaces', * // name: 'Yarn Workspaces', * // confidence: 100, * // configPath: 'package.json', * // detectedFrom: [ * // { type: 'package.json', field: 'workspaces' }, * // { type: 'lockfile', path: 'yarn.lock' }, * // { type: 'config-file', path: '.yarnrc.yml' } * // ] * // } * ``` */ declare function yarnWorkspacesDetector(workspacePath: string, packageJson?: PackageJson): MonorepoDetection | null; export { detectMonorepoTools, lernaDetector, monorepoDetectors, npmWorkspacesDetector, nxDetector, pnpmWorkspacesDetector, rushDetector, turborepoDetector, yarnWorkspacesDetector }; export type { MonorepoDetection, MonorepoDetector };