From 4ae9785a61132d3a1ff70edaec964870dfadfadb Mon Sep 17 00:00:00 2001 From: gavrielc Date: Thu, 16 Apr 2026 14:14:25 +0300 Subject: [PATCH] fix(setup): move OpenClaw detection into environment step Avoids running `ls -d ~/.openclaw` as a separate Bash command which triggers permission prompts for reading outside the project directory. The environment step now reports OPENCLAW_PATH in its status block. Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/skills/setup/SKILL.md | 8 +------- setup/environment.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.claude/skills/setup/SKILL.md b/.claude/skills/setup/SKILL.md index a91378eca..a133f868b 100644 --- a/.claude/skills/setup/SKILL.md +++ b/.claude/skills/setup/SKILL.md @@ -63,13 +63,7 @@ Run `npx tsx setup/index.ts --step environment` and parse the status block. ### OpenClaw Migration Detection -Check for an existing OpenClaw installation: - -```bash -ls -d ~/.openclaw 2>/dev/null || ls -d ~/.clawdbot 2>/dev/null -``` - -If a directory is found, AskUserQuestion: +If OPENCLAW_PATH is not `none` from the environment check above, AskUserQuestion: 1. **Migrate now** — "Import identity, credentials, and settings from OpenClaw before continuing setup." 2. **Fresh start** — "Skip migration and set up NanoClaw from scratch." diff --git a/setup/environment.ts b/setup/environment.ts index 66f6fd0c7..27de9f4d9 100644 --- a/setup/environment.ts +++ b/setup/environment.ts @@ -66,6 +66,13 @@ export async function run(_args: string[]): Promise { } } + // Check for existing OpenClaw installation + const homedir = (await import('os')).homedir(); + const openClawPath = + fs.existsSync(path.join(homedir, '.openclaw')) ? path.join(homedir, '.openclaw') : + fs.existsSync(path.join(homedir, '.clawdbot')) ? path.join(homedir, '.clawdbot') : + null; + log.info( 'Environment check complete', { @@ -76,6 +83,7 @@ export async function run(_args: string[]): Promise { hasEnv, hasAuth, hasRegisteredGroups, + openClawPath, }, ); @@ -88,6 +96,7 @@ export async function run(_args: string[]): Promise { HAS_ENV: hasEnv, HAS_AUTH: hasAuth, HAS_REGISTERED_GROUPS: hasRegisteredGroups, + OPENCLAW_PATH: openClawPath ?? 'none', STATUS: 'success', LOG: 'logs/setup.log', });