mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-13 08:15:14 +02:00
* feat(cli): add RSA key-pair auth option to Snowflake setup wizard Extends the interactive Snowflake setup flow with an authentication-method prompt (password vs RSA/JWT key-pair). The RSA branch collects a private-key path (env/file/absolute) and an optional passphrase; the resulting connection config records `authMethod: 'rsa'` with `privateKey` and `passphrase` instead of `password`. * feat(scan): pool Snowflake sessions * fix(scan): reuse structural snapshots and cleanup connectors * feat(scan): parallelize relationship profiling * feat(scan): batch table description generation * docs: document Snowflake ingest concurrency knobs * fix(scan): close Snowflake ingest perf verification gaps * fix(scan): keep batched description failure bounded
78 lines
2.8 KiB
TypeScript
78 lines
2.8 KiB
TypeScript
import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
import { tmpdir } from 'node:os';
|
|
import { join } from 'node:path';
|
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
|
|
import { buildProjectStackSnapshotFields } from './project-snapshot.js';
|
|
|
|
describe('buildProjectStackSnapshotFields', () => {
|
|
let projectDir: string;
|
|
|
|
beforeEach(async () => {
|
|
projectDir = await mkdtemp(join(tmpdir(), 'ktx-stack-snapshot-'));
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await rm(projectDir, { recursive: true, force: true });
|
|
});
|
|
|
|
it('summarizes connectors and project capabilities without names or paths', async () => {
|
|
await mkdir(join(projectDir, 'semantic-layer', 'warehouse'), { recursive: true });
|
|
await mkdir(join(projectDir, 'wiki', 'global'), { recursive: true });
|
|
await writeFile(join(projectDir, 'semantic-layer', 'warehouse', 'orders.yaml'), 'name: orders\n');
|
|
await writeFile(join(projectDir, 'wiki', 'global', 'revenue.md'), '# Revenue\n');
|
|
await writeFile(join(projectDir, '.mcp.json'), '{"mcpServers":{"ktx":{}}}\n');
|
|
|
|
const fields = await buildProjectStackSnapshotFields({
|
|
projectDir,
|
|
config: {
|
|
connections: {
|
|
orbit_demo: { driver: 'sqlite', path: join(projectDir, 'demo.db') },
|
|
warehouse: { driver: 'postgres', readonly: true },
|
|
},
|
|
ingest: {
|
|
adapters: [],
|
|
embeddings: { backend: 'sentence-transformers', dimensions: 384 },
|
|
workUnits: { stepBudget: 40, maxConcurrency: 1, failureMode: 'continue' },
|
|
},
|
|
llm: { provider: { backend: 'none' }, models: {}, promptCaching: {} },
|
|
scan: {
|
|
enrichment: { mode: 'none' },
|
|
relationships: {
|
|
enabled: true,
|
|
llmProposals: true,
|
|
validationRequiredForManifest: true,
|
|
acceptThreshold: 0.85,
|
|
reviewThreshold: 0.55,
|
|
maxLlmTablesPerBatch: 40,
|
|
maxCandidatesPerColumn: 25,
|
|
profileSampleRows: 10000,
|
|
profileConcurrency: 4,
|
|
validationConcurrency: 4,
|
|
},
|
|
},
|
|
storage: {
|
|
state: 'sqlite',
|
|
search: 'sqlite-fts5',
|
|
git: { auto_commit: true, author: 'ktx <ktx@example.com>' },
|
|
},
|
|
agent: { run_research: { enabled: false, max_iterations: 20, default_toolset: [] } },
|
|
memory: { auto_commit: true },
|
|
},
|
|
});
|
|
|
|
expect(fields).toEqual({
|
|
connectors: [
|
|
{ driver: 'sqlite', isDemo: true },
|
|
{ driver: 'postgres', isDemo: false },
|
|
],
|
|
connectionCount: 2,
|
|
hasSl: true,
|
|
hasWiki: true,
|
|
hasMcp: true,
|
|
hasManagedRuntime: true,
|
|
});
|
|
expect(JSON.stringify(fields)).not.toContain(projectDir);
|
|
expect(JSON.stringify(fields)).not.toContain('warehouse');
|
|
});
|
|
});
|