/**
 * First-party plugin installer for SpecWeave.
 *
 * Installs plugins via Claude Code's native plugin system:
 *   1. Registers the specweave marketplace
 *   2. Runs `claude plugin install <name>@specweave`
 *   3. Fixes hook permissions in the plugin cache
 *   4. Migrates legacy ~/.claude/commands/<name>/ installations
 *
 * @since 1.0.279 (originally copy-based, migrated to native in 1.0.356)
 */
export interface CopyPluginOptions {
    /** Force reinstall even if hash matches lockfile */
    force?: boolean;
    /** Override target skills directory (relative to projectRoot). Defaults to '.claude/skills'. */
    targetSkillsDir?: string;
}
export interface CopyPluginResult {
    success: boolean;
    /** Content hash of source plugin directory */
    sha: string;
    /** Where the plugin was installed to */
    targetDir?: string;
    /** Error message if failed */
    error?: string;
    /** True if skipped because hash unchanged */
    skipped?: boolean;
}
interface LockfileSkillEntry {
    version: string;
    sha: string;
    tier: string;
    installedAt: string;
    source: string;
}
interface VskillLock {
    version: number;
    agents: string[];
    skills: Record<string, LockfileSkillEntry>;
    createdAt: string;
    updatedAt: string;
}
/** Global bundled plugin hash cache filename */
export declare const GLOBAL_LOCKFILE_NAME = "plugins-lock.json";
/**
 * Check if the core SW plugin is installed and enabled natively in Claude Code.
 *
 * Runs `claude plugin list` and parses the output for `sw@specweave` with
 * enabled status. This is cross-platform and does not rely on internal file
 * formats that may change between Claude Code versions.
 *
 * @returns true if sw@specweave is present and enabled
 */
export declare function isSwPluginInstalledNatively(): boolean;
/**
 * Compute SHA-256 content hash (first 12 hex chars) for a plugin directory.
 * Hashes filename + content for every readable file to detect any change.
 * Path separators are normalized to '/' for cross-platform consistency.
 */
export declare function computePluginHash(pluginDir: string): string;
/**
 * Fix hook permissions: chmod 755 on all .sh files recursively.
 */
export declare function fixHookPermissions(targetDir: string): void;
/**
 * Remove legacy ~/.claude/commands/<name>/ installation.
 *
 * Prior to 1.0.356, SpecWeave installed plugins by manually copying files to
 * ~/.claude/commands/<name>/ with custom flattening and filtering. This
 * bypassed Claude Code's native plugin system. Now that we use the native
 * system, the legacy directory must be removed to avoid duplicate commands.
 */
export declare function migrateLegacyCommandsDir(pluginName: string): boolean;
/**
 * Read vskill.lock from a directory.
 */
export declare function readLockfile(dir: string): VskillLock | null;
/**
 * Write vskill.lock to a directory.
 */
export declare function writeLockfile(lock: VskillLock, dir: string): void;
/**
 * Ensure a lockfile exists, creating one if needed.
 */
export declare function ensureLockfile(dir: string): VskillLock;
/**
 * Return the global lock directory (~/.specweave/), creating it if needed.
 * Accepts an optional homeDir override for testing.
 */
export declare function getGlobalLockDir(homeOverride?: string): string;
/**
 * Read the global plugins-lock.json.
 */
export declare function readGlobalLockfile(homeOverride?: string): VskillLock | null;
/**
 * Write the global plugins-lock.json.
 */
export declare function writeGlobalLockfile(lock: VskillLock, homeOverride?: string): void;
/**
 * Ensure global lockfile exists, creating one if needed.
 */
export declare function ensureGlobalLockfile(homeOverride?: string): VskillLock;
/**
 * Migrate bundled plugin entries (source: 'local:specweave') from a project's
 * vskill.lock to the global ~/.specweave/plugins-lock.json.
 *
 * - Only moves entries with source === 'local:specweave'
 * - Preserves newer global entries (timestamp comparison)
 * - Deletes project vskill.lock if it becomes empty after migration
 * - Idempotent: safe to run multiple times
 */
export declare function migrateBundledToGlobalLock(projectRoot: string, homeOverride?: string): {
    migratedCount: number;
    deletedProjectLock: boolean;
};
/**
 * Remove satellite plugin entries from both global and project lockfiles.
 *
 * After consolidation, all satellite skills ship under the 'sw' plugin.
 * This function cleans up stale lockfile entries that reference the old
 * satellite plugin names.
 *
 * - Idempotent: safe to run multiple times
 * - Failure non-blocking: returns {migratedCount: 0} on any error
 *
 * @param projectRoot - Project directory (optional — only global lock if omitted)
 * @param homeOverride - Override home directory for testing
 */
export declare function migrateSatelliteToUnifiedLock(projectRoot?: string, homeOverride?: string): {
    migratedCount: number;
};
/**
 * Find the specweave package root from a start directory.
 * Walks up looking for package.json with name 'specweave' or '@specweave/core'.
 * Works for both development (source) and production (dist/) layouts.
 */
export declare function findSpecweaveRoot(startDir: string): string | null;
/**
 * Install a first-party plugin via Claude Code's native plugin system.
 *
 * Steps:
 *   1. Compute content hash and check lockfile for changes
 *   2. Register the specweave marketplace with Claude CLI
 *   3. Install the plugin via `claude plugin install <name>@specweave`
 *   4. Fix hook permissions in the native plugin cache
 *   5. Remove legacy ~/.claude/commands/<name>/ if present
 *   6. Update lockfile
 */
export declare function installPlugin(pluginName: string, specweaveRoot: string, options?: CopyPluginOptions): CopyPluginResult;
/**
 * @deprecated Use installPlugin() instead. Alias kept for backward compatibility.
 */
export declare const copyPlugin: typeof installPlugin;
/**
 * Copy all skills from a specweave plugin directly into .claude/skills/.
 *
 * Instead of using `claude plugin install` (which writes to global cache),
 * this walks the plugin's skills/ directory and copies each SKILL.md to
 * the project-local `.claude/skills/{skillName}/SKILL.md`.
 *
 * @param pluginName - Name of the plugin in marketplace.json
 * @param specweaveRoot - Root of the specweave package
 * @param projectRoot - Root of the user's project (where .claude/ lives)
 * @param options - Installation options
 * @returns Installation result
 */
export declare function copyPluginSkillsToProject(pluginName: string, specweaveRoot: string, projectRoot: string, options?: CopyPluginOptions): CopyPluginResult;
export {};
//# sourceMappingURL=plugin-copier.d.ts.map