import type { EngineAdapter, ProjectMarkerSpec } from "./engine-adapter.js"; /** * The **install-plugin resolution policy** (auth-fixes design 02 §T5 / defect B1) — the shared logic * that decides WHICH directory an engine plugin installs into, and verifies it is actually that * engine's project. It closes B1 (unity `install-plugin` used to demand an explicit path): the project * path resolves `path? → --path? → cwd`, then the adapter's marker probe confirms the directory is a * real project — and on failure the error lists EXACTLY what was checked, so the user knows why. * * Ancestor walk-up is deliberately OUT OF SCOPE (decision M5) — the cwd fallback closes the UX gap * without the ambiguity a walk-up introduces. This module is the pure resolution/probe decision; the * engine-specific copy/junction of the plugin stays in each CLI. */ /** The outcome of probing a directory for an engine's project markers. */ export interface MarkerProbeResult { /** True when at least one of the adapter's markers matched. */ found: boolean; /** The marker spec that matched (when {@link found}). */ matched?: ProjectMarkerSpec; /** Human-readable descriptions of every location that was checked (for the failure message). */ checked: string[]; } /** Probe `projectRoot` against `markers`; the first match wins. Never throws (an unreadable dir = miss). */ export declare function probeProjectMarkers(projectRoot: string, markers: readonly ProjectMarkerSpec[]): MarkerProbeResult; /** Options for {@link resolveInstallTarget}. */ export interface ResolveInstallTargetOptions { adapter: EngineAdapter; /** The positional `[path]` argument (highest priority). */ positional?: string; /** The `--path ` flag (second priority). */ path?: string; /** cwd override (tests); defaults to `process.cwd()` (the final fallback — closes B1). */ cwd?: string; /** * When true (default), require the resolved directory to pass the marker probe. When false, resolve * the path but return a `warning` instead of failing on a marker miss (a not-yet-initialised project * tree is a valid, rarer flow — mirrors the Unreal CLI's warn-not-refuse behaviour). */ requireMarker?: boolean; } /** The resolved, verified install target (or a clear failure listing what was checked). */ export type ResolveInstallTargetResult = { kind: "success"; /** The absolute resolved project root. */ projectRoot: string; /** How the path was resolved (which of the ladder rungs won). */ source: "positional" | "path" | "cwd"; /** The probe result (found === true when `requireMarker`, else may be a miss with a warning). */ probe: MarkerProbeResult; /** Present when the directory did NOT match a marker but `requireMarker` was false. */ warning?: string; } | { kind: "failure"; error: Error; }; /** * Resolve + verify an install target. Resolution ladder (T5): explicit positional path, then `--path`, * then cwd. Then probe the adapter's markers; on a miss with `requireMarker` (the default) fail with a * message that lists every location checked. Never throws. */ export declare function resolveInstallTarget(opts: ResolveInstallTargetOptions): ResolveInstallTargetResult; //# sourceMappingURL=install-plugin.d.ts.map