Expose task scheduled / deadline through the CLI and update list_tasks MCP description#163
Merged
Merged
Conversation
…mmands and surface the dates in task list and the MCP list_tasks description Backend, API, MCP add_task/update_task, and the React UI already wrote these fields; the CLI was the missing seam so neither a shell user nor a script could set or change a snooze / deadline from the terminal. Three small wiring changes: - task add gains --scheduled / --deadline options, both accepting YYYY-MM-DD or omission for no value. - task update gains the same two options. The empty-string pattern from the rest of update_task still applies: '' clears. - _format_task_line appends scheduled:DATE / deadline:DATE segments when present so the dates show up in plain task list output without forcing --json. - list_tasks MCP description now mentions both fields so the advisor knows they are part of the returned shape (the data already crossed the wire; this just lights it up in the schema description).
… form so the typo can't sneak in A snoozed-past-its-deadline task is incoherent: the deadline badge would fire before the snooze even surfaces. Almost certainly a typo, but the four layers (backend, API, CLI, frontend) all accepted any combination of dates without checking. API: TaskCreate and TaskUpdate both gain a model_validator that rejects with 422 when both fields are present in the same payload AND deadline < scheduled. Lex compare on YYYY-MM-DD agrees with chronological order, so a plain string compare is enough. The PATCH check only catches the 'user sent both at once' case; sending one that breaks the invariant against the stored other is not validated server-side (the frontend has the merged shape and gates that locally). Frontend: TaskEditForm computes datesOutOfOrder from the two edit-state strings and shows a red inline message plus disables the Save button when the invariant is violated. Cmd+Enter and the Save click both short-circuit through a handleSave gate so accidental commits are impossible from the form. i18n key added in all four locales (en/de/es/ru). Tests: three new API cases in TestKanban -- create rejects, same-day passes, update rejects -- and the existing 699 backend tests still pass.
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.
Discovered while doing the post-feature audit; expanded with the deadline-before-scheduled validation.
CLI + MCP coverage
Backend, API, MCP
add_task/update_task, and the React UI already wrote the newscheduled/deadlinefields; the CLI was the only seam that didn't, so neither a shell user nor a script could set or change a snooze or deadline from the terminal.kai task addgains--scheduled/--deadlineoptions (YYYY-MM-DDor omit).kai task updategains the same two options. Empty string clears._format_task_lineappendsscheduled:DATE/deadline:DATEsegments when present.list_tasksdescription now mentions both fields so the advisor's prompts know they're part of the returned shape.Reject deadline-before-scheduled
A snoozed-past-its-deadline task is incoherent — the deadline badge would fire before the snooze even surfaces. Four layers (backend, API, CLI, frontend) all accepted any combination of dates without checking.
TaskCreateandTaskUpdategain amodel_validatorthat returns 422 when both fields are present in the same payload ANDdeadline < scheduled. Lex compare onYYYY-MM-DDagrees with chronological order. ThePATCHcheck catches "user sent both at once"; sending one that breaks the invariant against the stored other is validated client-side (the frontend has the merged shape).TaskEditFormcomputesdatesOutOfOrderfrom the edit-state strings, shows a red inline message, and disables Save / Cmd+Enter when violated. i18n added in all four locales.Tests
Three new API cases in
TestKanban: create rejects invalid pair (422), same-day passes (201), update rejects invalid pair (422). Backend round-trip from #159 still passes. 702 tests pass overall; flake8 clean for new code.Smoke-tested locally end-to-end: