import { type ProjectConfig } from "../config/schema.js"; import { type BootstrapSource } from "./project-config-bootstrapper.js"; import { type GitRemoteFn } from "./workspace-identity.js"; export type ResolvedProjectConfig = { config: ProjectConfig; configPath?: string; root: string; /** * Where the key came from when no config file supplied it. Undefined when * `configPath` is set - "from the file" is what `configPath` already says. */ keySource?: BootstrapSource; }; export type ResolveConfigOptions = { cwd?: string; /** * What to do when the project has no config file. * * - `"required"` - fall back to an explicit key (flag, env, personal * binding, preset) and throw JAM_SETUP_REQUIRED when none applies. * `jam serve` cannot start without one. * - `"optional"` - resolve the same way, but fall back to schema defaults * instead of throwing. `jam doctor` reports the state of the machine; * refusing to load would leave it with nothing to report. * - absent - no fallback at all. * * Resolution either way. Nothing here is ever written. */ keyFallback?: "required" | "optional"; /** `--project` override, only consulted when `keyFallback` is set. */ explicitKey?: string; /** Injected by tests so a decision never depends on the machine's JAM_PROJECT_KEY. */ env?: NodeJS.ProcessEnv; /** Injected by tests so a decision never reads the developer's own presets. */ presetsPath?: string; /** Injected by tests to isolate `~/.jam`. */ home?: string; /** Injected by tests so identity never depends on the checkout under test. */ git?: GitRemoteFn; }; /** * Find this project's JAM config, or decide its key in memory. * * Reads and decides; it never writes. Persisting a decision is `jam setup`'s * job alone (`setup-apply.ts`), because creating a file in someone's * repository is a change they asked for, not a side effect of starting a * server. * * Throws JAM_SETUP_REQUIRED when a key is allowed to come from a fallback but * no explicit source can supply one - JAM never guesses a Jira project from a * repo or folder name. */ export declare function resolveProjectConfig(options?: ResolveConfigOptions): ResolvedProjectConfig;