// ---------------------------------------------------------------------------
// Provider definitions
// ---------------------------------------------------------------------------
const PROVIDER_DEFS = [
    {
        key: 'codegraph',
        provider: 'colby-codegraph',
        command: 'npx',
        args: ['-y', '@colbymchenry/codegraph', 'serve', '--mcp'],
    },
    {
        key: 'codegraphcontext',
        provider: 'codegraph-context',
        command: 'npx',
        args: ['-y', 'codegraphcontext-mcp'],
    },
    {
        key: 'code-pathfinder',
        provider: 'pathfinder',
        command: 'npx',
        args: ['-y', '@codepathfinder/mcp-server'],
    },
    {
        key: 'axon',
        provider: 'axon',
        command: 'npx',
        args: ['-y', 'axon-mcp'],
    },
];
// ---------------------------------------------------------------------------
// Public functions
// ---------------------------------------------------------------------------
/**
 * Build a .claude.json MCP entry for a given provider key.
 */
export function buildProviderEntry(providerKey) {
    const def = PROVIDER_DEFS.find((d) => d.key === providerKey);
    if (!def) {
        return null;
    }
    return { command: def.command, args: def.args };
}
/**
 * Merge a new MCP entry into an existing .claude.json config object.
 * Returns the updated config (does not mutate input).
 */
export function mergeProviderIntoConfig(existing, providerKey, entry) {
    return {
        ...existing,
        mcpServers: {
            ...(existing.mcpServers ?? {}),
            [providerKey]: entry,
        },
    };
}
/**
 * Determine which providers are configured given a .claude.json config object.
 */
export function resolveProviderStatuses(config) {
    const servers = config.mcpServers ?? {};
    return PROVIDER_DEFS.map((def) => ({
        name: def.provider,
        configured: Object.prototype.hasOwnProperty.call(servers, def.key),
    }));
}
/**
 * Build the full status result from a .claude.json config object.
 */
export function buildStatusResult(config) {
    const providers = resolveProviderStatuses(config);
    const activeProviders = providers.filter((p) => p.configured);
    const activeProvider = activeProviders.length > 0 ? (activeProviders[0]?.name ?? null) : null;
    return { providers, activeProvider };
}
/**
 * Return the key used in .claude.json for a given action.
 */
export function actionToProviderKey(action) {
    const map = {
        'setup-colby-codegraph': 'codegraph',
        'setup-codegraph-context': 'codegraphcontext',
        'setup-pathfinder': 'code-pathfinder',
        'setup-axon': 'axon',
    };
    return map[action] ?? '';
}
//# sourceMappingURL=code-graph-configurator.js.map