From ff16e93713de67312ae029b8bfb6474d75554881 Mon Sep 17 00:00:00 2001 From: Akasha Date: Sun, 22 Mar 2026 16:53:42 -0400 Subject: [PATCH] fix: skip mount-allowlist write if file already exists /setup overwrote ~/.config/nanoclaw/mount-allowlist.json unconditionally, clobbering any user customizations made after initial setup. Now checks for the file first and skips with a 'skipped' status if it exists. Co-Authored-By: Claude Sonnet 4.6 --- setup/mounts.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/setup/mounts.ts b/setup/mounts.ts index eb2a5f6..a3377d3 100644 --- a/setup/mounts.ts +++ b/setup/mounts.ts @@ -37,6 +37,21 @@ export async function run(args: string[]): Promise { fs.mkdirSync(configDir, { recursive: true }); + if (fs.existsSync(configFile)) { + logger.info( + { configFile }, + 'Mount allowlist already exists — skipping (use --force to overwrite)', + ); + emitStatus('CONFIGURE_MOUNTS', { + PATH: configFile, + ALLOWED_ROOTS: 0, + NON_MAIN_READ_ONLY: 'unknown', + STATUS: 'skipped', + LOG: 'logs/setup.log', + }); + return; + } + let allowedRoots = 0; let nonMainReadOnly = 'true';