feature/add --yes/--force flags and use click.confirm for prompts#228
Open
michaelj094 wants to merge 1 commit intoAffineFoundation:mainfrom
Open
Conversation
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.
Add
--yes/--forceflags and convert interactive prompts toclick.confirmfor DB CLISummary
input()confirmation prompts in the database CLI withclick.confirm().--yes(-y) and--force(-f) CLI options so destructive commands can run in CI or scripts.print()outputs withclick.echo()in the changed flows for better Click integration.Motivation
Interactive
input()prompts block automation and are hard to test.click.confirm()integrates with Click’s test harness (CliRunner) and improves predictability. Adding--yes/--forceallows safe non-interactive operation for CI/automation while keeping interactive safeguards by default.Files changed
affine/database/cli.py— primary changes:input()withclick.confirm().yes: bool = Falseparameter to relevant async helper functions.--yes/-yand--force/-fand forward the option to async helpers.print()calls toclick.echo()in the affected flows.(No other files are intentionally modified by this PR.)
Behavior — before / after
af db resetusedinput()and required typingyesto proceed.af db resetprompts viaclick.confirm()by default, andaf db reset -yoraf db reset -fruns without prompting.Interactive behavior remains the default to avoid accidental destructive actions.
Commands / Examples
Interactive (prompt):
af db resetaf db reset-table --table sample_resultsaf db blacklist clearNon-interactive (no prompt):
af db reset -yaf db reset -faf db reset-table --table sample_results -yaf db delete-samples-by-range --env agentgym:alfworld --start-task-id 0 --end-task-id 100 -yBackward compatibility
Implementation notes
click.confirm()was chosen for compatibility with Click testing tooling.--yesand--forceare supported (--forceis an alias).yesboolean so both sync CLI wrappers and tests can bypass prompts programmatically.Safety & Security
--yesusage in CI or admin scripts to make automation explicit.