Skip to content

fix: handle missing config file gracefully (#2) - #127

Open
ttntk wants to merge 2 commits into
ApexOpsStudio:mainfrom
ttntk:fix/missing-config-crash
Open

fix: handle missing config file gracefully (#2)#127
ttntk wants to merge 2 commits into
ApexOpsStudio:mainfrom
ttntk:fix/missing-config-crash

Conversation

@ttntk

@ttntk ttntk commented Jul 31, 2026

Copy link
Copy Markdown

What

Fixes #2

load_config() no longer crashes with FileNotFoundError when ~/.config/task-cli/config.yaml is missing. It creates a default config automatically on first run.

How

  • Added get_config_path() helper for testability
  • load_config() checks config_path.exists() first
  • If missing: creates parent dirs + writes DEFAULT_CONFIG
  • If present: reads existing content (unchanged behavior)
  • Added 4 pytest-style tests: missing file, existing file, nested dirs, no-crash

Testing

python -m pytest test_task.py -v
6 passed

All existing tests pass. No unrelated changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Crash when config file missing

1 participant