feat(cli): skip-context-sources menu + clack-style tree picker UX (#213)

* feat(cli): add 'skip context sources' option to database setup menu

After databases are configured, the post-setup menu now offers a 'Skip
context sources' choice equivalent to passing --skip-sources, which
plumbs through KtxSetupDatabasesResult.skipSources to bypass the
context-source step in the same run.

* feat(cli): standardize tree picker UX after clack autocomplete-multiselect

Search is always on (no '/' to enter): typed printable chars feed the
query, Tab toggles selection on the focused node without leaving the
search bar, and Space toggles only after arrow-key navigation
(isNavigating); otherwise it is appended to the query. Esc clears a
non-empty query before quitting, Ctrl+A and Ctrl+N replace bare-letter
bulk bindings, and the cursor refocuses on the first match when the
query change would hide it.
This commit is contained in:
Andrey Avtomonov 2026-05-24 19:29:37 +02:00 committed by GitHub
parent 96952fb43c
commit cfd1749ab9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 292 additions and 83 deletions

View file

@ -56,7 +56,12 @@ export interface KtxSetupDatabasesArgs {
}
export type KtxSetupDatabasesResult =
| { status: 'ready'; projectDir: string; connectionIds: string[] }
| {
status: 'ready';
projectDir: string;
connectionIds: string[];
skipSources?: boolean;
}
| { status: 'skipped'; projectDir: string }
| { status: 'back'; projectDir: string }
| { status: 'missing-input'; projectDir: string }
@ -633,6 +638,7 @@ function configuredPrimarySourcesPrompt(connectionIds: string[]): {
message: `Databases configured: ${connectionIds.join(', ')}\nWhat would you like to do?`,
options: [
{ value: 'continue', label: 'Continue to context sources' },
{ value: 'skip-sources', label: 'Skip context sources' },
{ value: 'edit', label: 'Edit an existing database' },
{ value: 'add', label: 'Add another database' },
],
@ -2167,6 +2173,15 @@ export async function runKtxSetupDatabasesStep(
await markDatabasesComplete(args.projectDir, selectedConnectionIds);
return { status: 'ready', projectDir: args.projectDir, connectionIds: selectedConnectionIds };
}
if (action === 'skip-sources') {
await markDatabasesComplete(args.projectDir, selectedConnectionIds);
return {
status: 'ready',
projectDir: args.projectDir,
connectionIds: selectedConnectionIds,
skipSources: true,
};
}
if (action === 'edit') {
const connectionId = await choosePrimarySourceToEdit({
projectDir: args.projectDir,