Cross-platform

This commit is contained in:
bl-ue 2026-02-03 21:38:43 -07:00 committed by Mike
parent a911359efb
commit 6bf1af312d

View File

@ -21,8 +21,17 @@ if (!ANTHROPIC_API_KEY) {
process.exit(1);
}
const readFileSync = (file) => readFileSyncOrig(file, 'utf-8').replace(/\r\n/g, "\n");
const writeFileSync = (file, content) => writeFileSyncOrig(file, content.replace(/\n/g, "\r\n"));
const isWindows = process.platform === 'win32';
const readFileSync = (file) => {
const content = readFileSyncOrig(file, 'utf-8');
return isWindows ? content.replace(/\r\n/g, "\n") : content;
};
const writeFileSync = (file, content) => {
const output = isWindows ? content.replace(/\n/g, "\r\n") : content;
writeFileSyncOrig(file, output);
};
/**
* Count tokens using Anthropic's token counting API