Skip to content

refactor: extract validation and path helpers to utils module#31

Open
brutusworker-arch wants to merge 1 commit intoApexOpsStudio:mainfrom
brutusworker-arch:fix/issue-3
Open

refactor: extract validation and path helpers to utils module#31
brutusworker-arch wants to merge 1 commit intoApexOpsStudio:mainfrom
brutusworker-arch:fix/issue-3

Conversation

@brutusworker-arch
Copy link

Summary

  • Extract scattered validation logic and path helpers into a shared utils module
  • Eliminates code duplication across command files with no behavior changes

Changes

  • Create utils/__init__.py to mark the utils package
  • Create utils/paths.py with shared get_tasks_file() helper (previously duplicated in all three command files)
  • Create utils/validation.py with validate_description(), validate_task_file(), and validate_task_id() (previously scattered across commands/add.py, commands/list.py, commands/done.py)
  • Update commands/add.py to import from utils.paths and utils.validation
  • Update commands/list.py to import from utils.validation
  • Update commands/done.py to import from utils.paths and utils.validation
  • Update test_task.py to import validators from utils.validation

Testing

  • python -m pytest test_task.py — all existing tests pass with no modifications to test logic
  • Pure refactor: all function signatures, return types, and behaviors are preserved exactly

Closes #3


Closes #3

Built by brutusworker-arch

@brutusworker-arch brutusworker-arch marked this pull request as ready for review March 20, 2026 12:34
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.

Refactor: Extract validation to utils module

1 participant