/** * @packageDocumentation * * Helpers for constructing the CLI's execution environment. */ import { type Ignore } from 'ignore'; import type { CacheProvider } from '../core/cache-provider.js'; import type { Config } from '../core/linter.js'; import type { Linter } from '../index.js'; import type { LintResult } from '../core/types.js'; import type { DesignLintPolicy } from '../core/types.js'; /** * Represents the prepared environment used by CLI commands. * * Includes shared configuration, linter instance, cache handles, and ignore * file tracking utilities. */ export interface Environment { /** Format lint results for console output. */ formatter: (results: LintResult[], useColor?: boolean) => string; /** Loaded configuration for the current project. */ config: Config; /** Mutable reference to the active linter instance. */ linterRef: { current: Linter; }; /** Resolved plugin module paths. */ pluginPaths: string[]; /** Optional cache provider instance. */ cache?: CacheProvider; /** Location of the cache file, when enabled. */ cacheLocation?: string; /** Path to a user-specified ignore file. */ ignorePath?: string; /** Resolved path to .designlintignore if present. */ designIgnore: string; /** Resolved path to .gitignore if present. */ gitIgnore: string; refreshIgnore: () => Promise; /** Internal state tracking plugin and ignore file paths. */ state: { pluginPaths: string[]; ignoreFilePaths: string[]; }; /** Retrieve the active ignore matcher. */ getIg: () => Ignore; /** Active policy loaded from `designlint.policy.json`, if present. */ policy?: DesignLintPolicy; /** Options used when creating the environment. */ envOptions: { cacheLocation?: string; configPath?: string; patterns?: string[]; }; } /** * Options for preparing the CLI execution environment. */ export interface PrepareEnvironmentOptions { /** Formatter name or module path. */ format?: string; /** Optional configuration file path. */ config?: string; /** Maximum concurrent linted files. */ concurrency?: number; /** Enable persistent caching. */ cache?: boolean; /** Custom cache file location. */ cacheLocation?: string; /** Additional ignore file path. */ ignorePath?: string; /** File patterns to lint. */ patterns?: string[]; /** Path to the DSR kernel Unix socket. Defaults to /tmp/designlint-kernel.sock. */ kernelSocketPath?: string; } /** * Prepare the environment for CLI execution by loading configuration, cache, * and ignore settings. * * @param options - Runtime options controlling config, caching, and patterns. * @returns Fully prepared environment state. */ export declare function prepareEnvironment(options: PrepareEnvironmentOptions): Promise; //# sourceMappingURL=env.d.ts.map