fix(cli): drop function-local import yaml shadowing module global in up (#916)

`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.
This commit is contained in:
Musa 2026-04-24 16:18:11 -07:00 committed by GitHub
parent 473ec70b5c
commit 92f82a9c68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)