import { mkdir, writeFile } from 'node:fs/promises';
import { join } from 'node:path';

export async function setupAccountConfigDir(
  configDir: string,
  extracted: { configJson: object; credentials: string },
): Promise<void> {
  await mkdir(configDir, { recursive: true });

  // Write .claude.json
  await writeFile(join(configDir, '.claude.json'), JSON.stringify(extracted.configJson, null, 2));

  // Write .credentials.json
  await writeFile(join(configDir, '.credentials.json'), extracted.credentials);
}
