/** * @fileoverview writeInstallFiles() — the disk-write + rollback core of skill install. * @module @skillsmith/core/services/skill-installation.io.write * @see SMI-6529 Wave A0 round 2: split out of skill-installation.io.ts to stay * under the 500-line CI gate once the M4/M7/M10/L14/L15 fixes landed — pure * move for everything that predates this split, no behavior change to it. * Re-exported from skill-installation.io.ts so every existing * `from './skill-installation.io.js'` import site is unaffected. * @see SMI-6529 round 4 (N1/N2/N8/N9/N11/N12): confirmation-review fixes — * see each inline comment below for the specific finding it closes. */ import { type ClientId } from '../install/paths.js'; /** What {@link writeInstallFiles} wrote, plus a `rollback` that undoes it. */ export interface WriteInstallResult { writtenFiles: string[]; subagentPath?: string; /** * SMI-6529 M10: true when a companion agent file was NOT written because * this was a FRESH install (`preExisted` false) and something already * occupied the companion-agent target path — a pre-existing file there * could belong to an unrelated skill/agent the user created by hand, so a * brand-new install must never silently overwrite it. A forced reinstall * of an already-tracked skill (`preExisted` true) still overwrites it, on * the theory that Skillsmith itself most likely generated it originally. */ companionSkipped?: boolean; /** * SMI-6529 M7: restores every file this call overwrote to its pre-install * bytes/mode and removes everything it created fresh — the SAME cleanup * `writeInstallFiles` runs on its own internal write failure, exposed so a * caller whose LATER step fails (e.g. the manifest update in * `finalizeSuccessfulInstall`) can undo a write that itself already * succeeded. Pass the causing error so a restore failure can be reported * alongside it via {@link InstallRestoreError}; on a clean restore this * resolves without throwing and the caller should rethrow its own error. */ rollback: (causeError: unknown) => Promise; } /** * Write a skill's files into `installPath`, snapshotting every file it will * overwrite first. On failure it restores those files and removes only what * it created; a directory that existed before the call is never removed. * Callers run `checkInstallTarget` first. */ export declare function writeInstallFiles(installPath: string, skillsDir: string, skillName: string, finalSkillContent: string, subSkillFiles: Array<{ filename: string; content: string; }>, subagentContent: string | undefined, /** * SMI-5980 (Wave 3): the client this companion subagent (if any) is * generated for — resolves its output path via * `resolveCompanionAgentPath()` (install/paths.ts) instead of a hardcoded * `~/.claude/agents/` literal. Optional, defaulting to `CANONICAL_CLIENT` * (`claude-code`) so pre-existing callers/tests that never pass it keep * today's exact behavior unchanged. */ client?: ClientId, /** * SMI-5982 code-review fix #1: explicit base dir for resolving a RELATIVE * `COMPANION_AGENT_TARGETS[client].dir` (Antigravity only — every other * client's `dir` is absolute already). Threaded through to * `resolveCompanionAgentPath()`'s own `baseDir` param as-is (no * `?? process.cwd()` fallback here) — `resolveCompanionAgentPath()` itself * now requires an explicit `baseDir` for every `directory-package`-mode * client (PR-review follow-up), so whether an omitted `companionBaseDir` * is acceptable is that function's call to make, not this one's. */ companionBaseDir?: string): Promise; //# sourceMappingURL=skill-installation.io.write.d.ts.map