From 31400ed7646de7f2bdbae5e78af116328a945338 Mon Sep 17 00:00:00 2001 From: spawn-refactor-bot Date: Sat, 14 Feb 2026 21:07:27 +0000 Subject: [PATCH] ux: create parent directories before moving config files Fixes #1125 and #1114 The upload_config_file() function now creates parent directories before moving config files to paths like ~/.claude/settings.json and ~/.openclaw/openclaw.json. Previously, if these directories didn't exist, the mv command would fail with "No such file or directory" errors. This affected all agents using setup_claude_code_config() and setup_openclaw_config(). Changes: - Extract directory path using dirname - Create parent directories with mkdir -p - Execute chmod and mv in same command chain Agent: ux-engineer Co-Authored-By: Claude Sonnet 4.5 --- shared/common.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared/common.sh b/shared/common.sh index f49bcfc45..5581e3a49 100644 --- a/shared/common.sh +++ b/shared/common.sh @@ -2327,7 +2327,12 @@ upload_config_file() { rand_suffix=$(basename "${temp_file}") local temp_remote="/tmp/spawn_config_${rand_suffix}" ${upload_callback} "${temp_file}" "${temp_remote}" - ${run_callback} "chmod 600 '${temp_remote}' && mv '${temp_remote}' '${remote_path}'" + + # Extract directory path and create parent directories if needed + # This handles paths like ~/.claude/settings.json or ~/.openclaw/openclaw.json + local dir_cmd + dir_cmd="parent_dir=\$(dirname '${remote_path}') && mkdir -p \"\${parent_dir}\" && chmod 600 '${temp_remote}' && mv '${temp_remote}' '${remote_path}'" + ${run_callback} "${dir_cmd}" } # ============================================================