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 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,21 @@ export async function run(args: string[]): Promise<void> {
|
|||||||
|
|
||||||
fs.mkdirSync(configDir, { recursive: true });
|
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 allowedRoots = 0;
|
||||||
let nonMainReadOnly = 'true';
|
let nonMainReadOnly = 'true';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user