From 0c07a694972c58130fe4a58beab91ffc59572d9d Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Sat, 21 Nov 2026 23:12:10 -0500 Subject: [PATCH 1/3] Filter gauge listings by chosen projects --- .surface | 1 + API-COVERAGE.md | 2 +- go.mod | 2 +- go.sum | 4 +- internal/commands/gauges.go | 66 +++++++++++++-- internal/commands/gauges_test.go | 83 +++++++++++++++++++ internal/commands/reports.go | 5 +- internal/mcpserver/model/PROVENANCE.json | 4 +- internal/mcpserver/model/openapi.json | 52 +++++++++++- .../mcpserver/testdata/catalog_snapshot.txt | 2 +- internal/version/sdk-provenance.json | 6 +- skills/basecamp/SKILL.md | 16 ++-- 12 files changed, 215 insertions(+), 28 deletions(-) create mode 100644 internal/commands/gauges_test.go diff --git a/.surface b/.surface index 4e3abf319..0a2184e92 100644 --- a/.surface +++ b/.surface @@ -11742,6 +11742,7 @@ FLAG basecamp gauges list --no-hints type=bool FLAG basecamp gauges list --no-stats type=bool FLAG basecamp gauges list --profile type=string FLAG basecamp gauges list --project type=string +FLAG basecamp gauges list --projects type=stringSlice FLAG basecamp gauges list --quiet type=bool FLAG basecamp gauges list --stats type=bool FLAG basecamp gauges list --styled type=bool diff --git a/API-COVERAGE.md b/API-COVERAGE.md index a5d4095ea..38735b758 100644 --- a/API-COVERAGE.md +++ b/API-COVERAGE.md @@ -243,7 +243,7 @@ cannot faithfully cover at least one endpoint for a reason outside the CLI. A | **Hill Charts** | | hill_charts | 2 | `hillcharts` | ✅ | BC4 | - | show, track/untrack todolists | | hill_charts (progress updates) | 3 | `hillcharts updates`, `hillcharts update` | ✅ | BC5 | - | post (`POST /todosets/:id/hills/versions.json`; `hillcharts update --dot =<0-100>`, repeatable, lists left out keep their position; `--note` Markdown converted to rich text, `-` reads stdin; `--notify` names who is told, nobody otherwise), list (`GET /todosets/:id/hills/versions.json`, paginated, newest first; bare `hillcharts updates` or `updates list`), show (`GET /todosets/:id/hills/versions/:id.json`; an id with `--in`/`--todoset`, or the update's web or API URL, which names its todoset). Each update carries its note (`description`, rich text) and every tracked todolist's position (`dots`; `id` is null for a todolist since deleted or moved). Todoset resolved as `hillcharts show` does | -| gauges | 7 | `gauges` | ✅ | BC4 | - | list, needles, needle, create, update, delete, enable/disable | +| gauges | 7 | `gauges` | ✅ | BC4 | - | list (--project/--in or --projects filter), needles, needle, create, update, delete, enable/disable | | **Communication** | | messages | 10 | `messages`, `message` | ✅ | BC4 | - | list, show, create, update, publish, pin, unpin. Create supports `--subscribe`/`--no-subscribe` and `--draft`. Publish promotes drafts to active. `move`/`copy` file a message onto a message board in another project (see recordings (moves, copies)) | | message_boards | 3 | `messageboards` | ✅ | BC4 | - | Container, accessed via project dock | 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/gauges.go b/internal/commands/gauges.go index ff5a2958d..72a9c101f 100644 --- a/internal/commands/gauges.go +++ b/internal/commands/gauges.go @@ -3,6 +3,7 @@ package commands import ( "fmt" "strconv" + "strings" "github.com/basecamp/basecamp-sdk/go/pkg/basecamp" "github.com/spf13/cobra" @@ -24,7 +25,8 @@ A gauge shows the current state of a project via needles positioned on a 0–100 scale, each colored green, yellow, or red.`, Annotations: map[string]string{ "agent_notes": "Gauges track project progress with colored needles (0-100 scale).\n" + - "list is account-wide. needles/create/enable/disable are project-scoped (--in).\n" + + "list is account-wide unless --project/--in or --projects is given; configured project is ignored.\n" + + "needles/create/enable/disable are project-scoped (--in).\n" + "Colors: green, yellow, red. Notify: everyone, working_on, custom.", }, } @@ -33,7 +35,7 @@ A gauge shows the current state of a project via needles positioned on a cmd.PersistentFlags().StringVar(&project, "in", "", "Project ID (alias for --project)") cmd.AddCommand( - newGaugesListCmd(), + newGaugesListCmd(&project), newGaugesNeedlesCmd(&project), newGaugesNeedleCmd(), newGaugesCreateCmd(&project), @@ -46,19 +48,67 @@ A gauge shows the current state of a project via needles positioned on a return cmd } -func newGaugesListCmd() *cobra.Command { - return &cobra.Command{ +func newGaugesListCmd(project *string) *cobra.Command { + var projects []string + + cmd := &cobra.Command{ Use: "list", - Short: "List all gauges across the account", - Long: "List all gauges across every project in the account.", + Short: "List gauges across the account or chosen projects", + Long: `List gauges across every project in the account, or filter by project. + +Use --project/--in for one project, or --projects for a comma-separated list +of project IDs or names (repeatable). These forms cannot be combined. +Without an explicit filter, the configured default project is ignored. +Filtered gauges follow the supplied project order; unavailable gauges are omitted. + + basecamp gauges list + basecamp gauges list --in MyProject + basecamp gauges list --projects "Marketing,Engineering" + basecamp gauges list --projects 30,10 --projects 20`, + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { app := appctx.FromContext(cmd.Context()) + // Account-wide reports use only explicit scope, never ambient config. + single := *project + if single == "" { + single = app.Flags.Project + } + explicitSingle := single != "" || cmd.Flags().Changed("project") || cmd.Flags().Changed("in") + if cmd.Flags().Changed("projects") && explicitSingle { + return output.ErrUsage("--projects cannot be combined with --project/--in") + } + filters := projects + if explicitSingle { + filters = []string{single} + } + if (explicitSingle || cmd.Flags().Changed("projects")) && len(filters) == 0 { + return output.ErrUsage("Project filter needs a value") + } + for _, filter := range filters { + if strings.TrimSpace(filter) == "" { + return output.ErrUsage("Project filter needs a value") + } + } + if err := ensureAccount(cmd, app); err != nil { return err } - result, err := app.Account().Gauges().List(cmd.Context(), nil) + opts := &basecamp.GaugeListOptions{} + for _, filter := range filters { + resolved, _, err := app.Names.ResolveProject(cmd.Context(), strings.TrimSpace(filter)) + if err != nil { + return err + } + id, err := strconv.ParseInt(resolved, 10, 64) + if err != nil || id <= 0 { + return output.ErrUsage("Invalid project ID") + } + opts.BucketIDs = append(opts.BucketIDs, id) + } + + result, err := app.Account().Gauges().List(cmd.Context(), opts) if err != nil { return convertSDKError(err) } @@ -76,6 +126,8 @@ func newGaugesListCmd() *cobra.Command { ) }, } + cmd.Flags().StringSliceVar(&projects, "projects", nil, "Filter by project IDs or names (comma-separated; repeatable)") + return cmd } func newGaugesNeedlesCmd(project *string) *cobra.Command { diff --git a/internal/commands/gauges_test.go b/internal/commands/gauges_test.go new file mode 100644 index 000000000..73ae62051 --- /dev/null +++ b/internal/commands/gauges_test.go @@ -0,0 +1,83 @@ +package commands + +import ( + "net/http" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +const gaugesPath = "/99999/reports/gauges.json" + +func TestGaugesListProjectFilters(t *testing.T) { + cases := []struct { + name string + args []string + want string + }{ + {"account-wide", nil, ""}, + {"project", []string{"--project", "30"}, "30"}, + {"in", []string{"--in", "30"}, "30"}, + {"short", []string{"-p", "30"}, "30"}, + {"name", []string{"--in", "Test Project"}, "123"}, + {"ordered", []string{"--projects", "30,10", "--projects", "20"}, "30,10,20"}, + {"mixed names and IDs", []string{"--projects", "30,Test Project,20"}, "30,123,20"}, + {"parent flag", []string{"--in", "30", "list"}, "30"}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + app, transport := setupRecordingTestApp(t, projectsRoute(), stubRoute{ + method: http.MethodGet, path: gaugesPath, status: http.StatusOK, + body: "[]", + }) + app.Config.ProjectID = "999" + args := append([]string{"list"}, tc.args...) + if tc.name == "parent flag" { + args = tc.args + } + require.NoError(t, executeRecordingCommand(NewGaugesCmd(), app, args...)) + queries := transport.queriesFor(gaugesPath) + require.Len(t, queries, 1) + values := queryValues(t, queries[0]) + assert.Equal(t, tc.want, values.Get("bucket_ids")) + if tc.want == "" { + assert.NotContains(t, values, "bucket_ids") + } else { + assert.Len(t, values["bucket_ids"], 1) + } + }) + } +} + +func TestGaugesListInvalidProjectFilters(t *testing.T) { + cases := [][]string{ + {"--projects", "30", "--in", "10"}, + {"--projects", "30", "--project", "10"}, + {"--projects", ""}, + {"--projects", "30,,10"}, + {"--in", ""}, + {"--projects", "0"}, + {"--projects", "-1"}, + {"--projects", "9223372036854775808"}, + {"--in", "Missing"}, + } + for _, args := range cases { + t.Run(strings.Join(args, " "), func(t *testing.T) { + app, transport := setupRecordingTestApp(t, projectsRoute()) + err := executeRecordingCommand(NewGaugesCmd(), app, append([]string{"list"}, args...)...) + require.Error(t, err) + assert.Empty(t, transport.queriesFor(gaugesPath)) + }) + } +} + +func TestGaugesListGlobalProjectFilter(t *testing.T) { + app, transport := setupRecordingTestApp(t, stubRoute{ + method: http.MethodGet, path: gaugesPath, status: http.StatusOK, body: "[]", + }) + app.Flags.Project = "42" + require.NoError(t, executeRecordingCommand(NewGaugesCmd(), app, "list")) + assert.Equal(t, "42", queryValues(t, transport.queriesFor(gaugesPath)[0]).Get("bucket_ids")) +} diff --git a/internal/commands/reports.go b/internal/commands/reports.go index 59bc3f206..aadbc2e83 100644 --- a/internal/commands/reports.go +++ b/internal/commands/reports.go @@ -181,7 +181,8 @@ func newReportsOverdueCmd() *cobra.Command { return &cobra.Command{ Use: "overdue", Short: "View overdue todos grouped by lateness", - Long: `View all overdue todos grouped by how late they are. + Long: `View the first page of overdue todos grouped by how late they are. +The response meta.truncated field indicates whether more pages exist. Todos are grouped into categories: - Under a week late @@ -195,7 +196,7 @@ Todos are grouped into categories: return err } - result, err := app.Account().Reports().OverdueTodos(cmd.Context()) + result, err := app.Account().Reports().OverdueTodos(cmd.Context(), 0) if err != nil { return convertSDKError(err) } 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/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/skills/basecamp/SKILL.md b/skills/basecamp/SKILL.md index 11314fa6f..e454aa042 100644 --- a/skills/basecamp/SKILL.md +++ b/skills/basecamp/SKILL.md @@ -88,23 +88,18 @@ argument-hint: "[action] [args...]" # Basecamp CLI -The installed CLI is the command reference. This skill sets the operating rules -and does not duplicate its catalog. +The CLI is the command reference; this skill sets operating rules. ## Discovery-first workflow -For each task: - 1. Infer the deepest plausible leaf command from the user's words. -2. If its exact arguments or flags are not already established by a tool result - in this conversation, inspect that leaf directly: +2. Unless a tool result already established its arguments and flags, inspect it: ```bash basecamp --agent --help ``` -3. If the leaf does not exist, inspect its nearest parent group. Use root help - only when the top-level group itself is unclear: +3. If absent, inspect its parent. Use root help only if the group is unclear: ```bash basecamp --agent --help # fallback @@ -289,6 +284,11 @@ basecamp projects logo remove --in "" --json the project has none; `projects show` carries the same field. Like the wallpaper's, the URL needs authentication. +## Gauges + +`gauges list` ignores configured project. Filter with `--in` or +`--projects` (ordered IDs/names, comma-separated, repeatable), never both. + ## Timesheet entries Time is logged against one item (to-do, message, card, document, upload, From 61e3f36cedc539a26dd36af89949256f2808159d Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Sun, 22 Nov 2026 17:28:48 -0500 Subject: [PATCH 2/3] Clarify overdue report truncation paths in command help --- internal/commands/reports.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/commands/reports.go b/internal/commands/reports.go index aadbc2e83..7410b751b 100644 --- a/internal/commands/reports.go +++ b/internal/commands/reports.go @@ -182,7 +182,8 @@ func newReportsOverdueCmd() *cobra.Command { Use: "overdue", Short: "View overdue todos grouped by lateness", Long: `View the first page of overdue todos grouped by how late they are. -The response meta.truncated field indicates whether more pages exist. +In JSON output, data.meta.truncated indicates whether more pages exist +(meta.truncated in data-only --agent/--quiet output). Todos are grouped into categories: - Under a week late From 2546cd8ce32acd69ec62792ee039c81f0c2faaf8 Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Sun, 22 Nov 2026 17:45:40 -0500 Subject: [PATCH 3/3] Refresh Nix vendor hash after rebasing onto main --- nix/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/package.nix b/nix/package.nix index 1517541ba..c05dff4b0 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-G4ZStXZ/h7D33tLkgna/3LkpCtLprYcsGWrtkkgg0OE="; + vendorHash = "sha256-pra9JQdNbQ/gvdQmdeS/QU+n7wqTND3BzVfmSJj+03k="; subPackages = [ "cmd/basecamp" ];