/**
 * install/transforms/claude.mjs — Claude Code transform.
 *
 * Claude Code is the canonical target — frontmatter is preserved as-is and
 * the body is left untouched. The only mutation is `{{APT_VERSION}}` →
 * actual semver. Output paths follow `.claude/skills/<name>/SKILL.md` and
 * `.claude/agents/<name>.md`, matching the legacy installer that this
 * pipeline replaces.
 */
import { basename, dirname } from 'node:path';
import { substituteVersion } from './_shared.mjs';
/**
 * @param {import('../pipeline.mjs').TransformInput} input
 * @returns {import('../pipeline.mjs').TransformOutput[]}
 */
export function transform({ canonicalContent, canonicalRelPath, version, fileType }) {
    const content = substituteVersion(canonicalContent, version);
    if (fileType === 'skill') {
        // canonicalRelPath looks like 'skills/apt-foo/SKILL.md'; preserve
        // the skill folder name + nested file structure under .claude/skills/.
        const folder = basename(dirname(canonicalRelPath));
        return [{ outputPath: `skills/${folder}/SKILL.md`, content }];
    }
    if (fileType === 'agent') {
        // agents/apt-foo.md OR skills/apt-foo.md (top-level agent-skill files
        // — the legacy installer copied these into .claude/skills/ along
        // with the dirs). For backward compat we keep them in .claude/skills/
        // when their canonical path was under skills/, and .claude/agents/
        // when it was under agents/.
        const file = basename(canonicalRelPath);
        const installRoot = canonicalRelPath.startsWith('agents/') ? 'agents' : 'skills';
        return [{ outputPath: `${installRoot}/${file}`, content }];
    }
    if (fileType === 'hook-js' || fileType === 'hook-sh') {
        const file = basename(canonicalRelPath);
        return [{ outputPath: `hooks/${file}`, content }];
    }
    return [];
}
//# sourceMappingURL=claude.mjs.map