import { access } from 'node:fs/promises';
import { join } from 'node:path';
import { COPILOT_PROJECT_MAPPINGS, COPILOT_USER_MAPPINGS } from './paths.js';
async function detectCopilot(scopeRoot) {
    const markers = [
        join(scopeRoot, '.copilot'),
        join(scopeRoot, '.github', 'copilot-instructions.md'),
        join(scopeRoot, '.github', 'agents'),
        join(scopeRoot, '.github', 'skills'),
        join(scopeRoot, '.github', 'instructions'),
    ];
    for (const marker of markers) {
        try {
            await access(marker);
            return true;
        }
        catch {
            // continue to next marker
        }
    }
    return false;
}
export const copilotAdapter = {
    name: 'copilot',
    displayName: 'GitHub Copilot',
    defaultStrategy: 'symlink',
    projectMappings: COPILOT_PROJECT_MAPPINGS,
    userMappings: COPILOT_USER_MAPPINGS,
    detect: detectCopilot,
};
