fix(cli): lazy settings fetch and full device erase

Download settings only for --show or when applying edits; skip upload
when unchanged; erase entire device root including settings.json.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-16 21:14:54 +12:00
parent 580fd11aca
commit ccc215acbd
3 changed files with 108 additions and 58 deletions

View File

@@ -137,7 +137,8 @@ class DeviceConnection:
dirs_created = 0
for root, dirs, files in os.walk(local_dir):
# Calculate relative path from local_dir
# Never upload Python bytecode trees (MicroPython does not use them).
dirs[:] = [d for d in dirs if d != "__pycache__"]
rel_path = os.path.relpath(root, local_dir)
# Build remote path
@@ -156,8 +157,10 @@ class DeviceConnection:
self.transport.fs_mkdir(remote_base)
dirs_created += 1
# Copy files
# Copy files (skip bytecode; __pycache__ dirs are pruned above)
for file in files:
if file.endswith((".pyc", ".pyo")):
continue
local_file = os.path.join(root, file)
# Handle root directory case properly
if remote_base == '/':