fix: improve setup wizard behavior (#127)

* fix: improve setup wizard behavior

* fix: derive runtime versions from release metadata

* test: validate metabase source mapping requirements

* Fix boundary check release identifiers
This commit is contained in:
Andrey Avtomonov 2026-05-17 19:15:09 +02:00 committed by GitHub
parent 33a142f769
commit d1c84e5564
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 671 additions and 90 deletions

View file

@ -45,7 +45,9 @@ describe('getKtxCliPackageInfo', () => {
it('identifies the CLI package and its context dependency', () => {
expect(getKtxCliPackageInfo()).toEqual({
name: '@ktx/cli',
version: '0.0.0-private',
version: '0.1.0-rc.1',
packageVersion: '0.0.0-private',
runtimeVersion: '0.1.0-rc.1',
contextPackageName: '@ktx/context',
});
});
@ -68,6 +70,8 @@ describe('getKtxCliPackageInfo', () => {
).toEqual({
name: '@kaelio/ktx',
version: '0.1.0',
packageVersion: '0.1.0',
runtimeVersion: '0.1.0',
contextPackageName: '@ktx/context',
});
});
@ -114,7 +118,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 0.1.0-rc.1\n');
expect(testIo.stderr()).toBe('');
});
@ -252,7 +256,7 @@ describe('runKtxCli', () => {
expect(listIo.stderr()).toContain("unknown option '--query'");
});
it('routes runtime management commands with the CLI package version', async () => {
it('routes runtime management commands with the release runtime version', async () => {
const runtime = vi.fn(async () => 0);
const installIo = makeIo();
const startIo = makeIo();
@ -278,7 +282,7 @@ describe('runKtxCli', () => {
1,
{
command: 'install',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
feature: 'local-embeddings',
force: true,
},
@ -288,7 +292,7 @@ describe('runKtxCli', () => {
2,
{
command: 'start',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
projectDir: expect.any(String),
feature: 'local-embeddings',
force: true,
@ -299,7 +303,7 @@ describe('runKtxCli', () => {
3,
{
command: 'stop',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
projectDir: expect.any(String),
all: false,
},
@ -309,7 +313,7 @@ describe('runKtxCli', () => {
4,
{
command: 'stop',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
projectDir: expect.any(String),
all: true,
},
@ -319,7 +323,7 @@ describe('runKtxCli', () => {
5,
{
command: 'status',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
json: true,
},
statusIo.io,
@ -392,7 +396,7 @@ describe('runKtxCli', () => {
expect.objectContaining({
command: 'query',
projectDir: tempDir,
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
runtimeInstallPolicy: 'prompt',
query: expect.objectContaining({ measures: ['orders.order_count'], dimensions: [] }),
}),
@ -407,7 +411,7 @@ describe('runKtxCli', () => {
).resolves.toBe(0);
expect(sl).toHaveBeenLastCalledWith(
expect.objectContaining({
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
runtimeInstallPolicy: 'auto',
}),
autoIo.io,
@ -423,7 +427,7 @@ describe('runKtxCli', () => {
).resolves.toBe(0);
expect(sl).toHaveBeenLastCalledWith(
expect.objectContaining({
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
runtimeInstallPolicy: 'never',
}),
noInputIo.io,
@ -562,7 +566,7 @@ describe('runKtxCli', () => {
skipAgents: false,
inputMode: 'auto',
yes: false,
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
skipLlm: false,
skipEmbeddings: false,
databaseSchemas: [],
@ -692,7 +696,7 @@ describe('runKtxCli', () => {
inputMode: 'disabled',
depth: 'fast',
queryHistory: 'default',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
runtimeInstallPolicy: 'never',
},
testIo.io,
@ -719,7 +723,7 @@ describe('runKtxCli', () => {
inputMode: 'auto',
depth: 'deep',
queryHistory: 'default',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
runtimeInstallPolicy: 'prompt',
},
testIo.io,
@ -796,7 +800,7 @@ describe('runKtxCli', () => {
json: false,
inputMode: 'disabled',
queryHistory: 'default',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
runtimeInstallPolicy: 'never',
},
testIo.io,
@ -1074,7 +1078,7 @@ describe('runKtxCli', () => {
command: 'run',
projectDir: tempDir,
inputMode: 'disabled',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
anthropicApiKeyEnv: 'ANTHROPIC_API_KEY', // pragma: allowlist secret
anthropicModel: 'claude-sonnet-4-6',
skipLlm: false,
@ -1113,7 +1117,7 @@ describe('runKtxCli', () => {
command: 'run',
projectDir: tempDir,
inputMode: 'disabled',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
llmBackend: 'vertex',
vertexProject: 'local-gcp-project',
vertexLocation: 'us-east5',
@ -1150,7 +1154,7 @@ describe('runKtxCli', () => {
command: 'run',
projectDir: tempDir,
inputMode: 'disabled',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
llmBackend: 'claude-code',
llmModel: 'opus',
skipLlm: false,
@ -1258,7 +1262,7 @@ describe('runKtxCli', () => {
projectDir: '/tmp/project',
inputMode: 'disabled',
yes: true,
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
skipLlm: true,
skipEmbeddings: true,
databaseDrivers: ['postgres'],
@ -1576,7 +1580,7 @@ describe('runKtxCli', () => {
queryFile: '/tmp/query.json',
execute: false,
format: 'json',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
runtimeInstallPolicy: 'auto',
},
autoIo.io,
@ -1590,7 +1594,7 @@ describe('runKtxCli', () => {
queryFile: '/tmp/query.json',
execute: false,
format: 'json',
cliVersion: '0.0.0-private',
cliVersion: '0.1.0-rc.1',
runtimeInstallPolicy: 'never',
},
neverIo.io,