/** * The `agent-detection-map` exposed surface (spec 02): the static per-agent table plus the * pure path derivations and the stat-based detection over it. * * One contract, two halves (REQ-DET-05): * - static — `AGENT_TARGETS` (re-exported), `resolveRoots`, `destinationFor` * - behavioral — `detectAgent`, `detectAgents`, `formatZeroDetection` * * Every function is data-driven over `AGENT_TARGETS` / `AGENT_IDS`, so a new agent is exactly * one table row (REQ-SCALE-01) with no edit here. Read-only and total: nothing writes, spawns * an agent, or creates a directory. Zero runtime dependencies; only `node:` built-ins. */ import { type AgentId, type AgentTarget, type Confidence, type DetectionResult, type ResolveOpts, type Scope } from "./types.js"; export { AGENT_TARGETS } from "./types.js"; /** * Resolve the two filesystem roots all destinations derive from, applying defaults. This is * the single injection point for the home and working directories, so tests sandbox every * path computation without touching the real `~` (spec 02 §4.2). * * - `home` (global scope root) defaults to `os.homedir()`. * - `cwd` (project scope root) defaults to `process.cwd()`. * * Both returned paths are absolute and `path.resolve`d. Pure: reads no files, spawns nothing. */ export declare function resolveRoots(opts?: ResolveOpts): { home: string; cwd: string; }; /** * Derive the absolute install destination for one agent under a given scope (REQ-DET-01, * REQ-FLAG-02): * * //// * * where `scopeRoot` is the home dir for `"global"` and the cwd for `"project"`, and an empty * `installSubpath` is skipped (the namespace dir sits directly under `installBaseDir`). The path * is derived, never stored, so a new agent is one `AGENT_TARGETS` row (REQ-SCALE-01). Pure. * * @example destinationFor(AGENT_TARGETS.claude, "global", { home: "/h" }) * // → "/h/.claude/skills/feature-forge" * @example destinationFor(AGENT_TARGETS.codex, "project", { cwd: "/p" }) * // → "/p/.agents/skills/feature-forge" */ export declare function destinationFor(target: AgentTarget, scope: Scope, opts?: ResolveOpts): string; /** * The filesystem containment boundary every write for `target` is checked against (REQ-SEC-02): * / * Decoupled from the detection dir so codex (installs under `.agents`) and copilot (`.github`) * contain correctly even though they detect on `.codex`/`.copilot`. Pure. */ export declare function agentRootFor(target: AgentTarget, scope: Scope, opts?: ResolveOpts): string; /** * The effective confidence for `target` under `scope` (A4): the per-row `projectConfidence` * override applies only to project scope (e.g. gemini project = best-known); otherwise the * row's `confidence`. Pure — surfaced in the report so install honesty is scope-accurate. */ export declare function confidenceFor(target: AgentTarget, scope: Scope): Confidence; /** * Detect a single agent on the host (REQ-DET-02). Detection is decided solely by the presence * of the agent's config dir under the active scope root (a `stat`, never an agent subprocess). * * Populates `configDirsProbed` (named in the zero-detection report, REQ-DET-04), `destination` * (the resolved install dest for the active scope), and the advisory-only `cliOnPath` (never the * detection signal). Total: any valid `AgentId` yields a `DetectionResult`; absence is * `detected: false`, never an error. */ export declare function detectAgent(id: AgentId, opts?: ResolveOpts): DetectionResult; /** Options for {@link detectAgents}: {@link ResolveOpts} plus a single-agent scope (REQ-FLAG-01). */ export interface DetectAgentsOpts extends ResolveOpts { /** Restrict detection to this one agent (`--agent/-a`). Absent ⇒ all agents (REQ-DET-03). */ readonly only?: AgentId; } /** * Detect every supported agent in canonical `AGENT_IDS` order (REQ-DET-03). Pass `opts.only` * to scope to a single agent (REQ-FLAG-01); the result is then a one-element array. The default * project/global scope comes from `opts.scope`. Total — never throws; each agent is probed * independently. */ export declare function detectAgents(opts?: DetectAgentsOpts): DetectionResult[]; /** * Build the clear, actionable message for the zero-agents-detected case (REQ-DET-04). Names * every config dir probed (drawn from the supplied results' `configDirsProbed`) so the user sees * exactly where the installer looked. Creates no directory and produces no opaque error. * Pure: derives text from already-computed {@link DetectionResult}s. */ export declare function formatZeroDetection(results: DetectionResult[], scope: Scope): string;