Skip to content

feat(client): send X-MakesPDF-Client: cli/<version> on every API request - #2

Merged
lecstor merged 3 commits into
mainfrom
clanker/740a1014-cli-send-x-makespdf-client-cli-version-o
Sep 30, 2026
Merged

lecstor merged 3 commits into
mainfrom
clanker/740a1014-cli-send-x-makespdf-client-cli-version-o

Conversation

@lecstor

@lecstor lecstor commented Sep 30, 2026

Copy link
Copy Markdown
Member

What

Every makesPDF API request the CLI makes now carries X-MakesPDF-Client: cli/<package version> (currently cli/0.2.0), from one shared helper:

  • new src/client-info.ts — single source: CLIENT_KIND, CLIENT_VERSION (inlined from package.json at build time), CLIENT_NAME, clientHeaders()
  • ApiClient.post spreads clientHeaders() — covers md, preview, render, validate
  • both raw device-flow fetches in src/commands/login.ts use it

Per operator decision 2f382669, official clients send plain <kind>/<version> and the server matches kinds exactly; cli is already in the server's known-client list, so CLI traffic can be classified without guessing from the User-Agent.

Tests

  • src/client-info.test.ts — kind/version/value and the shared headers
  • src/client.test.ts — header present on ApiClient requests
  • src/commands/login.test.ts — drives login through citty against a stubbed fetch and asserts the header on both device-flow requests
  • Local verification: pnpm typecheck clean, pnpm test 22/22 across 4 files, pnpm build succeeds, and a mock-API E2E against the built binary saw X-MakesPDF-Client: cli/0.2.0 on all 3 requests (md + login).

Notes

  • Changeset .changeset/cli-client-header.md (patch). Nothing published to npm — tagging/release remains the operator's step.
  • The branch history contains a driver WIP salvage commit (6a9e3ef) that swept up pnpm-workspace.yaml; it is dropped by 6931829, a local-only pnpm 11 build-approval workaround (CI pins pnpm 10). The final diff contains only the client-header change.

The session working this task ended without committing - killed by a usage
limit, a crash, or a stream that could not be read. The driver committed its
worktree verbatim so the work is recoverable from another machine instead of
being redone from nothing.

Nothing here has been reviewed, built or tested, and no human or agent chose
this as a stopping point. Read it before building on it, and discard it if it
is a half-applied change.

Task: 740a1014-3573-47cd-8039-4c6a170e30e4
Worktree: /Users/jason/dev/pdf/makespdf-cli/.worktrees/740a1014
Salvaged: 2026-09-30T15:59:48+10:00
The driver's WIP-salvage commit (6a9e3ef) swept up this local pnpm 11
build-approval file, which the MAK-148 implementation hand-off explicitly
left untracked: `pnpm approve-builds --all` generated it for this working
copy only, CI pins pnpm 10, and main's CI passes without it. Dropping it so
the PR diff holds only the X-MakesPDF-Client change.
@lecstor
lecstor merged commit e9e5d1a into main Sep 30, 2026
3 checks passed
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