/*!
 * Copyright (C) Microsoft Corporation. All rights reserved.
 */
import { getVfs } from '../VfsManager.js';
export async function readRepoConfig(configPath) {
    const vfs = getVfs();
    try {
        const configContent = await vfs.readFile(configPath, 'utf-8');
        return JSON.parse(configContent);
    }
    catch (error) {
        throw new Error(`Failed to read repository configuration: ${error instanceof Error ? error.message : String(error)}`);
    }
}
export async function writeRepoConfig(configPath, config) {
    const vfs = getVfs();
    // If we don't have a version, set it to '1.0' by default
    if (!config.version) {
        config.version = '1.0';
    }
    try {
        const configContent = JSON.stringify(config, null, 2);
        await vfs.writeFile(configPath, configContent, { encoding: 'utf-8' });
    }
    catch (error) {
        throw new Error(`Failed to write repository configuration: ${error instanceof Error ? error.message : String(error)}`);
    }
}
//# sourceMappingURL=ConfigManager.js.map