fix(cli): remove legacy ingest and wiki commands

This commit is contained in:
Andrey Avtomonov 2026-05-13 22:42:07 +02:00
parent 011d694ed3
commit 75e04cfa56
41 changed files with 328 additions and 851 deletions

View file

@ -257,7 +257,6 @@ describe('standalone example docs', () => {
assert.match(ingestReference, /--query-history-window-days <days>/);
assert.match(buildingContext, /ktx ingest <connection-id>/);
assert.match(buildingContext, /ktx ingest --all/);
assert.match(buildingContext, /ktx ingest replay <run-id>/);
assert.match(contextSources, /ktx ingest <connectionId>/);
assert.match(contextAsCode, /ktx ingest --all --no-input/);
assert.match(quickstart, /schema context/);
@ -272,11 +271,15 @@ describe('standalone example docs', () => {
assert.doesNotMatch(cliMeta, /ktx-scan/);
assert.doesNotMatch(ingestReference, /ktx ingest run/);
assert.doesNotMatch(ingestReference, /ktx ingest status/);
assert.doesNotMatch(ingestReference, /ktx ingest replay/);
assert.doesNotMatch(ingestReference, /--adapter/);
assert.doesNotMatch(ingestReference, /ktx ingest watch/);
assert.doesNotMatch(ingestReference, /live-database/);
assert.doesNotMatch(devReference, /ktx scan/);
assert.doesNotMatch(buildingContext, /ktx ingest watch/);
assert.doesNotMatch(buildingContext, /ktx ingest status/);
assert.doesNotMatch(buildingContext, /ktx ingest replay/);
assert.doesNotMatch(buildingContext, /historic-sql/);
assert.doesNotMatch(buildingContext, /live-database/);
assert.doesNotMatch(contextSources, /ktx ingest run --connection-id/);

View file

@ -113,10 +113,6 @@ export function buildLiveDatabaseIngestArgs(projectDir, _databaseIntrospectionUr
];
}
export function buildLiveDatabaseStatusArgs(projectDir, runId) {
return ['exec', 'ktx', 'ingest', 'status', '--project-dir', projectDir, runId];
}
async function run(command, args, options = {}) {
process.stdout.write(`$ ${command} ${args.join(' ')}\n`);
return new Promise((resolve) => {
@ -167,7 +163,7 @@ function requireOutput(label, result, pattern) {
function getRunId(stdout) {
const match = stdout.match(/^Run: (.+)$/m);
if (!match) {
throw new Error(`ingest run output did not include a run id\nstdout:\n${stdout}`);
throw new Error(`ingest output did not include a run id\nstdout:\n${stdout}`);
}
return match[1];
}
@ -322,16 +318,6 @@ async function main() {
requireOutput('ktx ingest warehouse --fast', ingestRun, /Database schema/);
const runId = getRunId(ingestRun.stdout);
const ingestStatus = await run('pnpm', buildLiveDatabaseStatusArgs(projectDir, runId), {
cwd: cleanInstallDir,
env: managedRuntimeEnv(cleanInstallDir),
timeout: 30_000,
});
requireSuccess('ktx ingest status live-database', ingestStatus);
requireOutput('ktx ingest status live-database', ingestStatus, new RegExp(`Run: ${runId}`));
requireOutput('ktx ingest status live-database', ingestStatus, /Status: done/);
requireOutput('ktx ingest status live-database', ingestStatus, /Raw files: 4/);
requireOutput('ktx ingest status live-database', ingestStatus, /Work units: 2/);
await assertPathExists(join(projectDir, '.ktx', 'db.sqlite'), 'SQLite local ingest state');
process.stdout.write(`Installed live-database artifact smoke passed: ${runId}\n`);
} finally {

View file

@ -5,7 +5,6 @@ import {
buildDockerRunArgs,
buildKtxYaml,
buildLiveDatabaseIngestArgs,
buildLiveDatabaseStatusArgs,
buildPostgresUrl,
buildPostgresReadyArgs,
buildSeedSql,
@ -95,7 +94,7 @@ describe('installed live-database artifact smoke helpers', () => {
]);
});
it('builds installed CLI public database ingest and status commands', () => {
it('builds the installed CLI public database ingest command', () => {
assert.deepEqual(buildLiveDatabaseIngestArgs('/tmp/project', 'http://127.0.0.1:8765'), [
'exec',
'ktx',
@ -107,14 +106,5 @@ describe('installed live-database artifact smoke helpers', () => {
'--no-input',
]);
assert.deepEqual(buildLiveDatabaseStatusArgs('/tmp/project', 'local-run-1'), [
'exec',
'ktx',
'ingest',
'status',
'--project-dir',
'/tmp/project',
'local-run-1',
]);
});
});

View file

@ -561,7 +561,7 @@ function requireIncludes(values, expected, label) {
function getRunId(stdout) {
const match = stdout.match(/^Run: (.+)$/m);
assert.ok(match, 'ingest run output did not include a run id');
assert.ok(match, 'ingest output did not include a run id');
return match[1];
}
@ -588,7 +588,6 @@ process.env.KTX_RUNTIME_ROOT = join(root, 'managed-runtime');
let daemonStarted = false;
try {
const projectDir = join(root, 'project');
const sourceDir = join(root, 'source');
const version = await run('pnpm', ['exec', 'ktx', '--version']);
requireSuccess('ktx public package version', version);
@ -842,27 +841,8 @@ try {
const enrichedScanRunId = getRunId(enrichedScan.stdout);
process.stdout.write('ktx ingest deep verified: ' + enrichedScanRunId + '\\n');
await mkdir(join(sourceDir, 'orders'), { recursive: true });
await writeFile(join(sourceDir, 'orders', 'orders.json'), '{"name":"orders"}\\n', 'utf-8');
const ingestRun = await run('pnpm', ['exec', 'ktx', 'ingest', 'run',
'--project-dir',
projectDir,
'--connection-id',
'warehouse',
'--adapter',
'fake',
'--source-dir',
sourceDir,
]);
assert.equal(ingestRun.code, 1, 'ktx ingest run without an LLM provider must fail');
assert.match(
ingestRun.stderr,
/ktx ingest run requires llm\\.provider\\.backend: anthropic, vertex, or gateway, or an injected agentRunner/,
);
await access(join(projectDir, '.ktx', 'db.sqlite'));
process.stdout.write('ktx ingest provider guard verified\\n');
process.stdout.write('ktx ingest state verified\\n');
} finally {
if (daemonStarted) {
await run('pnpm', ['exec', 'ktx', 'dev', 'runtime', 'stop']);

View file

@ -495,11 +495,11 @@ describe('verification snippets', () => {
assert.match(source, /ktx ingest deep verified/);
assert.match(source, /enrichment:/);
assert.match(source, /mode: deterministic/);
assert.match(source, /run\('pnpm', \['exec', 'ktx', 'ingest', 'run'/);
assert.doesNotMatch(source, /run\('pnpm', \['exec', 'ktx', 'ingest', 'run'/);
assert.match(source, /access\(join\(projectDir, '\.ktx', 'db\.sqlite'\)\)/);
assert.match(source, /SQLite wiki index/);
assert.match(source, /ktx ingest run requires llm\\.provider\\.backend: anthropic, vertex, or gateway/);
assert.match(source, /ktx ingest provider guard verified/);
assert.doesNotMatch(source, /ktx ingest run requires llm\\.provider\\.backend: anthropic, vertex, or gateway/);
assert.match(source, /ktx ingest state verified/);
});
describe('npmCliSmokeSource', () => {