import { join, relative } from 'node:path';
import { composeContent, generateHeader } from '../domain/composer.js';
import { readContextFile } from '../domain/reader.js';
import { PROVIDER_CONFIGS } from '../domain/types.js';
import { BaseAdapter } from './base.adapter.js';
/** Copilot adapter: root-only, no symlinks. Emits `.github/copilot-instructions.md` for root context only. */
export class CopilotAdapter extends BaseAdapter {
    providerName = 'copilot';
    createSymlinks(_context, _rootDir, _dryRun) {
        return [];
    }
    generate(context, rootDir) {
        if (!context.isRoot)
            return [];
        const config = PROVIDER_CONFIGS.copilot;
        const template = readContextFile(context);
        const composed = composeContent(template, config);
        const contextRelPath = relative(rootDir, context.contextFile);
        const header = generateHeader(contextRelPath, this.providerName);
        const outputPath = join(context.contextDir, config.instructionFile);
        const content = header + composed.trimEnd() + '\n';
        return [{ content, path: outputPath, type: 'instruction' }];
    }
}
