From 80f3a4ccc1caf8bae465e9442293f5c2957d4d20 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 18 May 2026 14:23:02 +0100 Subject: [PATCH] Preserve repo Face identity metadata --- packages/core/src/repo-face-initializer.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/core/src/repo-face-initializer.ts b/packages/core/src/repo-face-initializer.ts index 75df5b0..f685a26 100644 --- a/packages/core/src/repo-face-initializer.ts +++ b/packages/core/src/repo-face-initializer.ts @@ -174,10 +174,12 @@ async function writeRepoFaceIdentity( repoPath: string, identityPath: string, ): Promise { + const existing = await readExistingIdentity(identityPath); await writeFile( identityPath, `${JSON.stringify( { + ...existing, schemaVersion: "voidbot.repo_face_identity.v0", identityId: identity.id, repoName: identity.repoName, @@ -194,6 +196,17 @@ async function writeRepoFaceIdentity( ); } +async function readExistingIdentity(identityPath: string): Promise> { + try { + const parsed = JSON.parse(stripLeadingBom(await readFile(identityPath, "utf8"))) as unknown; + return parsed && typeof parsed === "object" && !Array.isArray(parsed) + ? parsed as Record + : {}; + } catch { + return {}; + } +} + async function writeReadmeIfMissing(path: string, content: string): Promise { if (existsSync(path)) { return;