Send combined CLI and SDK versions in API user agent

Merged
RO
8mo ago
+24-0

Summary

This updates the Basecamp CLI to send a combined User-Agent so BC3 can identify and log the CLI version alongside the Go SDK and API revision. Today CLI requests inherit the SDK default user agent, which means BC3 logs show the SDK version but not that the traffic came from the CLI itself.

Before, the API saw:

basecamp-sdk-go/0.7.2 (api:2026-01-26)

After, it sees:

basecamp-cli/<cli-version> (https://github.com/basecamp/basecamp-cli) basecamp-sdk-go/0.7.2 (api:2026-01-26)

This change:

  • makes the CLI the primary client identity in BC3 logs
  • preserves the SDK version and API revision for debugging
  • adds coverage to ensure NewApp configures the combined user agent consistently

Summary by cubic

Send a combined CLI+SDK User-Agent on all API requests so BC3 can identify CLI traffic and version while preserving the Go SDK version and API revision. Example: basecamp-cli/ (...) basecamp-sdk-go/0.7.2 (api:2026-01-26).

  • New Features
    • Set User-Agent in NewApp via basecamp.WithUserAgent(version.UserAgent()+" "+basecamp.DefaultUserAgent).
    • Added TestNewAppSetsCombinedUserAgent to verify the combined header and token against a test server.