From c7b86634b869790a4bcadeae705ed204a57f7cb7 Mon Sep 17 00:00:00 2001 From: Scott Lovegrove Date: Wed, 11 Nov 2026 09:46:25 +0000 Subject: [PATCH] fix(deps): update @doist/cli-core to 1.10.0 1.10.0 adds a cli-agent header naming the AI coding agent (if any) running the CLI. Pin it in the exact header-set tests by stubbing AI_AGENT before the tracker's module loads, so the value is the same in CI and under any local agent. --- CODEBASE.md | 2 +- package-lock.json | 8 ++++---- package.json | 2 +- src/lib/search-api.test.ts | 7 +++++++ src/lib/usage-tracking.test.ts | 7 +++++++ 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CODEBASE.md b/CODEBASE.md index 6ade10f..2099976 100644 --- a/CODEBASE.md +++ b/CODEBASE.md @@ -171,7 +171,7 @@ don't duplicate it here. - **`permissions.ts`** — `ensureWriteAllowed`, `isMutatingMethod` (read-only-scope guard). - **`markdown.ts`** — `preloadMarkdown` / `renderMarkdown` (cli-core renderer). - **`usage-tracking.ts`** — `usageTracking` (cli-core's `createUsageTracking`: - the `User-Agent` / `doist-*` / `request-id` / `session-id` / `cli-command` headers on every + the `User-Agent` / `doist-*` / `request-id` / `session-id` / `cli-command` / `cli-agent` headers on every request), `trackCommandUsage(program)` (the `preAction` hook that sets `cli-command`; `tdc view` adds it to its routing program too), and `withUsageHeaders(fetch)` for requests that bypass the SDK. Any new raw diff --git a/package-lock.json b/package-lock.json index 8cc60dc..2becea2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "MIT", "dependencies": { - "@doist/cli-core": "1.9.0", + "@doist/cli-core": "1.10.0", "@doist/comms-sdk": "3.11.0", "@pnpm/tabtab": "0.5.4", "chalk": "5.6.2", @@ -136,9 +136,9 @@ } }, "node_modules/@doist/cli-core": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@doist/cli-core/-/cli-core-1.9.0.tgz", - "integrity": "sha512-VZ7iUqLOVKSA8/osmYMFmbSx96HmNkNDFBE7HoZwU2dLRtF1tZbkXDgDeRlLSwXEfhVhG6gzH8fugUw1qjzyhg==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@doist/cli-core/-/cli-core-1.10.0.tgz", + "integrity": "sha512-z+SqZ3Na5uuDaAP3QZFzpK9vyO+lgQCLs2Lc5uPXOzd96535cS9u+6qcZgMB3qtlM6J/RW0WJN2D1SjMIJMpMg==", "license": "MIT", "dependencies": { "chalk": "6.0.1", diff --git a/package.json b/package.json index f224154..b60d245 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "CHANGELOG.md" ], "dependencies": { - "@doist/cli-core": "1.9.0", + "@doist/cli-core": "1.10.0", "@doist/comms-sdk": "3.11.0", "@pnpm/tabtab": "0.5.4", "chalk": "5.6.2", diff --git a/src/lib/search-api.test.ts b/src/lib/search-api.test.ts index fc69b88..5e2c351 100644 --- a/src/lib/search-api.test.ts +++ b/src/lib/search-api.test.ts @@ -2,6 +2,12 @@ import { DEFAULT_API_VERSION } from '@doist/comms-sdk' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import packageJson from '../../package.json' with { type: 'json' } +// `usageTracking` reads the agent once, when its module loads, so the stub runs before the +// import. Without it, `cli-agent` would depend on whichever agent (if any) runs the tests. +vi.hoisted(() => { + vi.stubEnv('AI_AGENT', 'claude-code_1.0.0_agent') +}) + const authMocks = vi.hoisted(() => ({ getApiTokenSnapshot: vi.fn(), })) @@ -73,6 +79,7 @@ describe('extendedSearch', () => { 'request-id': expect.any(String), 'session-id': expect.any(String), 'cli-command': 'search', + 'cli-agent': 'claude-code', }) }) }) diff --git a/src/lib/usage-tracking.test.ts b/src/lib/usage-tracking.test.ts index c3513e2..cdda5cd 100644 --- a/src/lib/usage-tracking.test.ts +++ b/src/lib/usage-tracking.test.ts @@ -3,6 +3,12 @@ import type { Command } from 'commander' import { beforeEach, describe, expect, it, vi } from 'vitest' import packageJson from '../../package.json' with { type: 'json' } +// `usageTracking` reads the agent once, when its module loads, so the stub runs before the +// import. Without it, `cli-agent` would depend on whichever agent (if any) runs the tests. +vi.hoisted(() => { + vi.stubEnv('AI_AGENT', 'claude-code_1.0.0_agent') +}) + type RecordedRequest = { method: string; headers: Record } const sdk = vi.hoisted(() => ({ requests: [] as RecordedRequest[] })) @@ -105,6 +111,7 @@ describe('CLI usage headers on API requests', () => { 'request-id': expect.stringMatching(UUID), 'session-id': expect.stringMatching(UUID), 'cli-command': 'user', + 'cli-agent': 'claude-code', }) })