Skip to content

feat(scan): guided engine pick + examples in --help#34

Merged
Maksim-Gr merged 4 commits into
mainfrom
feat/scan-interactive-generate
Jun 28, 2026
Merged

feat(scan): guided engine pick + examples in --help#34
Maksim-Gr merged 4 commits into
mainfrom
feat/scan-interactive-generate

Conversation

@Maksim-Gr

@Maksim-Gr Maksim-Gr commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Addresses two user-friendliness gaps: the two-step scantable workflow, and poor discoverability without the README.

What changed

Guided generation in scan. After printing suggestions, scan now offers to generate a migration from one of them, so you don't have to re-type a full table --engine X --order-by ... command:

Pick an engine to generate [1-3, Enter to skip]: 2
Written: ./video_events_up.sql
Written: ./video_events_down.sql
  • Only prompts when stdin is a real terminal and the input is a file (not -). Piped/scripted/redirected runs are byte-for-byte unchanged — no prompt, no files.
  • Empty / invalid / out-of-range input skips silently (today's behavior).
  • Writes {name}_up.sql/{name}_down.sql to the current dir using the picked suggestion's engine + ORDER BY. scan -n now names those files.

Examples in --help. Added an EXAMPLES section to the top-level command and every subcommand (scan/table/kafka/diff), reusing the README's example invocations.

Demo GIF. Added a VHS terminal demo (assets/demo.gif + assets/demo.tape, regenerable with vhs assets/demo.tape) and embedded it at the top of the README.

Refactor. Extracted the table-generation body into generate_table_migration(), shared by the table command and the new scan prompt (no behavior change for table).

scan now offers to generate a migration from one of its suggestions when run
in an interactive terminal, so you no longer have to re-type a table command
with --engine/--order-by. Piped or scripted runs are unchanged: the prompt is
skipped unless stdin is a TTY and the input is a real file.

Also add an EXAMPLES section to --help for the top-level command and each
subcommand to improve discoverability.

Refactor the table-generation path into generate_table_migration(), shared by
the table command and the new scan prompt.
Render with: vhs assets/demo.tape (or the charmbracelet/vhs docker image).
The demo shows scan analyzing video_events.json, suggesting engines, and the
interactive prompt generating a ReplacingMergeTree migration.
@Maksim-Gr Maksim-Gr merged commit f8ec8b8 into main Jun 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant