feat: add --json output, fix config crash, extract validation utils#21
Open
flaggdavid-source wants to merge 2 commits intoApexOpsStudio:mainfrom
Open
feat: add --json output, fix config crash, extract validation utils#21flaggdavid-source wants to merge 2 commits intoApexOpsStudio:mainfrom
flaggdavid-source wants to merge 2 commits intoApexOpsStudio:mainfrom
Conversation
Three bounty fixes in one cohesive change: **Issue ApexOpsStudio#1 ($50) — Add --json output format** - Added --json flag to all subcommands (add, list, done) - list --json outputs valid JSON array of tasks - add/done --json output status confirmation objects **Issue ApexOpsStudio#2 ($75) — Fix crash when config file missing** - load_config() now creates default config if missing instead of crashing - Default config matches config.yaml.example values - Parent directories created automatically **Issue ApexOpsStudio#3 ($100) — Extract validation to utils module** - Created commands/utils.py with shared functions: validate_description(), validate_task_id(), get_tasks_file(), load_tasks(), save_tasks() - Removed duplicated get_tasks_file() from all command modules - Removed scattered validation functions from individual commands - All commands now import from utils Tests: 8 tests covering validation, config creation, JSON output, and save/load round-trips. All passing. Fixes ApexOpsStudio#1, Fixes ApexOpsStudio#2, Fixes ApexOpsStudio#3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1, Fixes #2, Fixes #3
Three bounty issues resolved in one cohesive PR since the refactor (#3) is a dependency for clean implementations of the other two.
Changes
Issue #1 ($50) — Add
--jsonoutput format--jsonflag added to all subcommands (add,list,done)list --jsonoutputs valid JSON array of tasksadd --jsonanddone --jsonoutput status confirmation objectsIssue #2 ($75) — Fix crash when config file missing
load_config()now creates default config if~/.config/task-cli/config.yamlis missingconfig.yaml.examplemkdir(parents=True)Issue #3 ($100) — Extract validation to utils module
commands/utils.pywith shared functions:validate_description(),validate_task_id(),get_tasks_file(),load_tasks(),save_tasks()get_tasks_file()fromadd.py,list.py,done.pycommands.utils.gitignorefor__pycache__/Testing
8 tests, all passing:
Demo