Files
Codewalkers/apps/server/agent/accounts/setup.ts
Lukas May a2afc2e1fd fix: Convert sync file I/O to async in credential handler and account setup
Removes blocking readFileSync, writeFileSync, and mkdirSync calls from the
agent spawn hot path, replacing them with async fs/promises equivalents to
avoid stalling the Node.js event loop during credential operations.
2026-03-04 12:25:05 +01:00

16 lines
514 B
TypeScript

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);
}