feat(cli): send x-taskless-cli-version header on service requests - #52
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a consistent CLI→service version signal by sending an x-taskless-cli-version header on all Taskless service requests, using a centralized version constant, and verifies the behavior via an integration test (supporting the service-side capability gate for runtime rules at 0.10.0).
Changes:
- Introduces
src/version.tsas the single source of truth forCLI_VERSION(build-injected) andCLI_VERSION_HEADER. - Attaches
x-taskless-cli-versionto all Taskless service request paths (openapi-fetch client, reconcile fetch, and device auth flow). - Adds an integration test asserting reconcile requests include a non-empty, non-
"unknown"CLI version header.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/test/runtime-check.test.ts | Captures request headers in the reconcile mock server and asserts x-taskless-cli-version is present and meaningful. |
| packages/cli/src/version.ts | Adds centralized CLI version + header-name constants for reuse across the CLI. |
| packages/cli/src/telemetry.ts | Imports CLI_VERSION from the new version module to keep telemetry consistent with request headers. |
| packages/cli/src/auth/device-flow.ts | Includes x-taskless-cli-version on /auth/device and /auth/token requests. |
| packages/cli/src/api/reconcile.ts | Includes x-taskless-cli-version on reconcile requests. |
| packages/cli/src/api/client.ts | Adds the version header to the shared openapi-fetch client used by rule generation and whoami. |
| .changeset/cli-version-header.md | Declares a minor bump for @taskless/cli and documents the new header behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
thecodedrift
force-pushed
the
jakob/oss-15-cli-version-header
branch
from
July 6, 2026 23:42
ce10059 to
7d97951
Compare
The Taskless service gates runtime-rule delivery on the requesting CLI's capability, inferred from its version — but the CLI never declared it. Send an x-taskless-cli-version header on every CLI->service request so the service can make that call; a request without it is treated as a pre-runtime CLI. - Add src/version.ts as the single source for CLI_VERSION (from the __VERSION__ build define) and the header name; telemetry.ts now imports it. - Attach the header on the openapi-fetch client (rule generation, whoami), the reconcile fetch, and both device-auth-flow fetches. - The CLI version is already emitted with telemetry (cliVersion on every event), so usage is recorded client-side rather than inferred at the service. The capability threshold is 0.10.0 (the release that ships the taskless check runtime harness), so this lands as a minor bump via changeset. Closes #45. Refs OSS-15. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
thecodedrift
force-pushed
the
jakob/oss-15-cli-version-header
branch
from
July 7, 2026 00:36
7d97951 to
252b8aa
Compare
thecodedrift
added a commit
that referenced
this pull request
Jul 7, 2026
Placeholder anchor for the org-UUID work (blocked on the API team). Context: the CLI currently identifies the org only by the numeric `orgId` JWT claim (decodeOrgId -> number; sent in the /cli/api/rule body; telemetry group key). The runtime-rules gate / Auth needs the org UUID, which the CLI has no source for yet. Dependency: the API team decides where the CLI reads the org UUID — likely a new JWT claim (e.g. orgUuid) or a whoami field. Once that lands, the CLI work mirrors the x-taskless-cli-version PR (#52): resolve the UUID, send it on service requests, and stamp it into telemetry. Add a changeset when implemented.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #45.
The Taskless service gates whether it offers runtime rules on the requesting CLI's capability, which it infers from the CLI's version — but the CLI never told it. This makes the CLI declare its version on every request, so the service has a safe signal to make that call.
What changes
x-taskless-cli-versionon every CLI→service request — a standing declaration, not a one-off. Added to the openapi-fetch client (rule generation,whoami), thereconcilefetch, and both device-auth-flow fetches (/auth/device,/auth/token). A request without the header is treated by the service as a pre-runtime CLI (the intended safe default; that fallback + the semver gate are the companion server-side change, out of scope here).src/version.tsexportsCLI_VERSION(from the__VERSION__build define) and the header name;telemetry.tsnow imports it instead of re-declaring.cliVersionon every event), so usage is recorded client-side rather than inferred when the request lands. No behavior change needed there; centralizing the constant keeps the header and telemetry in lockstep.Version threshold
The service begins offering runtime rules at CLI
0.10.0— the release that ships thetaskless checkruntime harness (landed in #47). The included changeset is a minor bump, so this and the harness ship together as0.10.0, lining the threshold up with the actual capable release.Notes for reviewers
"unknown"x-taskless-cli-version.typecheck+lint+ fulltest(340) green.Refs OSS-15.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TEuUE3F23dgEyrkGPq3FiM