Skip to content

fix: handle missing config file gracefully#5

Open
njg7194 wants to merge 1 commit intoApexOpsStudio:mainfrom
njg7194:fix-missing-config
Open

fix: handle missing config file gracefully#5
njg7194 wants to merge 1 commit intoApexOpsStudio:mainfrom
njg7194:fix-missing-config

Conversation

@njg7194
Copy link

@njg7194 njg7194 commented Feb 1, 2026

Summary

This PR fixes the crash that occurs when ~/.config/task-cli/config.yaml is missing.

Changes

  • Added DEFAULT_CONFIG constant with sensible default values matching config.yaml.example
  • Modified load_config() to:
    • Check if config file exists before opening
    • Create parent directories if they don't exist
    • Write default config when file is missing
    • Inform user when default config is created
  • Added comprehensive tests for:
    • Creating default config when file is missing
    • Reading existing config files

Acceptance Criteria

  • No crash when config file is missing
  • Creates sensible default config
  • Tests added for missing config scenario
  • Documentation not needed (behavior is intuitive)

Testing

Run tests with:

pytest test_task.py -v

Closes #2

- Add DEFAULT_CONFIG constant with sensible defaults
- Create default config file when missing instead of crashing
- Create parent directories if they don't exist
- Inform user when default config is created
- Add comprehensive tests for missing and existing config scenarios

Closes ApexOpsStudio#2
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