Add deadline command to change a goal's deadline (Vibe Kanban)#223
Add deadline command to change a goal's deadline (Vibe Kanban)#223
Conversation
Add `buzz deadline <goalslug> <time>` command that updates a goal's
deadline via the Beeminder API. Supports both 12-hour ("3:00 PM") and
24-hour ("15:00") time formats.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shows the current and new deadline and asks the user to confirm with [y/N] before making the API call. Supports --yes/-y flag to skip the prompt for scripting use cases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds a new Beeminder deadline feature: a public UpdateGoalDeadline API function, CLI subcommand Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
🚀 Pre-release Build ReadyTest builds are ready! Install directly using the # Install the pre-release
bin install https://github.com/PinePeakDigital/buzz/releases/tag/pr-223-latest buzz-pr-223# Run the pre-release
buzz-pr-223# Uninstall the pre-release
bin remove buzz-pr-223Direct Download LinksOr download binaries directly from the pre-release page:
|
There was a problem hiding this comment.
Pull request overview
Adds a new CLI command to update a Beeminder goal’s deadline time, wiring it into the buzz command dispatcher and implementing the corresponding Beeminder API call, with unit tests covering time parsing and the API update request.
Changes:
- Add
buzz deadline [--yes|-y] <goalslug> <time>command and help text. - Implement
parseTimeToDeadlineOffsetandhandleDeadlineCommandflow (fetch current goal → confirm → update). - Add
UpdateGoalDeadlineBeeminder API client method plus tests for parsing and request behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
main.go |
Adds the deadline command, parsing logic, and command handler; updates help/command list. |
main_test.go |
Adds tests for parseTimeToDeadlineOffset. |
beeminder.go |
Adds UpdateGoalDeadline (PUT) API call. |
beeminder_test.go |
Adds tests for UpdateGoalDeadline request/response handling. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@beeminder.go`:
- Around line 645-649: UpdateGoalDeadline constructs the API path with the raw
goalSlug which can break for spaces/special characters; mirror FetchGoal by
applying url.PathEscape to goalSlug before building apiURL so the PUT path is
properly escaped (update the UpdateGoalDeadline function to call
url.PathEscape(goalSlug) when formatting apiURL).
In `@main.go`:
- Around line 1206-1236: The parseTimeToDeadlineOffset function currently uses
if hour > 6 to decide wrapping, which leaves 6:01–6:59 AM as positive offsets
exceeding Beeminder's +21600 limit; update the wrap condition in
parseTimeToDeadlineOffset to treat any time after 6:00 AM as wrapping (i.e., if
hour > 6 OR hour == 6 and minute > 0) so offsets for 6:01–6:59 become negative
via offset = offset - 24*3600; keep 6:00 AM (hour==6 && minute==0) as the
maximum positive 21600.
Matches the pattern used by FetchGoal and FetchGoalWithDatapoints to ensure safe URL path construction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ToUpper already normalizes lowercase input like "3:00 am" to "3:00 AM", making the separate ToLower parse attempt unnecessary. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Times between 6:01-6:59 AM now correctly wrap to negative offsets to stay within the Beeminder API range of -61200 to 21600. Also adds a reference to the forum post confirming the undocumented API support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Beeminder does not allow deadlines between 6:01 AM and 6:59 AM. Allowed ranges are 12:00 AM-6:00 AM (nightowl) and 7:00 AM-11:59 PM (earlybird). Added reference to the Beeminder help article. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@beeminder.go`:
- Around line 672-675: The non-200 response handling in the unnamed block
discards the io.ReadAll error which can mask failures; update this block to read
resp.Body into body and check the error from io.ReadAll, returning a formatted
error that includes both the HTTP status and either the body content (if read
succeeded) or the read error (if read failed), mirroring the pattern used in
CreateCharge and FetchGoalRawJSON so callers receive clear, explicit failure
information.
In `@main.go`:
- Around line 1247-1252: The deadline command's flag parsing uses deadlineFlags
:= flag.NewFlagSet(...) and calls deadlineFlags.Parse(os.Args[2:]) but doesn't
handle flag.ErrHelp or return the same exit code as other commands; update the
Parse error handling to mirror next/add/view: if err == flag.ErrHelp then print
deadlineFlags.Usage() and exit 0, else print the flag error (or usage) and exit
2. Ensure you reference deadlineFlags.Parse, flag.ErrHelp, and the yes/yesShort
flags so the code shows usage on -h and returns exit code 2 for parse errors.
Align with CreateCharge pattern by explicitly checking the read error when reading the response body for non-200 status codes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mirror the pattern from next/add/view commands: show usage on -h/--help and exit with code 2 on flag parse errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Adds a new
buzz deadlineCLI command that allows users to change a Beeminder goal's deadline time directly from the terminal.What changes were made
beeminder.go):UpdateGoalDeadline()sends a PUT request to the Beeminder API to update a goal'sdeadlinefield (seconds from midnight offset)main.go):parseTimeToDeadlineOffset()converts human-readable time strings into Beeminder's deadline offset format, supporting both 12-hour (3:00 PM) and 24-hour (15:00) formatsmain.go):handleDeadlineCommand()with confirmation prompt that shows the current and new deadline before making the change--yes/-yflag to skip the confirmation prompt for scripting use casesWhy
Users need a quick way to adjust goal deadlines without leaving the terminal or navigating the Beeminder web UI. This is especially useful when managing multiple goals or scripting deadline changes.
Usage
The command fetches the current goal, displays the change (
Change deadline for X from Y to Z? [y/N]), and only proceeds after user confirmation.This PR was written using Vibe Kanban
Summary by CodeRabbit
New Features
Tests
Documentation