export type AuthStrategy = "auto" | "pat" | "none"; /** * Auth config block under a repo. `PAT` and `PAT-EnvVarName` are mutually * exclusive — use inline for quick testing, env var indirection for anything * that lands in the committed config. */ export interface AuthFile { strategy?: AuthStrategy; PAT?: string; "PAT-EnvVarName"?: string; } export interface RepoDefinition { name: string; url?: string; branch?: string; sourceRoot?: string; packages?: string[]; packageFilter?: string; auth?: AuthFile; } export interface ConfigFile { debug?: boolean; /** Map of repo name → absolute or cwd-relative path to developer's local clone (Mode B). */ localRepos?: Record; repos: RepoDefinition[]; } export interface RepoConfig { name: string; url?: string; /** Git branch to clone/track for managed repos. Undefined = repo default branch. */ branch?: string; /** Absolute path to developer's local clone (Mode B), from `localRepos`. */ localPath?: string; /** Absolute target dir for managed clones: `/`. */ managedSourcePath: string; /** Relative path within repo where package dirs live (default "src"). */ sourceRoot: string; /** * - `"explicit"`: packages listed in config file. * - `"auto"`: scan repo on disk for every non-test `.csproj` dir. * - `"wildcard"`: driven by `packageFilter` field; intersect (solution-referenced ∩ filter prefix ∩ on-disk candidates). */ discoveryMode: "explicit" | "auto" | "wildcard"; /** * Only set when `packageFilter` is present in config. The raw glob value, * e.g. `"MyCompany.*"`. Prefix is derived at point of use via `.slice(0, -1)`. */ packageFilter?: string; /** Populated immediately for explicit, lazily (by discoverPackages / wildcard) for auto and wildcard. */ packages: PackageConfig[]; /** Resolved git auth for this repo. Never undefined — defaults to `{ strategy: "auto" }`. */ auth: GitAuth; } export interface PackageConfig { name: string; /** Name of the parent repo (matches RepoConfig.name). */ repoName: string; /** Repo-relative path using forward slashes, e.g. "src/MyCompany.Core". */ pathInRepo: string; /** Absolute cache dir for this package: `/`. */ cachePath: string; } /** * Resolved git auth config. * - `auto`: try unauthenticated first, fall back to PAT if set and clone fails. * - `pat`: always inject PAT into HTTPS URLs (fatal error if PAT not set). * - `none`: never use credentials, even if PAT is set. */ export interface GitAuth { strategy: AuthStrategy; /** Resolved Personal Access Token. Undefined when not set or strategy is "none". */ pat?: string; } export interface DiggerConfig { workspaceRoot: string; /** Absolute path to the config file that was read. */ configPath: string; managedSourceDir: string; cacheDir: string; debug: boolean; repos: RepoConfig[]; warnings: string[]; } /** Thrown when configuration is invalid. Aggregates all problems found in one pass. */ export declare class ConfigError extends Error { readonly problems: string[]; constructor(problems: string[]); } export declare const DEFAULT_CONFIG_PATH = ".digger/config.json"; export declare function isValidPackageName(name: string): boolean; export declare function filterPrefix(packageFilter: string): string; export declare function validateBranchName(branch: string): string | undefined; export declare function validateRepoUrl(url: string): string | undefined; /** * Parse a `.env` file into key-value pairs. * Supports `KEY=VALUE`, `# comments`, blank lines, and optional quoting * (single or double quotes stripped from values). Inline comments after * unquoted values are supported with ` #`. */ export declare function parseEnvFile(content: string): Map; /** * Read `.digger/config.json` (or path from `DIGGER_CONFIG` env var), merge * per-machine env vars, and return a validated {@link DiggerConfig}. * * If a `.env` file exists in `cwd`, its values are loaded as defaults — * actual environment variables always take precedence. `.env` is the intended * source for per-machine secrets referenced by `auth.PAT-EnvVarName`. * * For repos with explicit `packages` arrays, {@link PackageConfig} entries are * built immediately. For repos without (auto-discover), `packages` starts empty * and is populated later by {@link discoverPackages} after the repo is on disk. * * Throws {@link ConfigError} aggregating every validation problem found. * Returns `null` when the config file is absent (ENOENT). */ export declare function loadConfig(rawEnv?: NodeJS.ProcessEnv, cwd?: string): DiggerConfig | null; export declare function discoverPackages(repoPath: string, repoConfig: RepoConfig, cacheDir: string): Promise; /** Find a package by name across all repos. */ export declare function findPackage(config: DiggerConfig, packageName: string): PackageConfig | undefined; /** Find the repo that owns a given package name. */ export declare function findRepo(config: DiggerConfig, packageName: string): RepoConfig | undefined; /** Format an error message for an unknown package name. */ export declare function formatUnknownPackage(config: DiggerConfig, packageName: string): string; /** Format an error message for an unknown package within a specific repo. */ export declare function formatUnknownPackageInRepo(repoName: string, packageName: string, packages: readonly PackageConfig[]): string; /** Format an error message for an unknown repo name. */ export declare function formatUnknownRepo(config: DiggerConfig, repoName: string): string; //# sourceMappingURL=config.d.ts.map