From c637df1ba99c4cac9edd4f222f71899f49bccfe7 Mon Sep 17 00:00:00 2001 From: Spherrrical Date: Fri, 24 Apr 2026 16:15:59 -0700 Subject: [PATCH] fix(cli): drop function-local `import yaml` shadowing module global in `up` `up()` had a redundant inline `import yaml` (line 444) even though `yaml` is already imported at the module top (line 9). Python's compile-time scope analysis turned `yaml` into a function-local for the entire body, which was harmless until #890 added `yaml.safe_dump(...)` earlier in the same function (in the synthesized-default-config branch). After #890, running `planoai up` in any directory without a config file crashes with: UnboundLocalError: cannot access local variable 'yaml' where it is not associated with a value File "cli/planoai/main.py", line 388, in up yaml.safe_dump(cfg_dict, fh, sort_keys=False) Removing the redundant inline import lets the module-level `yaml` resolve normally on both code paths. --- cli/planoai/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/cli/planoai/main.py b/cli/planoai/main.py index 8e766cf8..ea43a1a8 100644 --- a/cli/planoai/main.py +++ b/cli/planoai/main.py @@ -441,8 +441,6 @@ def up( env = os.environ.copy() env.pop("PATH", None) - import yaml - with open(plano_config_file, "r") as f: plano_config = yaml.safe_load(f)