/**
 * Pure-function helpers for the `remnic capsule` CLI surface (issue #676 PR 6/6).
 *
 * All functions here are free of orchestrator / filesystem side-effects so
 * they can be unit-tested without booting the gateway (CLAUDE.md rules 14, 51).
 *
 * Responsibilities:
 *  - Input validation + option parsing for every capsule sub-command flag.
 *  - Rendering of `capsule list` and `capsule inspect` output in text /
 *    markdown / json forms.
 *
 * The actual I/O (export, import, merge, directory listing, manifest read) is
 * wired in `cli.ts` because those operations need the orchestrator's config.
 */
type CapsuleOutputFormat = "text" | "markdown" | "json";
/**
 * Metadata entry returned by `capsule list` for a single archive file found
 * in the capsule store directory.
 */
interface CapsuleListEntry {
    /** Capsule id extracted from the filename (slug before `.capsule.json.gz`). */
    id: string;
    /** Absolute path to the `.capsule.json.gz` archive. */
    archivePath: string;
    /** Absolute path to the sidecar `.manifest.json`, or null if missing. */
    manifestPath: string | null;
    /** `createdAt` ISO string from the sidecar manifest, or null if unreadable. */
    createdAt: string | null;
    /** `pluginVersion` from the sidecar manifest, or null. */
    pluginVersion: string | null;
    /** `files` array length from the sidecar manifest, or null. */
    fileCount: number | null;
    /** `capsule.description` from the sidecar manifest, or null. */
    description: string | null;
}
/**
 * Validate and coerce the `--format` flag value.
 *
 * Rule 51: invalid values must throw with a listed-options error, not silently
 * fall back to a default.
 */
declare function parseCapsuleOutputFormat(raw: unknown): CapsuleOutputFormat;
/**
 * Validate and coerce the `--mode` flag for `capsule import`.
 */
declare function parseCapsuleImportMode(raw: unknown): "skip" | "overwrite" | "fork";
/**
 * Validate and coerce the `--conflict-mode` flag for `capsule merge`.
 */
declare function parseCapsuleConflictMode(raw: unknown): "skip-conflicts" | "prefer-source" | "prefer-local";
declare function parseCapsuleSince(raw: unknown): string | undefined;
/**
 * Parse a comma-separated `--include-kinds` value into an array of non-empty
 * top-level directory names. Rejects values containing path separators.
 */
declare function parseCapsuleIncludeKinds(raw: unknown): string[] | undefined;
/**
 * Parse a comma-separated `--peers` value into an array of peer ids.
 */
declare function parseCapsulePeers(raw: unknown): string[] | undefined;
interface CapsuleExportOptions {
    name: string;
    out: string | undefined;
    since: string | undefined;
    includeKinds: string[] | undefined;
    peers: string[] | undefined;
}
interface CapsuleImportOptions {
    archive: string;
    mode: "skip" | "overwrite" | "fork";
}
interface CapsuleMergeOptions {
    archive: string;
    conflictMode: "skip-conflicts" | "prefer-source" | "prefer-local";
}
interface CapsuleListOptions {
    format: CapsuleOutputFormat;
    capsulesDir: string;
}
interface CapsuleInspectOptions {
    archive: string;
    format: CapsuleOutputFormat;
}
declare function parseCapsuleExportOptions(nameArg: unknown, opts: Record<string, unknown>): CapsuleExportOptions;
declare function parseCapsuleImportOptions(archiveArg: unknown, opts: Record<string, unknown>): CapsuleImportOptions;
declare function parseCapsuleMergeOptions(archiveArg: unknown, opts: Record<string, unknown>): CapsuleMergeOptions;
declare function parseCapsuleListOptions(opts: Record<string, unknown>, defaultCapsulesDir: string): CapsuleListOptions;
declare function parseCapsuleInspectOptions(archiveArg: unknown, opts: Record<string, unknown>): CapsuleInspectOptions;
/**
 * Return the default capsule store directory for a given memory root.
 * This mirrors the `outDir` default in `exportCapsule` (`<root>/.capsules`)
 * so that `capsule list` discovers archives written by `capsule export`
 * without extra configuration.
 *
 * For `capsule list`, the POSIX conventional path is:
 *   `<memoryDir>/.capsules`
 *
 * Operators can override it with `--dir <path>` at runtime.
 */
declare function defaultCapsulesDir(memoryDir: string): string;
/**
 * Render the `capsule list` output.
 */
declare function renderCapsuleList(entries: CapsuleListEntry[], format: CapsuleOutputFormat): string;
/**
 * Render the `capsule inspect` output from a manifest object.
 */
declare function renderCapsuleInspect(manifest: CapsuleInspectData, format: CapsuleOutputFormat): string;
/**
 * Data shape consumed by {@link renderCapsuleInspect}.
 * Populated by the cli.ts action handler from the parsed manifest.
 */
interface CapsuleInspectData {
    capsuleId: string;
    version: string;
    schemaVersion: string;
    createdAt: string | null;
    pluginVersion: string | null;
    fileCount: number;
    includesTranscripts: boolean;
    description: string;
    parentCapsule: string | null;
    retrievalPolicy: {
        tierWeights: Record<string, number>;
        directAnswerEnabled: boolean;
    };
    includes: {
        taxonomy: boolean;
        identityAnchors: boolean;
        peerProfiles: boolean;
        procedural: boolean;
    };
    /** First N file paths from manifest.files (for preview). */
    topFiles: string[];
}

export { type CapsuleExportOptions, type CapsuleImportOptions, type CapsuleInspectData, type CapsuleInspectOptions, type CapsuleListEntry, type CapsuleListOptions, type CapsuleMergeOptions, type CapsuleOutputFormat, defaultCapsulesDir, parseCapsuleConflictMode, parseCapsuleExportOptions, parseCapsuleImportMode, parseCapsuleImportOptions, parseCapsuleIncludeKinds, parseCapsuleInspectOptions, parseCapsuleListOptions, parseCapsuleMergeOptions, parseCapsuleOutputFormat, parseCapsulePeers, parseCapsuleSince, renderCapsuleInspect, renderCapsuleList };
