Skip to content

fix: gracefully handle missing config file (closes #2)#33

Open
DrGalio wants to merge 1 commit intoApexOpsStudio:mainfrom
DrGalio:fix/config-missing-crash
Open

fix: gracefully handle missing config file (closes #2)#33
DrGalio wants to merge 1 commit intoApexOpsStudio:mainfrom
DrGalio:fix/config-missing-crash

Conversation

@DrGalio
Copy link

@DrGalio DrGalio commented Mar 25, 2026

Summary

Fixes the crash when ~/.config/task-cli/config.yaml is missing by having load_config() create a sensible default config automatically.

Changes

  • task.py: load_config() now checks if the config file exists. If missing, it creates the config directory and writes a default config file matching config.yaml.example defaults.
  • test_task.py: Added two new tests:
    • test_load_config_creates_default_when_missing — verifies no crash and default file creation
    • test_load_config_reads_existing_file — verifies existing configs are still read correctly
  • .gitignore: Added __pycache__/ to keep the repo clean
  • README.md: Updated configuration docs to mention automatic default config creation

Testing

All tests pass:

test_task.py::test_validate_description PASSED
test_task.py::test_validate_task_id PASSED
test_task.py::test_load_config_creates_default_when_missing PASSED
test_task.py::test_load_config_reads_existing_file PASSED

Acceptance Criteria

  • No crash when config file is missing
  • Creates sensible default config
  • Tests added for missing config scenario
  • Documentation updated

Closes #2

- load_config() now creates a default config when ~/.config/task-cli/config.yaml is missing
- Default config includes sensible defaults matching config.yaml.example
- Config directory is created automatically with parents
- Added tests for both missing-config and existing-config scenarios
- Updated README to document automatic default config creation

All existing tests continue to pass.
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