import { basename } from "node:path";
export interface CopyResult {
    /** Absolute path of the `.tmp` staging directory. Caller renames into place. */
    stagingDir: string;
    /** Number of files written under `stagingDir`. */
    filesCopied: number;
    /** Final destination path (where `stagingDir` should be renamed to). */
    finalDir: string;
}
export interface PluginCopyResult extends CopyResult {
    /** Absolute path of the `.tmp` staged plugin manifest (sibling of the live manifest). */
    manifestTmpPath: string;
    /** Absolute path of the live plugin manifest (final rename target). */
    manifestFinalPath: string;
}
/** Compute the `.tmp` sibling of a final destination path. */
export declare function tmpSibling(finalPath: string): string;
/**
 * Best-effort cleanup of a `.tmp` path. Mirrors the rollback shape used by
 * src/commands/add.ts:rollbackInstall — swallows per-call errors so a partial
 * filesystem state doesn't suppress the underlying diagnostic the orchestrator
 * is about to surface to the user.
 */
export declare function bestEffortRm(path: string): void;
/**
 * Copy a source skill into a fresh standalone target dir, staged at
 * `<finalDir>.tmp`. The orchestrator is responsible for the atomic
 * rename and any pre-checks for collisions / `--force`.
 */
export declare function writeStandalone(args: {
    sourceSkillDir: string;
    finalDir: string;
}): Promise<CopyResult>;
/**
 * Copy a source skill into an existing user-owned plugin's skills/ directory
 * AND stage an updated `plugin.json` at `<plugin.json>.tmp` so the
 * orchestrator can rename both in sequence (two-phase commit).
 *
 * Pre-flight: detects malformed plugin.json BEFORE any copy is staged
 * (AC-US2-03). Caller aborts on the thrown error; no skill files are written.
 */
export declare function writeToPlugin(args: {
    sourceSkillDir: string;
    pluginRoot: string;
    newSkillName: string;
}): Promise<PluginCopyResult>;
/**
 * Scaffold a fresh new plugin at `<pluginRoot>` containing
 * `.claude-plugin/plugin.json` (with the requested name) plus
 * `skills/<skill>/` subtree containing the cloned skill.
 *
 * The whole plugin tree is staged at `<pluginRoot>.tmp` and atomically
 * renamed by the caller — there is no two-phase commit because the manifest
 * and the skill files live under a common root (one `rename` is enough).
 */
export declare function writeNewPlugin(args: {
    sourceSkillDir: string;
    pluginRoot: string;
    pluginName: string;
    newSkillName: string;
    /** Optional plugin description; defaults to a generic forked-skills line. */
    description?: string;
    /** Optional plugin author; recorded in plugin.json. */
    author?: string;
}): Promise<CopyResult>;
/**
 * The `bareSkillName` helper extracts the unqualified skill name from a
 * fully-qualified name like `anton/ado-mapper` → `ado-mapper`. Used by the
 * orchestrator and by callers that need the directory-safe segment.
 */
export declare function bareSkillName(fullyQualified: string): string;
/** Re-export for callers that want to validate basenames. */
export { basename };
