feat: interactive prompts and smart patch selection#37
Merged
mikolalysenko merged 2 commits intomainfrom Mar 6, 2026
Merged
Conversation
- Add shared confirm() and select_one() prompt utilities to output.rs - Smart patch selection: paid users auto-select best paid patch per PURL, free users with multiple patches get dialoguer interactive selection - Default-YES confirmation prompts (Y/n) for get, scan, and remove - Add -y/--yes flag to scan and remove commands to skip prompts - JSON mode never prompts; returns selection_required error with full vulnerability details when explicit selection is needed - Scan now shows detailed patch summary (severity, CVEs, descriptions) before confirming download - Remove shows what will be removed before confirming rollback - Extract download_and_apply_patches() shared between get and scan - Add patch update detection in scan table and download flow Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use is_none_or instead of map_or(true, ...) - Use .values() instead of destructuring with unused key Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
output.rs):confirm()for Y/n prompts (default YES),select_one()for dialoguer-based selection, both write to stderr to avoid interfering with JSON stdoutget.rs): Paid users auto-select best paid patch per PURL; free users with multiple patches get interactive selection; JSON mode returnsselection_requirederror with full vulnerability details (severity, CVEs, summaries)scan.rs): After displaying the scan table, fetches full patch details, shows a per-patch summary with severity/CVEs/descriptions, then confirms before downloading. Adds-y/--yesflag and[UPDATE]markers for packages with newer patchesremove.rs): Shows what will be removed (PURL, UUID, file count) and confirms before rollback. Adds-y/--yesflagdownload_and_apply_patches(): Shared download logic used by bothgetandscan, with update detection ([update]log when replacing existing patches)Prompt behavior by mode
-yflagselection_requirederror with optionsTest plan
cargo build— clean, no warningscargo test --features cargo— all 260 tests passsocket-patch scan— see table + patch summary + Y/n download promptsocket-patch scan --json— no prompt, JSON output onlysocket-patch scan -y— auto-downloads without promptsocket-patch get <purl>— see Y/n prompt, default yes on entersocket-patch get <purl> --json— no promptsocket-patch remove <purl>— see details + confirmationsocket-patch remove <purl> -y— auto-proceeds🤖 Generated with Claude Code