/** * Resolve the workspace directory for `qfg push` / `qfg pull`. * * Resolution order: * 1. `--dir ` flag (explicit, wins everything) * 2. `QUONFIG_DIR` env var * 3. Walk up from cwd looking for `quonfig.json`. Stop at the first hit, * the user's home dir, or the filesystem root. * 4. Error: `No Quonfig workspace dir found. ...` * * Pure — the caller wires `process.cwd()` and `process.env.QUONFIG_DIR` in. * Tests drive the function with explicit values so the cwd walk can be * exercised inside a tmp dir without `process.chdir`. * * Empty-string flag / env values are treated as "absent" because shells * routinely emit `EXPORT_FOO=` when a var is declared but has no value; * silently picking the empty string would resolve to cwd and produce a * confusing wrong-target failure downstream. */ export declare const NO_WORKSPACE_DIR_ERROR = "No Quonfig workspace dir found. Run from inside a workspace, or pass --dir, or set QUONFIG_DIR."; export interface ResolveWorkspaceDirInput { /** Current working directory — the search root for the walk. */ cwd: string; /** Value of `QUONFIG_DIR` env var (or undefined). */ envDir: string | undefined; /** Value of `--dir` flag (or undefined). */ flagDir: string | undefined; /** * The user's home directory. The cwd walk stops here (without checking * it) so we never pick up a stray `quonfig.json` parked in `~`. Defaults * to `os.homedir()` when omitted; tests pass an explicit value so they * can pretend a tmp dir is "home". */ homeDir?: string; } export type ResolveWorkspaceDirResult = { kind: 'ok'; dir: string; source: 'flag' | 'env' | 'cwd-walk'; } | { kind: 'error'; message: string; }; export declare const resolveWorkspaceDir: (input: ResolveWorkspaceDirInput) => ResolveWorkspaceDirResult;