import type { AgentAdapter, DetectionResult, InstallOptions, InstallReport, InstallState, Scope } from "../types.js";
export interface RunResult {
    stdout: string;
    stderr: string;
    exitCode: number;
}
export interface OpenCodeDeps {
    run: (cmd: string, args: string[]) => Promise<RunResult>;
    existsSync: (p: string) => boolean;
    readFileSync: (p: string, encoding?: BufferEncoding) => string;
    readdirSync?: (p: string) => string[];
    mkdirSync?: (p: string, opts?: {
        recursive?: boolean;
    }) => void;
    writeFileSync?: (p: string, data: string | Buffer) => void;
    rmSync?: (p: string, opts?: {
        recursive?: boolean;
        force?: boolean;
    }) => void;
    homedir: () => string;
    cwd: () => string;
    fetchLatestVersion: () => Promise<string | undefined>;
    fetchZip: (ref: string) => Promise<{
        tempDir: string;
        ref: string;
        owned?: boolean;
    }>;
}
export declare function defaultOpenCodeDeps(): OpenCodeDeps;
export declare class OpenCodeAdapter implements AgentAdapter {
    readonly id = "opencode";
    readonly displayName = "OpenCode";
    private deps;
    constructor(deps?: OpenCodeDeps);
    supportsScopes(): Scope[];
    detect(): Promise<DetectionResult>;
    getInstallState(scope: Scope): Promise<InstallState>;
    /**
     * Resolve the scope root. Global scope prefers the XDG-style config dir
     * (~/.config/opencode/) that OpenCode documents as primary. Project scope
     * uses ./.opencode/ for committed, team-shared skills.
     */
    private scopeRoot;
    private canonicalSkillPath;
    private queryLocalInstallState;
    private enrichWithLatest;
    install(opts: InstallOptions): Promise<InstallReport>;
    private mkdirp;
    /**
     * Walk a directory tree and remove any file or directory whose basename
     * starts with "doc-detective". Used before re-copying hooks/ or agents/ so
     * we prune our own stale artifacts (files/dirs renamed or removed
     * upstream) without touching unrelated user content living in the same
     * directory.
     */
    private pruneDocDetectiveFiles;
    /**
     * Recursive directory copy. Uses `this.deps.readdirSync` and
     * `this.deps.writeFileSync` where the injected signatures match, but falls
     * back to `fs.statSync` and buffer-returning `fs.readFileSync` directly —
     * the `OpenCodeDeps.readFileSync` signature returns a string, so we can't
     * use it here without losing binary content.
     */
    private copyDir;
}
export declare const opencodeAdapter: AgentAdapter;
//# sourceMappingURL=opencode.d.ts.map