Skip to content

fix: send asknews-cli/<version> as User-Agent - #13

Merged
wagnercosta merged 1 commit into
mainfrom
feat/usage-client-id
Oct 9, 2026
Merged

wagnercosta merged 1 commit into
mainfrom
feat/usage-client-id

Conversation

@wagnercosta

Copy link
Copy Markdown
Member

🔴 Review tier: HIGH — human review required

  • Release: a fix: on main feeds the next release-please Release PR, which publishes to npm

What

Every request the CLI sends to the API gateway now carries User-Agent: asknews-cli/<package version>, next to the SDKs' own asknews-sdk-<lang> agents. The gateway uses it to attribute usage to the CLI channel; until now CLI traffic was indistinguishable from raw API calls.

  • src/lib/version.ts: single source of the package version and the user agent string (cli.ts reads the version from it too).
  • src/lib/http.ts: header set in both request builders (raw requests and schema operations, buffered and streamed).
  • No change to arguments, output, or credentials handling.

Verified

  • pnpm lint and pnpm typecheck pass.
  • pnpm test: the 4 new tests in test/user-agent.test.ts pass (raw, operation and streamed requests all send the header). One failure in test/output.test.ts (web search table rendering) is pre-existing on main and unrelated.

Umbrella: em-hub/features/usage-client-id/

@wagnercosta
wagnercosta merged commit cea1cbf into main Oct 9, 2026
2 checks passed
@wagnercosta
wagnercosta deleted the feat/usage-client-id branch October 9, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant