Skip to content

refactor: Extract validation and path helpers to utils module#15

Open
V1ki wants to merge 1 commit intoApexOpsStudio:mainfrom
V1ki:refactor/extract-validation-utils
Open

refactor: Extract validation and path helpers to utils module#15
V1ki wants to merge 1 commit intoApexOpsStudio:mainfrom
V1ki:refactor/extract-validation-utils

Conversation

@V1ki
Copy link

@V1ki V1ki commented Feb 27, 2026

Summary

Closes #3 — all validation logic and shared path helpers have been moved out of individual command files and into a new utils/ package.

Changes

New files

File Purpose
utils/__init__.py Package marker
utils/validation.py validate_description(), validate_task_file(), validate_task_id()
utils/paths.py get_tasks_file() — single source of truth for the storage path

Updated files

File Change
commands/add.py Removed local validate_description() + get_tasks_file(); import from utils
commands/list.py Removed local validate_task_file() + get_tasks_file(); import from utils
commands/done.py Removed local validate_task_id() + get_tasks_file(); import from utils
test_task.py Updated imports to pull validate_description / validate_task_id from utils.validation

Acceptance Criteria

  • All validation logic in utils/validation.py
  • All path helpers in utils/paths.py
  • All commands updated to use shared utilities
  • Tests still pass (no behavior changes)
  • No duplicate validation code in command files

Test run

2 passed in 0.00s

- Create utils/validation.py with validate_description(), validate_task_file(), validate_task_id()
- Create utils/paths.py with shared get_tasks_file() helper
- Create utils/__init__.py
- Update commands/add.py, commands/list.py, commands/done.py to import from utils
- Update test_task.py imports to use utils.validation directly
- No behavior changes; all existing tests pass

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