From fcf74acd430a955d792e68a151b47c2003c4a6c9 Mon Sep 17 00:00:00 2001 From: Joseph Hale Date: Thu, 19 Nov 2026 18:05:52 -0700 Subject: [PATCH 1/2] Page the overdue to-dos report in the CLI and its MCP server Basecamp answers the overdue to-dos report one page at a time since basecamp/bc3#14519. The reports overdue command showed the first page as if it were the whole report and counted only that page. It reads one page, says how many to-dos the whole report holds, and offers the next page while one remains. The MCP server's get_overdue_todos already answered next_page, but refused it as an unknown parameter. The SDK model it reads declares page, so the next page can be asked for. Bumps basecamp-sdk to v0.37.0, which takes a page on the overdue report (basecamp/basecamp-sdk#1100). The new go.sum changes the Nix vendorHash, so nix/package.nix carries the refreshed hash. https://app.basecamp.com/2914079/buckets/27/card_tables/cards/10512247737 https://app.basecamp.com/2914079/buckets/27/card_tables/cards/10516396199 --- .surface | 1 + go.mod | 2 +- go.sum | 4 +- internal/commands/reports.go | 56 ++++++++++---- internal/commands/reports_test.go | 75 +++++++++++++++++++ internal/mcpserver/model/PROVENANCE.json | 4 +- internal/mcpserver/model/openapi.json | 52 ++++++++++++- internal/mcpserver/server_test.go | 35 +++++++++ .../mcpserver/testdata/catalog_snapshot.txt | 2 +- internal/version/sdk-provenance.json | 6 +- nix/package.nix | 2 +- 11 files changed, 212 insertions(+), 27 deletions(-) diff --git a/.surface b/.surface index 5da6e8ecc..d507f51cd 100644 --- a/.surface +++ b/.surface @@ -15002,6 +15002,7 @@ FLAG basecamp reports overdue --markdown type=bool FLAG basecamp reports overdue --md type=bool FLAG basecamp reports overdue --no-hints type=bool FLAG basecamp reports overdue --no-stats type=bool +FLAG basecamp reports overdue --page type=int32 FLAG basecamp reports overdue --profile type=string FLAG basecamp reports overdue --project type=string FLAG basecamp reports overdue --quiet type=bool diff --git a/go.mod b/go.mod index 85171b8ca..6e352767f 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( charm.land/bubbles/v2 v2.2.1 charm.land/bubbletea/v2 v2.1.0 charm.land/lipgloss/v2 v2.0.6 - github.com/basecamp/basecamp-sdk/go v0.36.0 + github.com/basecamp/basecamp-sdk/go v0.37.0 github.com/basecamp/cli v0.2.2-0.20261023171439-c9bce8206df9 github.com/basecamp/mcp v0.0.0-20261118214004-663b2e5d2836 github.com/basecamp/surfguard/go v0.1.0 diff --git a/go.sum b/go.sum index 4684599ff..3b22deb74 100644 --- a/go.sum +++ b/go.sum @@ -89,8 +89,8 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/basecamp/actioncable-go v1.2.0 h1:t0MxlfMTcmaGXZ5ztgKRs7ZiY1MwXtBRwSSSAh1ofVg= github.com/basecamp/actioncable-go v1.2.0/go.mod h1:ezaV5z1GXQAsqyejqTs6wCFl2D8Wj+COLQkHc/kwoRs= -github.com/basecamp/basecamp-sdk/go v0.36.0 h1:mkAcJQlh+5Vz64OmpImSda/pfa/usWPJ6gDTuZYVaTI= -github.com/basecamp/basecamp-sdk/go v0.36.0/go.mod h1:ynVJME8mVV3UHMUMnzBgygTnMtadQFxz1iYg7fqwUeM= +github.com/basecamp/basecamp-sdk/go v0.37.0 h1:/Tv7GALbwmj0/gk8y2kwAi9/OiiWEQlJcVDH9PfMHWM= +github.com/basecamp/basecamp-sdk/go v0.37.0/go.mod h1:ynVJME8mVV3UHMUMnzBgygTnMtadQFxz1iYg7fqwUeM= github.com/basecamp/cli v0.2.2-0.20261023171439-c9bce8206df9 h1:3NfGs+zx23Tp6cf+97+UewrJHlzZMLzmvEXOmOJyQAk= github.com/basecamp/cli v0.2.2-0.20261023171439-c9bce8206df9/go.mod h1:iTBTaWvsPEFIcZfkxQHEfISyJ6sZ7036K6bNx0RY3EE= github.com/basecamp/mcp v0.0.0-20261118214004-663b2e5d2836 h1:ND4te8b+HVFFrgcm7+n8P83MKKPqBpIyoJ63tT9liRU= diff --git a/internal/commands/reports.go b/internal/commands/reports.go index 59bc3f206..40d3390e2 100644 --- a/internal/commands/reports.go +++ b/internal/commands/reports.go @@ -178,10 +178,14 @@ Results can be grouped by project or date.`, } func newReportsOverdueCmd() *cobra.Command { - return &cobra.Command{ + var page int32 + + cmd := &cobra.Command{ Use: "overdue", Short: "View overdue todos grouped by lateness", - Long: `View all overdue todos grouped by how late they are. + Long: `View overdue todos grouped by how late they are, one page at a time, +most recently due first, so the longest-overdue todos are on the last +pages. --page reads a later page. Todos are grouped into categories: - Under a week late @@ -195,7 +199,7 @@ Todos are grouped into categories: return err } - result, err := app.Account().Reports().OverdueTodos(cmd.Context()) + result, err := app.Account().Reports().OverdueTodos(cmd.Context(), page) if err != nil { return convertSDKError(err) } @@ -207,7 +211,11 @@ Todos are grouped into categories: len(result.OverThreeMonthsLate) var summary strings.Builder - fmt.Fprintf(&summary, "%d overdue todos", total) + if result.Meta.TotalCount > total { + fmt.Fprintf(&summary, "%d of %d overdue todos", total, result.Meta.TotalCount) + } else { + fmt.Fprintf(&summary, "%d overdue todos", total) + } if total > 0 { var parts []string if n := len(result.UnderAWeekLate); n > 0 { @@ -236,21 +244,37 @@ Todos are grouped into categories: return app.OK(result, output.WithSummary(summary.String()), - output.WithBreadcrumbs( - output.Breadcrumb{ - Action: "assigned", - Cmd: "basecamp reports assigned", - Description: "View your assigned todos", - }, - output.Breadcrumb{ - Action: "schedule", - Cmd: "basecamp reports schedule", - Description: "View upcoming schedule", - }, - ), + output.WithBreadcrumbs(overdueBreadcrumbs(page, result.Meta.Truncated)...), ) }, } + + cmd.Flags().Int32Var(&page, "page", 0, "Page of the report (default: first page)") + + return cmd +} + +func overdueBreadcrumbs(page int32, more bool) []output.Breadcrumb { + breadcrumbs := []output.Breadcrumb{ + { + Action: "assigned", + Cmd: "basecamp reports assigned", + Description: "View your assigned todos", + }, + { + Action: "schedule", + Cmd: "basecamp reports schedule", + Description: "View upcoming schedule", + }, + } + if more { + breadcrumbs = append(breadcrumbs, output.Breadcrumb{ + Action: "next", + Cmd: fmt.Sprintf("basecamp reports overdue --page %d", max(page, 1)+1), + Description: "Next page of overdue todos", + }) + } + return breadcrumbs } func resolveReportsScheduleWindow(startDate, endDate string, now time.Time) (string, string) { diff --git a/internal/commands/reports_test.go b/internal/commands/reports_test.go index eb30b3924..ef7c780a8 100644 --- a/internal/commands/reports_test.go +++ b/internal/commands/reports_test.go @@ -1,10 +1,16 @@ package commands import ( + "bytes" + "encoding/json" + "net/http" "testing" "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/basecamp/basecamp-cli/internal/output" ) func TestResolveReportsScheduleWindow(t *testing.T) { @@ -51,3 +57,72 @@ func TestResolveReportsScheduleWindow(t *testing.T) { }) } } + +const overdueReportPage = `{"under_a_week_late":[{"id":1,"content":"One"}],"over_a_week_late":[],` + + `"over_a_month_late":[{"id":2,"content":"Two"}],"over_three_months_late":[]}` + +type overdueReportEnvelope struct { + Summary string `json:"summary"` + Breadcrumbs []struct { + Action string `json:"action"` + Cmd string `json:"cmd"` + } `json:"breadcrumbs"` +} + +func runReportsOverdue(t *testing.T, header http.Header, args ...string) (overdueReportEnvelope, recordedCall) { + t.Helper() + app, transport := setupRecordingTestApp(t, stubRoute{ + method: http.MethodGet, + path: "/99999/reports/todos/overdue.json", + status: http.StatusOK, + body: overdueReportPage, + header: header, + }) + buf := &bytes.Buffer{} + app.Output = output.New(output.Options{Format: output.FormatJSON, Writer: buf}) + app.Flags.Hints = true + + require.NoError(t, executeRecordingCommand(NewReportsCmd(), app, append([]string{"overdue"}, args...)...)) + + var envelope overdueReportEnvelope + require.NoError(t, json.Unmarshal(buf.Bytes(), &envelope)) + return envelope, transport.last(t) +} + +func overdueBreadcrumb(envelope overdueReportEnvelope, action string) string { + for _, bc := range envelope.Breadcrumbs { + if bc.Action == action { + return bc.Cmd + } + } + return "" +} + +func TestReportsOverduePageWithMoreNamesTheNextPage(t *testing.T) { + envelope, request := runReportsOverdue(t, http.Header{ + "Link": []string{`; rel="next"`}, + "X-Total-Count": []string{"21"}, + }) + + assert.Empty(t, request.Query) + assert.Equal(t, "2 of 21 overdue todos (1 <1 week, 1 >1 month)", envelope.Summary) + assert.Equal(t, "basecamp reports overdue --page 2", overdueBreadcrumb(envelope, "next")) +} + +func TestReportsOverdueLaterPageNamesThePageAfterIt(t *testing.T) { + envelope, request := runReportsOverdue(t, http.Header{ + "Link": []string{`; rel="next"`}, + "X-Total-Count": []string{"95"}, + }, "--page", "2") + + assert.Equal(t, "page=2", request.Query) + assert.Equal(t, "2 of 95 overdue todos (1 <1 week, 1 >1 month)", envelope.Summary) + assert.Equal(t, "basecamp reports overdue --page 3", overdueBreadcrumb(envelope, "next")) +} + +func TestReportsOverdueWholeReportOnOnePageNamesNoNextPage(t *testing.T) { + envelope, _ := runReportsOverdue(t, nil) + + assert.Equal(t, "2 overdue todos (1 <1 week, 1 >1 month)", envelope.Summary) + assert.Empty(t, overdueBreadcrumb(envelope, "next")) +} diff --git a/internal/mcpserver/model/PROVENANCE.json b/internal/mcpserver/model/PROVENANCE.json index 5074e4ed5..1d65c6c3b 100644 --- a/internal/mcpserver/model/PROVENANCE.json +++ b/internal/mcpserver/model/PROVENANCE.json @@ -1,7 +1,7 @@ { "source": "github.com/basecamp/basecamp-sdk", - "commit": "867cdd87d0fbbefbad9fd99648002496c909c834", - "ref": "go/v0.36.0", + "commit": "da4686b0d61a088a86d203d038d8b53637e8efe4", + "ref": "go/v0.37.0", "files": ["behavior-model.json", "openapi.json"], "synced_by": "scripts/sync-mcp-model.sh", "patches": "binary-upload operations dropped because the toolkit refuses their non-JSON bodies (EXCLUDED_OPERATIONS) and the stream-ticket mint dropped by policy (POLICY_EXCLUDED_OPERATIONS); no tag patches applied (PATCHED_TAGS is empty — the export tags every operation) — see the sync script" diff --git a/internal/mcpserver/model/openapi.json b/internal/mcpserver/model/openapi.json index d13621004..996c2f77a 100644 --- a/internal/mcpserver/model/openapi.json +++ b/internal/mcpserver/model/openapi.json @@ -23089,7 +23089,7 @@ }, "/{accountId}/reports/todos/overdue.json": { "get": { - "description": "Get overdue todos grouped by lateness", + "description": "Get one page of overdue todos grouped by lateness, latest first.\n\nPages hold 15, 30, 50, then 100 to-dos, and each page fills the same four\ngroups with only its own to-dos, so a group can continue onto the next\npage. A `Link: rel=\"next\"` header names the next page and `X-Total-Count`\nthe total. This operation is not auto-paginated in any SDK: the response\nis an object of four arrays, which no pagination key can name.", "operationId": "GetOverdueTodos", "parameters": [ { @@ -23102,6 +23102,16 @@ "description": "Basecamp account ID (numeric string)" }, "required": true + }, + { + "name": "page", + "in": "query", + "description": "Page number for paginating through results. Defaults to 1. This\noperation is not auto-paginated in any SDK, so a page is returned as\nasked for and later pages are not followed.", + "schema": { + "type": "integer", + "description": "Page number for paginating through results. Defaults to 1. This\noperation is not auto-paginated in any SDK, so a page is returned as\nasked for and later pages are not followed.", + "format": "int32" + } } ], "responses": { @@ -33814,6 +33824,26 @@ }, "description": { "type": "string" + }, + "color": { + "type": "string", + "description": "The project's color, used for it on calendars: white, red, orange,\nyellow, green, blue, aqua, purple, gray, pink or brown. Omitted, Basecamp\nderives one from the project's name. Basecamp answers a value outside the enum\nwith a server error, not a validation error." + }, + "purpose": { + "type": "string", + "description": "What kind of project it is: `topic` (a regular project, the default),\n`team`, or `company_hq` (the account's Company HQ, at most one per\naccount; a second answers 422). BC3's enum also has `guide`, which marks\na project as a sample nobody can edit afterwards, so it isn't offered." + }, + "admissions": { + "type": "string", + "description": "invite|employee|team" + }, + "timesheet_enabled": { + "type": "boolean", + "description": "Turn on the project's timesheet. Basecamp ignores this when the caller\ncan't use timesheets (the account lacks them, or the caller is a client)." + }, + "wallpaper_mode": { + "type": "string", + "description": "How a wallpaper uploaded later is laid out. UpdateProjectWallpaper\nuploads one." } }, "required": [ @@ -38500,6 +38530,14 @@ "start_date": { "type": "string", "description": "Date the new project starts on. Template dates are relative to the start\nof the template's first week, and template weeks start on a Sunday, so\nthe project's dates are anchored to the Sunday on or before this date.\nOmitted, they are anchored to the week in which the construction is\nprocessed." + }, + "admissions": { + "type": "string", + "description": "Who can join the new project: invite, employee or team. Basecamp stores this with the construction\nand applies it when the project is built, so a value outside the enum\nisn't refused up front: the construction fails." + }, + "timesheet_enabled": { + "type": "boolean", + "description": "Turn on the new project's timesheet. Basecamp ignores this when the\ncaller can't use timesheets (the account lacks them, or the caller is a\nclient)." } }, "required": [ @@ -42270,6 +42308,18 @@ "wallpaper_mode": { "type": "string", "description": "How the project's wallpaper is laid out. Changes only the layout of a\nwallpaper already attached; UpdateProjectWallpaper uploads one." + }, + "color": { + "type": "string", + "description": "The project's color, used for it on calendars: white, red, orange,\nyellow, green, blue, aqua, purple, gray, pink or brown. An empty string clears\nit, and Basecamp derives one from the project's name again. A value\noutside the enum answers a server error, not a validation error. The\n`color` a project read returns is something else: the caller's own color\nfor the project on their home screen, null unless they set one." + }, + "purpose": { + "type": "string", + "description": "What kind of project it is: `topic` (a regular project), `team`, or\n`company_hq` (the account's Company HQ). Changing a `topic` to anything\nelse deletes the project's start and end dates. An account has at most\none `company_hq`; asking for a second answers 422. BC3's enum also has\n`guide`, which marks a project as a sample nobody can edit afterwards,\nso it isn't offered." + }, + "timesheet_enabled": { + "type": "boolean", + "description": "Turn the project's timesheet on or off. Basecamp ignores this when the\ncaller can't use timesheets (the account lacks them, or the caller is a\nclient)." } }, "required": [ diff --git a/internal/mcpserver/server_test.go b/internal/mcpserver/server_test.go index 7049f2256..012264a71 100644 --- a/internal/mcpserver/server_test.go +++ b/internal/mcpserver/server_test.go @@ -238,6 +238,41 @@ func TestServerAcceptsSynthesizedPageParam(t *testing.T) { assert.JSONEq(t, `[{"id":2}]`, text) } +func TestServerPagesTheOverdueReport(t *testing.T) { + upstream := newUpstream(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + require.Equal(t, "/999/reports/todos/overdue.json", r.URL.Path) + w.Header().Set("Content-Type", "application/json") + if r.URL.Query().Get("page") == "2" { + _, _ = w.Write([]byte(`{"under_a_week_late":[],"over_a_week_late":[{"id":2}],"over_a_month_late":[],"over_three_months_late":[]}`)) + } else { + w.Header().Set("Link", `; rel="next"`) + _, _ = w.Write([]byte(`{"under_a_week_late":[{"id":1}],"over_a_week_late":[],"over_a_month_late":[],"over_three_months_late":[]}`)) + } + })) + + srv, err := New(newTestAPI(upstream), Config{}) + require.NoError(t, err) + session := mcptest.Connect(t, srv.BuildMCPServer(slog.New(slog.DiscardHandler))) + + text, isError := mcptest.CallText(t, session, "basecamp_reports", map[string]any{ + "action": "get_overdue_todos", + "params": map[string]any{}, + }) + require.False(t, isError, "get_overdue_todos failed: %s", text) + var wrapped struct { + NextPage int `json:"next_page"` + } + require.NoError(t, json.Unmarshal([]byte(text), &wrapped)) + require.Equal(t, 2, wrapped.NextPage) + + text, isError = mcptest.CallText(t, session, "basecamp_reports", map[string]any{ + "action": "get_overdue_todos", + "params": map[string]any{"page": wrapped.NextPage}, + }) + require.False(t, isError, "passing next_page back must dispatch, got: %s", text) + assert.JSONEq(t, `{"under_a_week_late":[],"over_a_week_late":[{"id":2}],"over_a_month_late":[],"over_three_months_late":[]}`, text) +} + func TestServerSurfacesAPIErrorsInBand(t *testing.T) { upstream := newUpstream(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.Error(w, `{"error":"Record not found"}`, http.StatusNotFound) diff --git a/internal/mcpserver/testdata/catalog_snapshot.txt b/internal/mcpserver/testdata/catalog_snapshot.txt index c79868ad6..7ad1190d1 100644 --- a/internal/mcpserver/testdata/catalog_snapshot.txt +++ b/internal/mcpserver/testdata/catalog_snapshot.txt @@ -313,7 +313,7 @@ Call {"action": "describe", "params": {"action": "NAME"}} for an action's full p ACTIONS (RO = read-only): - get_assigned_todos (RO): Get todos assigned to a specific person -- get_overdue_todos (RO): Get overdue todos grouped by lateness +- get_overdue_todos (RO): Get one page of overdue todos grouped by lateness, latest first - get_person_progress (RO, paginated): Get a person's activity timeline - get_progress_report (RO, paginated): Get account-wide activity feed (progress report) - get_project_timeline (RO, paginated): Get project timeline diff --git a/internal/version/sdk-provenance.json b/internal/version/sdk-provenance.json index e60cb9597..eb41cfd29 100644 --- a/internal/version/sdk-provenance.json +++ b/internal/version/sdk-provenance.json @@ -1,9 +1,9 @@ { "sdk": { "module": "github.com/basecamp/basecamp-sdk/go", - "version": "v0.36.0", - "revision": "867cdd87d0fb", - "updated_at": "2026-11-12T18:43:30Z" + "version": "v0.37.0", + "revision": "da4686b0d61a", + "updated_at": "2026-11-19T01:35:10Z" }, "api": { "repo": "basecamp/bc3", diff --git a/nix/package.nix b/nix/package.nix index 4b6c9d3b6..fc063406c 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -8,7 +8,7 @@ buildGoModule.override { go = go_1_26; } (finalAttrs: { src = lib.cleanSource ./..; # To update: set to lib.fakeHash, run `nix build`, use the hash from the error. - vendorHash = "sha256-YmTf0U8ORBITbKfQLkCBakOlbMmzaK7XukmYu/NteI8="; + vendorHash = "sha256-TNI7wjyV6pZVOjzHu5g3qHIXmtXGAeywecM5pts/FRY="; subPackages = [ "cmd/basecamp" ]; From 452d856679e05ba7ead056d6f856d3d0cdfe5dc5 Mon Sep 17 00:00:00 2001 From: Joseph Hale Date: Thu, 19 Nov 2026 18:18:35 -0700 Subject: [PATCH 2/2] Read every page of the five account-wide lists Basecamp now pages Basecamp answers the overdue to-dos and cards, completed assignments, the timesheet report and the assigned to-dos report 50 records a page (basecamp/bc3#14537), where each used to come whole. Once that ships, basecamp-sdk v0.37.0 would hand those commands the first page as if it were the whole list. They now read every page, so a list longer than 50 is still complete. Pins basecamp-sdk to basecamp/basecamp-sdk#1102, which follows these pages, until a release carries it, and re-syncs the MCP server's model from it, so its five matching actions take a page. The new go.sum changes the Nix vendorHash. https://app.basecamp.com/2914079/buckets/27/card_tables/cards/10516396199 --- ACCOUNT-WIDE-LISTINGS.md | 9 +- go.mod | 2 +- go.sum | 4 +- internal/commands/assignments.go | 3 +- internal/commands/cards.go | 24 +++-- internal/commands/cards_test.go | 12 +-- internal/commands/paged_lists_test.go | 81 +++++++++++++++ internal/commands/recording_test.go | 45 +++++++++ internal/commands/timesheet.go | 3 +- internal/commands/todos.go | 17 ++-- internal/commands/todos_test.go | 8 +- internal/mcpserver/catalog_test.go | 2 +- internal/mcpserver/model/PROVENANCE.json | 4 +- internal/mcpserver/model/behavior-model.json | 20 ++++ internal/mcpserver/model/openapi.json | 98 +++++++++++++++++-- .../mcpserver/testdata/catalog_snapshot.txt | 10 +- internal/version/sdk-provenance.json | 6 +- nix/package.nix | 2 +- 18 files changed, 294 insertions(+), 56 deletions(-) create mode 100644 internal/commands/paged_lists_test.go diff --git a/ACCOUNT-WIDE-LISTINGS.md b/ACCOUNT-WIDE-LISTINGS.md index e6ddaa8a1..4bf84258f 100644 --- a/ACCOUNT-WIDE-LISTINGS.md +++ b/ACCOUNT-WIDE-LISTINGS.md @@ -51,8 +51,8 @@ under project rules before the account-wide branch is reached is a defect: the paginated aggregates accept **any positive page**, while several project-scoped commands only permit page 1. -Conversely `--page` must return `ErrUsage` against the **unpaginated** overdue -endpoints, which take no page argument at all. +Conversely `--page` must return `ErrUsage` against the overdue listings, which +the CLI reads whole, following every page, so there is no page to address. ### I2 — Scope precedence @@ -230,7 +230,7 @@ rows that differ for stated reasons. `--all` is how you ask for the account. | `checkins answers` | cap 100 | **changed** from "all pages" | | `forwards list` | cap 100 | **changed** from "all pages" | | `files list` | cap 100 | **changed** from "all pages" | -| `todos list --overdue` | cap 100 | unpaginated endpoint; accepts `--all`, rejects `--page` | +| `todos list --overdue` | cap 100 | read whole, every page followed; accepts `--all`, rejects `--page` | | `cards list --overdue` | cap 100 | **changed** from uncapped; same rules as above | | `bookmarks list` | cap 100 | personal feed — see below | | `drafts list` | cap 100 | personal feed; server caps the full listing at 250 | @@ -259,7 +259,8 @@ options struct does not honor a page number at all, so it takes `--limit` (a real SDK-side bound) and deliberately registers no `--page`. Under I3 a flag that cannot act on its value is worse than an absent one. -**The two overdue rows.** Both endpoints are unpaginated, so `--page` has +**The two overdue rows.** The CLI reads both listings whole, following every +page Basecamp sends (50 a page since basecamp/bc3#14537), so `--page` has nothing to address and stays an error. `--all` is a different question: it means "skip the cap", and since the complete array is already in hand it costs no extra request. Previously `todos --overdue` capped at 100 *and* rejected `--all`, diff --git a/go.mod b/go.mod index 6e352767f..982878654 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( charm.land/bubbles/v2 v2.2.1 charm.land/bubbletea/v2 v2.1.0 charm.land/lipgloss/v2 v2.0.6 - github.com/basecamp/basecamp-sdk/go v0.37.0 + github.com/basecamp/basecamp-sdk/go v0.37.1-0.20261120012501-1d0f5e04225d github.com/basecamp/cli v0.2.2-0.20261023171439-c9bce8206df9 github.com/basecamp/mcp v0.0.0-20261118214004-663b2e5d2836 github.com/basecamp/surfguard/go v0.1.0 diff --git a/go.sum b/go.sum index 3b22deb74..441f42fa8 100644 --- a/go.sum +++ b/go.sum @@ -89,8 +89,8 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/basecamp/actioncable-go v1.2.0 h1:t0MxlfMTcmaGXZ5ztgKRs7ZiY1MwXtBRwSSSAh1ofVg= github.com/basecamp/actioncable-go v1.2.0/go.mod h1:ezaV5z1GXQAsqyejqTs6wCFl2D8Wj+COLQkHc/kwoRs= -github.com/basecamp/basecamp-sdk/go v0.37.0 h1:/Tv7GALbwmj0/gk8y2kwAi9/OiiWEQlJcVDH9PfMHWM= -github.com/basecamp/basecamp-sdk/go v0.37.0/go.mod h1:ynVJME8mVV3UHMUMnzBgygTnMtadQFxz1iYg7fqwUeM= +github.com/basecamp/basecamp-sdk/go v0.37.1-0.20261120012501-1d0f5e04225d h1:HOnC8h7DRBSlsiaZn1kCRXLYgYdoKZ+gWR0grlXwXXo= +github.com/basecamp/basecamp-sdk/go v0.37.1-0.20261120012501-1d0f5e04225d/go.mod h1:ynVJME8mVV3UHMUMnzBgygTnMtadQFxz1iYg7fqwUeM= github.com/basecamp/cli v0.2.2-0.20261023171439-c9bce8206df9 h1:3NfGs+zx23Tp6cf+97+UewrJHlzZMLzmvEXOmOJyQAk= github.com/basecamp/cli v0.2.2-0.20261023171439-c9bce8206df9/go.mod h1:iTBTaWvsPEFIcZfkxQHEfISyJ6sZ7036K6bNx0RY3EE= github.com/basecamp/mcp v0.0.0-20261118214004-663b2e5d2836 h1:ND4te8b+HVFFrgcm7+n8P83MKKPqBpIyoJ63tT9liRU= diff --git a/internal/commands/assignments.go b/internal/commands/assignments.go index 9c6794c79..ab36fae26 100644 --- a/internal/commands/assignments.go +++ b/internal/commands/assignments.go @@ -317,10 +317,11 @@ func newAssignmentsCompletedCmd() *cobra.Command { return err } - items, err := app.Account().MyAssignments().Completed(cmd.Context()) + result, err := app.Account().MyAssignments().Completed(cmd.Context(), 0) if err != nil { return convertSDKError(err) } + items := result.Assignments return app.OK(items, output.WithSummary(fmt.Sprintf("%d completed assignment(s)", len(items))), diff --git a/internal/commands/cards.go b/internal/commands/cards.go index c6de2c087..15bd8e5ab 100644 --- a/internal/commands/cards.go +++ b/internal/commands/cards.go @@ -268,8 +268,8 @@ func cardsAccountWideSelector(opts cardsListOptions) (selector, flag string, err } // runCardsListAccountWide lists cards across every accessible project. The -// paginated aggregates come back grouped by project; --overdue comes back flat -// and unpaginated. +// paginated aggregates come back grouped by project; --overdue comes back flat, +// every page followed. func runCardsListAccountWide(cmd *cobra.Command, app *appctx.App, opts cardsListOptions, selector string) error { if err := rejectAccountWideTodolist(app, "card"); err != nil { return err @@ -313,12 +313,12 @@ func runCardsListAccountWide(cmd *cobra.Command, app *appctx.App, opts cardsList } if selector == cardsSelectorOverdue { - // --page has nothing to address on an unpaginated endpoint, but --all + // --page has nothing to address on a listing read whole, but --all // does: the listing is capped by default, and --all is how you reach // past the cap. Rejecting both would leave card 101 unreachable. if opts.pageSet { return output.ErrUsageHint( - "--page is not supported with --overdue (the overdue listing is not paginated)", + "--page is not supported with --overdue (the overdue listing is read whole)", "Cap the results instead: basecamp cards list --overdue --limit ", ) } @@ -432,8 +432,8 @@ func runCardsListAccountWide(cmd *cobra.Command, app *appctx.App, opts cardsList return app.OK(groups, respOpts...) } -// runCardsListOverdue lists overdue cards across every project. The endpoint -// returns a flat, oldest-due-first array, so it renders like the +// runCardsListOverdue lists overdue cards across every project. The SDK follows +// every page of a flat, oldest-due-first list, so it renders like the // project-scoped path and accepts the sort flags. func runCardsListOverdue(cmd *cobra.Command, app *appctx.App, opts cardsListOptions) error { if opts.sortField == "position" { @@ -450,18 +450,19 @@ func runCardsListOverdue(cmd *cobra.Command, app *appctx.App, opts cardsListOpti return err } - cards, err := app.Account().Everything().OverdueCards(cmd.Context(), taskFilters) + result, err := app.Account().Everything().OverdueCards(cmd.Context(), 0, taskFilters) if err != nil { return convertSDKError(err) } + cards := result.Cards // Sort before truncating: truncating first would sort only the survivors. if opts.sortField != "" { sortCards(cards, opts.sortField, opts.reverse) } - // The endpoint is unpaginated, so the complete array is already in hand and - // --all costs nothing beyond skipping the cap. --limit trims locally. + // The complete list is already in hand, so --all costs nothing beyond + // skipping the cap. --limit trims locally. total := len(cards) limit := opts.limit if limit == 0 { @@ -476,7 +477,10 @@ func runCardsListOverdue(cmd *cobra.Command, app *appctx.App, opts cardsListOpti output.WithBreadcrumbs(cardsAccountWideBreadcrumbs()...), output.WithDisplayData(flattenOverdueCards(cards)), } - if len(cards) < total { + switch { + case result.Meta.Truncated: + respOpts = append(respOpts, output.WithNotice("More pages are available; results were truncated")) + case len(cards) < total: respOpts = append(respOpts, output.WithNotice(fmt.Sprintf( "Showing the first %d of %d overdue cards (use --all for the complete list, or --limit to raise the cap)", len(cards), total))) diff --git a/internal/commands/cards_test.go b/internal/commands/cards_test.go index c45bc3fc7..257bc3947 100644 --- a/internal/commands/cards_test.go +++ b/internal/commands/cards_test.go @@ -2549,7 +2549,7 @@ const cardsGroupsFixture = `[ {"id":22,"title":"Beta two","status":"active","due_on":"2026-03-01"}]} ]` -// cardsOverdueFixture is the flat, unpaginated overdue payload. +// cardsOverdueFixture is the flat overdue payload, on one page. const cardsOverdueFixture = `[ {"id":31,"title":"Zeta late","status":"active","due_on":"2025-02-01"}, {"id":32,"title":"Alpha late","status":"active","due_on":"2025-01-01"} @@ -2800,7 +2800,7 @@ func TestCardsListAccountWideRejectsBadPaging(t *testing.T) { } // TestCardsListOverdueRejectsPage tests that --page is refused rather than -// accepted and dropped: there is no page to address on an unpaginated endpoint. +// accepted and dropped: the overdue listing is read whole, every page followed. func TestCardsListOverdueRejectsPage(t *testing.T) { app, _ := setupRecordingTestApp(t, cardsAllAggregateRoutes()...) err := executeRecordingCommand(NewCardsCmd(), app, "list", "--all-projects", "--overdue", "--page", "1") @@ -2809,9 +2809,9 @@ func TestCardsListOverdueRejectsPage(t *testing.T) { // --all is a different question from --page. The overdue listing is capped at // 100 by default, so rejecting --all as well would leave card 101 unreachable — -// capped with no escape hatch is the defect, not the fix. The endpoint is -// unpaginated, so honoring --all costs nothing: the complete array is already -// in hand. +// capped with no escape hatch is the defect, not the fix. The listing is read +// whole, so honoring --all costs nothing: the complete array is already in +// hand. func TestCardsListOverdueAcceptsAll(t *testing.T) { app, transport, buf := setupCardsAccountWideApp(t, output.FormatJSON, cardsAllAggregateRoutes()...) require.NoError(t, executeRecordingCommand(NewCardsCmd(), app, "list", "--all-projects", "--overdue", "--all")) @@ -2824,7 +2824,7 @@ func TestCardsListOverdueAcceptsAll(t *testing.T) { assert.Len(t, envelope.Data, 2, "--all returns the complete array") assert.Empty(t, envelope.Notice, "nothing was withheld, so there is nothing to warn about") assert.Len(t, transport.queriesFor(cardsAggregatePath("overdue")), 1, - "--all costs no extra request on an unpaginated endpoint") + "--all costs no extra request on a listing already read whole") } // TestCardsListAccountWideSorting tests that sorting is rejected for the diff --git a/internal/commands/paged_lists_test.go b/internal/commands/paged_lists_test.go new file mode 100644 index 000000000..383e64820 --- /dev/null +++ b/internal/commands/paged_lists_test.go @@ -0,0 +1,81 @@ +package commands + +import ( + "net/http" + "testing" + + "github.com/spf13/cobra" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/basecamp/basecamp-cli/internal/output" +) + +func TestAccountWideListsReadEveryPage(t *testing.T) { + cases := []struct { + name string + cmd func() *cobra.Command + args []string + path string + pages []string + ids func(records any) []any + also []stubRoute + }{ + { + name: "overdue todos", cmd: NewTodosCmd, args: []string{"list", "--overdue"}, + path: "/99999/todos/overdue.json", + pages: []string{`[{"id":1,"title":"Alpha","due_on":"2020-01-01"}]`, `[{"id":2,"title":"Bravo","due_on":"2020-02-01"}]`}, + ids: listIDs, + }, + { + name: "overdue cards", cmd: NewCardsCmd, args: []string{"list", "--all-projects", "--overdue"}, + path: "/99999/cards/overdue.json", + pages: []string{`[{"id":1,"title":"Alpha","due_on":"2020-01-01"}]`, `[{"id":2,"title":"Bravo","due_on":"2020-02-01"}]`}, + ids: listIDs, + }, + { + name: "completed assignments", cmd: NewAssignmentsCmd, args: []string{"completed"}, + path: "/99999/my/assignments/completed.json", + pages: []string{`[{"id":1,"content":"Alpha"}]`, `[{"id":2,"content":"Bravo"}]`}, + ids: listIDs, + }, + { + name: "timesheet report", cmd: NewTimesheetCmd, args: []string{"report"}, + path: "/99999/reports/timesheet.json", + pages: []string{`[{"id":1,"hours":"1.0"}]`, `[{"id":2,"hours":"2.0"}]`}, + ids: listIDs, + }, + { + name: "assigned todos", cmd: NewReportsCmd, args: []string{"assigned", "42"}, + path: "/99999/reports/todos/assigned/42", + pages: []string{ + `{"person":{"id":42,"name":"Ann"},"grouped_by":"","todos":[{"id":1,"title":"Alpha"}]}`, + `{"person":{"id":42,"name":"Ann"},"grouped_by":"","todos":[{"id":2,"title":"Bravo"}]}`, + }, + ids: func(report any) []any { return listIDs(report.(map[string]any)["todos"]) }, + also: []stubRoute{{method: http.MethodGet, path: "/99999/people.json", status: http.StatusOK, + body: `[{"id":42,"name":"Ann"}]`}}, + }, + } + + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + listRoute := stubRoute{method: http.MethodGet, path: tc.path, status: http.StatusOK, pages: tc.pages, linked: true} + app, transport, buf := setupAccountWideTodosApp(t, output.FormatJSON, append(tc.also, listRoute)...) + + require.NoError(t, executeRecordingCommand(tc.cmd(), app, tc.args...)) + + assert.Equal(t, []string{"", "page=2"}, transport.queriesFor(tc.path)) + assert.Equal(t, []any{float64(1), float64(2)}, tc.ids(decodeTodosEnvelope(t, buf)["data"])) + }) + } +} + +func listIDs(records any) []any { + list := records.([]any) + ids := make([]any, 0, len(list)) + for _, record := range list { + ids = append(ids, record.(map[string]any)["id"]) + } + return ids +} diff --git a/internal/commands/recording_test.go b/internal/commands/recording_test.go index d2d349434..d68f20732 100644 --- a/internal/commands/recording_test.go +++ b/internal/commands/recording_test.go @@ -53,6 +53,11 @@ type stubRoute struct { // would walk all the way to the cap and hide the behavior under test. pages []string + // linked, with pages, serves pages the way Basecamp's Link-paged lists do: + // no page number is page 1, and every page but the last names the next in + // a Link rel="next" header, so the SDK follows them. + linked bool + // bodies, when set, serves bodies[i] to the i-th request this route // matches and repeats the last entry past the end. Routes match on method // and path alone, so a walk that re-requests one path with a different @@ -76,6 +81,39 @@ func pagedBody(route stubRoute, rawPage string) string { return route.pages[n-1] } +// linkedPageNumber is the page a request to a linked route asks for, 1 when it +// names none. +func linkedPageNumber(req *http.Request) int { + n, err := strconv.Atoi(req.URL.Query().Get("page")) + if err != nil || n < 1 { + return 1 + } + return n +} + +// linkedPage serves a linked route's page, or an empty array past its end. +func linkedPage(route stubRoute, req *http.Request) string { + n := linkedPageNumber(req) + if n > len(route.pages) { + return "[]" + } + return route.pages[n-1] +} + +// linkedNextPage is the URL of the page after the one requested, or "" on the +// last page. +func linkedNextPage(route stubRoute, req *http.Request) string { + n := linkedPageNumber(req) + if n >= len(route.pages) { + return "" + } + next := *req.URL + query := next.Query() + query.Set("page", strconv.Itoa(n+1)) + next.RawQuery = query.Encode() + return next.String() +} + // recordingTransport is an http.RoundTripper that records every request and // serves canned responses from its route table. Unmatched requests get an // error response — a wrong route fails the command rather than passing @@ -115,10 +153,17 @@ func (t *recordingTransport) RoundTrip(req *http.Request) (*http.Response, error switch { case route.bodies != nil: responseBody = route.bodies[t.nextBody(index, len(route.bodies))] + case route.linked: + responseBody = linkedPage(route, req) case route.pages != nil: responseBody = pagedBody(route, req.URL.Query().Get("page")) } header := http.Header{"Content-Type": []string{"application/json"}} + if route.linked { + if next := linkedNextPage(route, req); next != "" { + header.Set("Link", fmt.Sprintf(`<%s>; rel="next"`, next)) + } + } for name, values := range route.header { header[name] = values } diff --git a/internal/commands/timesheet.go b/internal/commands/timesheet.go index 8e5824e76..84f5ecf6f 100644 --- a/internal/commands/timesheet.go +++ b/internal/commands/timesheet.go @@ -90,10 +90,11 @@ func runTimesheetReport(cmd *cobra.Command, startDate, endDate, personID string) opts.PersonID = pid } - entries, err := app.Account().Timesheet().Report(cmd.Context(), opts) + result, err := app.Account().Timesheet().Report(cmd.Context(), opts) if err != nil { return convertSDKError(err) } + entries := result.Entries totalHours := sumTimesheetHours(entries) diff --git a/internal/commands/todos.go b/internal/commands/todos.go index e5fc05ce4..7d6f07018 100644 --- a/internal/commands/todos.go +++ b/internal/commands/todos.go @@ -461,11 +461,12 @@ func listGroupedTodosAcrossProjects(cmd *cobra.Command, app *appctx.App, flags t } // listOverdueTodosAcrossProjects fetches the overdue aggregate, which is a flat -// oldest-due-first array rather than a paginated, project-grouped listing. +// oldest-due-first list rather than a project-grouped one. The SDK follows its +// pages, so the whole list is in hand. func listOverdueTodosAcrossProjects(cmd *cobra.Command, app *appctx.App, flags todosListFlags) error { if cmd.Flags().Changed("page") { return output.ErrUsageHint( - "--page is not supported with --overdue (the overdue listing is not paginated)", + "--page is not supported with --overdue (the overdue listing is read whole)", "Cap the results instead: basecamp todos list --overdue --limit ") } if flags.sortField == "position" { @@ -477,10 +478,11 @@ func listOverdueTodosAcrossProjects(cmd *cobra.Command, app *appctx.App, flags t return err } - todos, err := app.Account().Everything().OverdueTodos(cmd.Context(), taskFilters) + result, err := app.Account().Everything().OverdueTodos(cmd.Context(), 0, taskFilters) if err != nil { return convertSDKError(err) } + todos := result.Todos total := len(todos) // Sort before truncating — truncating first would sort only the survivors. @@ -488,8 +490,8 @@ func listOverdueTodosAcrossProjects(cmd *cobra.Command, app *appctx.App, flags t sortTodos(todos, flags.sortField, flags.reverse) } - // The endpoint is unpaginated, so the complete array is already in hand and - // --all costs nothing beyond skipping the cap. --limit trims locally. + // The complete list is already in hand, so --all costs nothing beyond + // skipping the cap. --limit trims locally. limit := flags.limit if limit == 0 { limit = accountWideDefaultLimit @@ -518,7 +520,10 @@ func listOverdueTodosAcrossProjects(cmd *cobra.Command, app *appctx.App, flags t }, ), } - if total > len(todos) { + switch { + case result.Meta.Truncated: + respOpts = append(respOpts, output.WithNotice("More pages are available; results were truncated")) + case total > len(todos): respOpts = append(respOpts, output.WithNotice(fmt.Sprintf( "Showing %d of %d overdue todos (use --all for the complete list, or --limit to raise the cap)", len(todos), total))) diff --git a/internal/commands/todos_test.go b/internal/commands/todos_test.go index 859315170..d073b82af 100644 --- a/internal/commands/todos_test.go +++ b/internal/commands/todos_test.go @@ -3333,15 +3333,15 @@ func TestFlattenAccountWideTodosCarriesProjectAndStatus(t *testing.T) { assert.Equal(t, "completed", rows[1]["status"]) } -func TestTodosListAccountWideOverdueIsUnpaginated(t *testing.T) { +func TestTodosListAccountWideOverdueRejectsPage(t *testing.T) { app, _ := setupRecordingTestApp(t) requireTodosListUsageError(t, app, "--page is not supported with --overdue", "--overdue", "--page", "2") } // --all is a different question from --page. The overdue listing caps at 100 by -// default, so refusing --all too would leave todo 101 unreachable. The endpoint -// is unpaginated, so honoring it costs nothing: the array is already in hand. +// default, so refusing --all too would leave todo 101 unreachable. The listing +// is read whole, so honoring it costs nothing: the array is already in hand. func TestTodosListAccountWideOverdueAcceptsAll(t *testing.T) { body := `[{"id":1,"title":"Bravo","due_on":"2020-03-01"}, {"id":2,"title":"Alpha","due_on":"2020-01-01"}]` @@ -3354,7 +3354,7 @@ func TestTodosListAccountWideOverdueAcceptsAll(t *testing.T) { assert.Equal(t, "2 overdue todos across all projects", envelope["summary"]) assert.Empty(t, envelope["notice"], "nothing was withheld, so there is nothing to warn about") assert.Len(t, transport.queriesFor("/99999/todos/overdue.json"), 1, - "--all costs no extra request on an unpaginated endpoint") + "--all costs no extra request on a listing already read whole") } func TestTodosListAccountWideOverdueSortsBeforeTruncating(t *testing.T) { diff --git a/internal/mcpserver/catalog_test.go b/internal/mcpserver/catalog_test.go index 80c008751..7097788cb 100644 --- a/internal/mcpserver/catalog_test.go +++ b/internal/mcpserver/catalog_test.go @@ -219,7 +219,7 @@ func TestCatalogPaginatedActionsTakePage(t *testing.T) { assert.Equal(t, 1, pages, "operation %q must declare exactly one page query parameter", op.ID) } } - assert.Equal(t, 63, link, "Link-style paginated operation count") + assert.Equal(t, 68, link, "Link-style paginated operation count") } // TestCatalogCursorPaginatedActionsTakeNoPage pins the other half. A diff --git a/internal/mcpserver/model/PROVENANCE.json b/internal/mcpserver/model/PROVENANCE.json index 1d65c6c3b..eb896ffd2 100644 --- a/internal/mcpserver/model/PROVENANCE.json +++ b/internal/mcpserver/model/PROVENANCE.json @@ -1,7 +1,7 @@ { "source": "github.com/basecamp/basecamp-sdk", - "commit": "da4686b0d61a088a86d203d038d8b53637e8efe4", - "ref": "go/v0.37.0", + "commit": "1d0f5e04225d301318afee877b690f9bb27e69c8", + "ref": "go/v0.37.0-9-g1d0f5e04", "files": ["behavior-model.json", "openapi.json"], "synced_by": "scripts/sync-mcp-model.sh", "patches": "binary-upload operations dropped because the toolkit refuses their non-JSON bodies (EXCLUDED_OPERATIONS) and the stream-ticket mint dropped by policy (POLICY_EXCLUDED_OPERATIONS); no tag patches applied (PATCHED_TAGS is empty — the export tags every operation) — see the sync script" diff --git a/internal/mcpserver/model/behavior-model.json b/internal/mcpserver/model/behavior-model.json index 70fa2b173..ac02bf2ae 100644 --- a/internal/mcpserver/model/behavior-model.json +++ b/internal/mcpserver/model/behavior-model.json @@ -888,6 +888,10 @@ }, "GetAssignedTodos": { "readonly": true, + "pagination": { + "style": "link", + "maxPageSize": 50 + }, "retry": { "max": 3, "base_delay_ms": 1000, @@ -1324,6 +1328,10 @@ }, "GetEverythingOverdueCards": { "readonly": true, + "pagination": { + "style": "link", + "maxPageSize": 50 + }, "retry": { "max": 3, "base_delay_ms": 1000, @@ -1336,6 +1344,10 @@ }, "GetEverythingOverdueTodos": { "readonly": true, + "pagination": { + "style": "link", + "maxPageSize": 50 + }, "retry": { "max": 3, "base_delay_ms": 1000, @@ -1536,6 +1548,10 @@ }, "GetMyCompletedAssignments": { "readonly": true, + "pagination": { + "style": "link", + "maxPageSize": 50 + }, "retry": { "max": 3, "base_delay_ms": 1000, @@ -1944,6 +1960,10 @@ }, "GetTimesheetReport": { "readonly": true, + "pagination": { + "style": "link", + "maxPageSize": 50 + }, "retry": { "max": 3, "base_delay_ms": 1000, diff --git a/internal/mcpserver/model/openapi.json b/internal/mcpserver/model/openapi.json index 996c2f77a..c5464b1a8 100644 --- a/internal/mcpserver/model/openapi.json +++ b/internal/mcpserver/model/openapi.json @@ -6476,7 +6476,7 @@ }, "/{accountId}/cards/overdue.json": { "get": { - "description": "Get every overdue card across all accessible projects, oldest-due-date-first.\nA complete, unpaginated array; each item embeds its `bucket`.", + "description": "Get every overdue card across all accessible projects, oldest-due-date-first,\n50 per page. Each item embeds its `bucket`.", "operationId": "GetEverythingOverdueCards", "parameters": [ { @@ -6513,6 +6513,16 @@ "type": "string", "description": "Filter by due date: with, without, or overdue. Unrecognized values are ignored." } + }, + { + "name": "page", + "in": "query", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "schema": { + "type": "integer", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "format": "int32" + } } ], "responses": { @@ -6570,6 +6580,11 @@ "tags": [ "Everything" ], + "x-basecamp-pagination": { + "style": "link", + "totalCountHeader": "X-Total-Count", + "maxPageSize": 50 + }, "x-basecamp-retry": { "maxAttempts": 3, "baseDelayMs": 1000, @@ -12557,7 +12572,7 @@ }, "/{accountId}/my/assignments/completed.json": { "get": { - "description": "Get the current user's completed assignments.\nArchived and trashed recordings are excluded. This endpoint is not paginated.", + "description": "Get the current user's completed assignments, most recently completed first,\n50 per page. Archived and trashed recordings are excluded.", "operationId": "GetMyCompletedAssignments", "parameters": [ { @@ -12570,6 +12585,16 @@ "description": "Basecamp account ID (numeric string)" }, "required": true + }, + { + "name": "page", + "in": "query", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "schema": { + "type": "integer", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "format": "int32" + } } ], "responses": { @@ -12617,6 +12642,11 @@ "tags": [ "MyAssignments" ], + "x-basecamp-pagination": { + "style": "link", + "totalCountHeader": "X-Total-Count", + "maxPageSize": 50 + }, "x-basecamp-retry": { "maxAttempts": 3, "baseDelayMs": 1000, @@ -22790,7 +22820,7 @@ }, "/{accountId}/reports/timesheet.json": { "get": { - "description": "Get account-wide timesheet report", + "description": "Get account-wide timesheet report, latest first, 50 per page", "operationId": "GetTimesheetReport", "parameters": [ { @@ -22825,6 +22855,16 @@ "type": "integer", "format": "int64" } + }, + { + "name": "page", + "in": "query", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "schema": { + "type": "integer", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "format": "int32" + } } ], "responses": { @@ -22882,6 +22922,11 @@ "tags": [ "Schedule" ], + "x-basecamp-pagination": { + "style": "link", + "totalCountHeader": "X-Total-Count", + "maxPageSize": 50 + }, "x-basecamp-retry": { "maxAttempts": 3, "baseDelayMs": 1000, @@ -22978,7 +23023,7 @@ }, "/{accountId}/reports/todos/assigned/{personId}": { "get": { - "description": "Get todos assigned to a specific person", + "description": "Get todos assigned to a specific person, 50 per page. Every page repeats\n`person` and `grouped_by`; `todos` holds that page's to-dos.", "operationId": "GetAssignedTodos", "parameters": [ { @@ -23009,6 +23054,16 @@ "type": "string", "description": "Group by \"bucket\" or \"date\"" } + }, + { + "name": "page", + "in": "query", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "schema": { + "type": "integer", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "format": "int32" + } } ], "responses": { @@ -23076,6 +23131,12 @@ "tags": [ "Reports" ], + "x-basecamp-pagination": { + "style": "link", + "totalCountHeader": "X-Total-Count", + "maxPageSize": 50, + "key": "todos" + }, "x-basecamp-retry": { "maxAttempts": 3, "baseDelayMs": 1000, @@ -23089,7 +23150,7 @@ }, "/{accountId}/reports/todos/overdue.json": { "get": { - "description": "Get one page of overdue todos grouped by lateness, latest first.\n\nPages hold 15, 30, 50, then 100 to-dos, and each page fills the same four\ngroups with only its own to-dos, so a group can continue onto the next\npage. A `Link: rel=\"next\"` header names the next page and `X-Total-Count`\nthe total. This operation is not auto-paginated in any SDK: the response\nis an object of four arrays, which no pagination key can name.", + "description": "Get one page of overdue todos grouped by lateness, latest first.\n\nEvery page holds 50 to-dos, and each page fills the same four groups with\nonly its own to-dos, so a group can continue onto the next page. A\n`Link: rel=\"next\"` header names the next page and `X-Total-Count` the\ntotal. This operation is not auto-paginated in any SDK: the response\nis an object of four arrays, which no pagination key can name.", "operationId": "GetOverdueTodos", "parameters": [ { @@ -28263,7 +28324,7 @@ }, "/{accountId}/todos/overdue.json": { "get": { - "description": "Get every overdue to-do across all accessible projects, oldest-due-date-first.\nA complete, unpaginated array; each item embeds its `bucket`.", + "description": "Get every overdue to-do across all accessible projects, oldest-due-date-first,\n50 per page. Each item embeds its `bucket`.", "operationId": "GetEverythingOverdueTodos", "parameters": [ { @@ -28300,6 +28361,16 @@ "type": "string", "description": "Filter by due date: with, without, or overdue. Unrecognized values are ignored." } + }, + { + "name": "page", + "in": "query", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "schema": { + "type": "integer", + "description": "Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.", + "format": "int32" + } } ], "responses": { @@ -28357,6 +28428,11 @@ "tags": [ "Everything" ], + "x-basecamp-pagination": { + "style": "link", + "totalCountHeader": "X-Total-Count", + "maxPageSize": 50 + }, "x-basecamp-retry": { "maxAttempts": 3, "baseDelayMs": 1000, @@ -35926,10 +36002,14 @@ "type": "array", "items": { "$ref": "#/components/schemas/Todo" - }, - "x-go-type-skip-optional-pointer": true + } } - } + }, + "required": [ + "grouped_by", + "person", + "todos" + ] }, "GetBookmarkResponseContent": { "$ref": "#/components/schemas/BookmarkStatus" diff --git a/internal/mcpserver/testdata/catalog_snapshot.txt b/internal/mcpserver/testdata/catalog_snapshot.txt index 7ad1190d1..25e669a9c 100644 --- a/internal/mcpserver/testdata/catalog_snapshot.txt +++ b/internal/mcpserver/testdata/catalog_snapshot.txt @@ -166,7 +166,7 @@ ACTIONS (RO = read-only): - get_schedule_entry (RO): Get a single schedule entry by id - get_schedule_entry_occurrence (RO): Get a specific occurrence of a recurring schedule entry - get_timesheet_entry (RO): Get a single timesheet entry -- get_timesheet_report (RO): Get account-wide timesheet report +- get_timesheet_report (RO, paginated): Get account-wide timesheet report, latest first, 50 per page - list_schedule_entries (RO, paginated): List entries on a schedule - replace_schedule_entry: Replace a schedule entry with a new complete representation - update_calendar: Update a calendar's display color @@ -312,7 +312,7 @@ Gateway tool: call with {"action": "...", "params": {...}}. Call {"action": "describe", "params": {"action": "NAME"}} for an action's full parameter schema. ACTIONS (RO = read-only): -- get_assigned_todos (RO): Get todos assigned to a specific person +- get_assigned_todos (RO, paginated): Get todos assigned to a specific person, 50 per page - get_overdue_todos (RO): Get one page of overdue todos grouped by lateness, latest first - get_person_progress (RO, paginated): Get a person's activity timeline - get_progress_report (RO, paginated): Get account-wide activity feed (progress report) @@ -338,8 +338,8 @@ ACTIONS (RO = read-only): - get_everything_not_now_cards (RO, paginated): Cards parked in a project's "Not now" column across all accessible projects, grouped by project (paginated) - get_everything_open_cards (RO, paginated): Incomplete cards in active columns across all accessible projects, grouped by project (paginated) - get_everything_open_todos (RO, paginated): Active, incomplete to-dos across all accessible projects, grouped by project (paginated) -- get_everything_overdue_cards (RO): Get every overdue card across all accessible projects, oldest-due-date-first -- get_everything_overdue_todos (RO): Get every overdue to-do across all accessible projects, oldest-due-date-first +- get_everything_overdue_cards (RO, paginated): Get every overdue card across all accessible projects, oldest-due-date-first, 50 per page +- get_everything_overdue_todos (RO, paginated): Get every overdue to-do across all accessible projects, oldest-due-date-first, 50 per page - get_everything_unassigned_cards (RO, paginated): Open, unassigned cards across all accessible projects, grouped by project (paginated) - get_everything_unassigned_todos (RO, paginated): Open, unassigned to-dos across all accessible projects, grouped by project (paginated) @@ -400,7 +400,7 @@ ACTIONS (RO = read-only): - get_bubble_ups (RO, paginated): Get the current user's current and scheduled bubble-ups (paginated, 50 per page) - get_gauge_needle (RO): Get a gauge needle by ID - get_my_assignments (RO): Get the current user's active assignments grouped into priorities and non_priorities -- get_my_completed_assignments (RO): Get the current user's completed assignments +- get_my_completed_assignments (RO, paginated): Get the current user's completed assignments, most recently completed first, 50 per page - get_my_due_assignments (RO): Get the current user's assignments filtered by due date scope - get_my_note (RO): Get the authenticated user's note — a per-person notebook singleton at /my/notes.json - get_my_notifications (RO): Get the current user's notifications (the "Hey!" menu in Basecamp 4) diff --git a/internal/version/sdk-provenance.json b/internal/version/sdk-provenance.json index eb41cfd29..39c54b080 100644 --- a/internal/version/sdk-provenance.json +++ b/internal/version/sdk-provenance.json @@ -1,9 +1,9 @@ { "sdk": { "module": "github.com/basecamp/basecamp-sdk/go", - "version": "v0.37.0", - "revision": "da4686b0d61a", - "updated_at": "2026-11-19T01:35:10Z" + "version": "v0.37.1-0.20261120012501-1d0f5e04225d", + "revision": "1d0f5e04225d", + "updated_at": "2026-11-20T01:25:01Z" }, "api": { "repo": "basecamp/bc3", diff --git a/nix/package.nix b/nix/package.nix index fc063406c..aee2d5f65 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -8,7 +8,7 @@ buildGoModule.override { go = go_1_26; } (finalAttrs: { src = lib.cleanSource ./..; # To update: set to lib.fakeHash, run `nix build`, use the hash from the error. - vendorHash = "sha256-TNI7wjyV6pZVOjzHu5g3qHIXmtXGAeywecM5pts/FRY="; + vendorHash = "sha256-ezhbHAILtl/Mx0vl8+mU4LhyEW0ByUeeYyHzoRNG7gI="; subPackages = [ "cmd/basecamp" ];