feat: auto-strip UTF-8 BOM when reading local files in CLI (#8911)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-04-22 15:50:47 +00:00
committed by GitHub
co-authored by Claude Opus 4.5
parent dc896737ac
commit 99bc96d0b2
22 changed files with 204 additions and 87 deletions
+4 -3
View File
@@ -1,4 +1,5 @@
import { readFile, writeFile, open as fsOpen } from "node:fs/promises";
import { writeFile, open as fsOpen } from "node:fs/promises";
import { readTextFile } from "../../utils/utils.ts";
import process from "node:process";
import { GlobalOptions } from "../../types.ts";
import {
@@ -31,7 +32,7 @@ export async function allWorkspaces(
): Promise<Workspace[]> {
try {
const file = await getWorkspaceConfigFilePath(configDirOverride);
const txt = await readFile(file, "utf-8");
const txt = await readTextFile(file);
return txt
.split("\n")
.map((line) => {
@@ -55,7 +56,7 @@ async function getActiveWorkspaceName(
}
try {
const file = await getActiveWorkspaceConfigFilePath(opts?.configDir);
return await readFile(file, "utf-8");
return await readTextFile(file);
} catch {
return undefined;
}