From fcbb1c3cd69d81b3f423d3cfe97b4071e86a7c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20=C5=9Een?= <79153020+MuhammedSenn@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:18:13 +0300 Subject: [PATCH] Warn when prompt file overrides inline prompt --- assayer/cli/main.py | 6 ++++++ tests/test_cli.py | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/assayer/cli/main.py b/assayer/cli/main.py index 5612721..faa36c3 100644 --- a/assayer/cli/main.py +++ b/assayer/cli/main.py @@ -82,6 +82,12 @@ def run( timeout: float, ) -> None: if prompt_file: + if prompt: + click.echo( + "Warning: --prompt-file takes precedence; " + "the inline prompt is ignored.", + err=True, + ) with open(prompt_file) as f: prompt_text = f.read().strip() elif prompt: diff --git a/tests/test_cli.py b/tests/test_cli.py index 24a3ece..4ec6e5a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -49,6 +49,30 @@ def test_run_var_missing_template_key_exits_with_error(): assert "missing" in result.output +def test_run_warns_when_prompt_and_prompt_file_are_both_supplied(tmp_path): + prompt_file = tmp_path / "prompt.txt" + prompt_file.write_text("prompt from file") + + result = CliRunner().invoke( + cli, + [ + "run", + "inline prompt", + "--prompt-file", + str(prompt_file), + "--models", + "gpt-4o", + "--var", + "BADFORMAT", + ], + ) + + assert ( + "Warning: --prompt-file takes precedence; the inline prompt is ignored." + in result.output + ) + + # --------------------------------------------------------------------------- # run — successful flow # ---------------------------------------------------------------------------