fix(ci): unblock CI on docs-font branch

- Add lsof to knip ignoreBinaries so the new `pnpm docs` script
  (which uses `lsof -ti:3000` to free port 3000) does not trip
  the Unlisted binaries check.
- Make CLI version assertions read @ktx/cli/package.json at runtime
  instead of hardcoding 0.0.0-private. The 0.4.0 release commit on
  main bumped the package version, breaking 18 hardcoded test cases
  in index.test.ts and admin-reindex.test.ts; reading the version
  dynamically keeps the suite green across future version bumps.
This commit is contained in:
Andrey Avtomonov 2026-05-21 00:37:38 +02:00
parent 292683181b
commit 4c71ff545f
3 changed files with 27 additions and 23 deletions

View file

@ -86,7 +86,7 @@
"**/*.gen.ts",
"**/*.generated.ts"
],
"ignoreBinaries": ["uv"],
"ignoreBinaries": ["uv", "lsof"],
"ignoreIssues": {
"packages/cli/src/clack.ts": ["exports"],
"packages/cli/src/commands/connection-metabase-setup.ts": ["exports", "types"],

View file

@ -1,8 +1,11 @@
import { createRequire } from 'node:module';
import type { ReindexSummary } from '@ktx/context/index-sync';
import { describe, expect, it, vi } from 'vitest';
import { renderReindexJson, renderReindexPlain, reindexHasErrors } from './admin-reindex.js';
import { runKtxCli } from './index.js';
const CLI_VERSION = (createRequire(import.meta.url)('@ktx/cli/package.json') as { version: string }).version;
function makeIo(options: { stdoutIsTTY?: boolean } = {}) {
let stdout = '';
let stderr = '';
@ -137,7 +140,7 @@ describe('admin reindex Commander routing', () => {
force: true,
json: true,
output: 'plain',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
},
io.io,
);

View file

@ -18,6 +18,7 @@ import {
} from './index.js';
const require = createRequire(import.meta.url);
const CLI_VERSION = (require('@ktx/cli/package.json') as { version: string }).version;
function makeIo(options: { stdoutIsTty?: boolean } = {}) {
let stdout = '';
@ -45,7 +46,7 @@ describe('getKtxCliPackageInfo', () => {
it('identifies the CLI package and its context dependency', () => {
expect(getKtxCliPackageInfo()).toEqual({
name: '@ktx/cli',
version: '0.0.0-private',
version: CLI_VERSION,
contextPackageName: '@ktx/context',
});
});
@ -55,7 +56,7 @@ describe('getKtxCliPackageInfo', () => {
expect(packageJson).toMatchObject({
name: '@ktx/cli',
version: '0.0.0-private',
version: CLI_VERSION,
});
});
@ -114,7 +115,7 @@ describe('runKtxCli', () => {
await expect(runKtxCli(['--version'], testIo.io)).resolves.toBe(0);
expect(testIo.stdout()).toBe('@ktx/cli 0.0.0-private\n');
expect(testIo.stdout()).toBe(`@ktx/cli ${CLI_VERSION}\n`);
expect(testIo.stderr()).toBe('');
});
@ -304,7 +305,7 @@ describe('runKtxCli', () => {
1,
{
command: 'install',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
feature: 'local-embeddings',
force: true,
},
@ -314,7 +315,7 @@ describe('runKtxCli', () => {
2,
{
command: 'start',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
projectDir: expect.any(String),
feature: 'local-embeddings',
force: true,
@ -325,7 +326,7 @@ describe('runKtxCli', () => {
3,
{
command: 'stop',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
projectDir: expect.any(String),
all: false,
},
@ -335,7 +336,7 @@ describe('runKtxCli', () => {
4,
{
command: 'stop',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
projectDir: expect.any(String),
all: true,
},
@ -345,7 +346,7 @@ describe('runKtxCli', () => {
5,
{
command: 'status',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
json: true,
},
statusIo.io,
@ -418,7 +419,7 @@ describe('runKtxCli', () => {
expect.objectContaining({
command: 'query',
projectDir: tempDir,
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
runtimeInstallPolicy: 'prompt',
query: expect.objectContaining({ measures: ['orders.order_count'], dimensions: [] }),
}),
@ -433,7 +434,7 @@ describe('runKtxCli', () => {
).resolves.toBe(0);
expect(sl).toHaveBeenLastCalledWith(
expect.objectContaining({
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
runtimeInstallPolicy: 'auto',
}),
autoIo.io,
@ -449,7 +450,7 @@ describe('runKtxCli', () => {
).resolves.toBe(0);
expect(sl).toHaveBeenLastCalledWith(
expect.objectContaining({
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
runtimeInstallPolicy: 'never',
}),
noInputIo.io,
@ -585,7 +586,7 @@ describe('runKtxCli', () => {
skipAgents: false,
inputMode: 'auto',
yes: false,
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
skipLlm: false,
skipEmbeddings: false,
databaseSchemas: [],
@ -715,7 +716,7 @@ describe('runKtxCli', () => {
inputMode: 'disabled',
depth: 'fast',
queryHistory: 'default',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
runtimeInstallPolicy: 'never',
},
testIo.io,
@ -742,7 +743,7 @@ describe('runKtxCli', () => {
inputMode: 'auto',
depth: 'deep',
queryHistory: 'default',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
runtimeInstallPolicy: 'prompt',
},
testIo.io,
@ -819,7 +820,7 @@ describe('runKtxCli', () => {
json: false,
inputMode: 'disabled',
queryHistory: 'default',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
runtimeInstallPolicy: 'never',
},
testIo.io,
@ -1124,7 +1125,7 @@ describe('runKtxCli', () => {
command: 'run',
projectDir: tempDir,
inputMode: 'disabled',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
anthropicApiKeyEnv: 'ANTHROPIC_API_KEY', // pragma: allowlist secret
llmModel: 'claude-sonnet-4-6',
skipLlm: false,
@ -1163,7 +1164,7 @@ describe('runKtxCli', () => {
command: 'run',
projectDir: tempDir,
inputMode: 'disabled',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
llmBackend: 'vertex',
vertexProject: 'local-gcp-project',
vertexLocation: 'us-east5',
@ -1200,7 +1201,7 @@ describe('runKtxCli', () => {
command: 'run',
projectDir: tempDir,
inputMode: 'disabled',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
llmBackend: 'claude-code',
llmModel: 'opus',
skipLlm: false,
@ -1308,7 +1309,7 @@ describe('runKtxCli', () => {
projectDir: '/tmp/project',
inputMode: 'disabled',
yes: true,
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
skipLlm: true,
skipEmbeddings: true,
databaseDrivers: ['postgres'],
@ -1649,7 +1650,7 @@ describe('runKtxCli', () => {
queryFile: '/tmp/query.json',
execute: false,
format: 'json',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
runtimeInstallPolicy: 'auto',
},
autoIo.io,
@ -1663,7 +1664,7 @@ describe('runKtxCli', () => {
queryFile: '/tmp/query.json',
execute: false,
format: 'json',
cliVersion: '0.0.0-private',
cliVersion: CLI_VERSION,
runtimeInstallPolicy: 'never',
},
neverIo.io,