Skip to content

ux: warn when both a positional prompt and --prompt-file are provided #16

@practicalmind-dev

Description

@practicalmind-dev

Problem

When a user passes both an inline prompt and --prompt-file, the file silently
wins and the inline prompt is discarded with no warning:

assayer run "this is ignored" --prompt-file prompt.txt --models gpt-4o

There is no indication that "this is ignored" was dropped. This is confusing,
especially for users building wrapper scripts.

Location

assayer/cli/main.py, inside the run command:

if prompt_file:
    with open(prompt_file) as f:
        prompt_text = f.read().strip()
elif prompt:
    prompt_text = prompt

What to do

Add a warning to stderr when both are supplied:

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()

How to test

Add a test in tests/test_cli.py using CliRunner that passes both a prompt
argument and a --prompt-file, and asserts the warning appears in the output.
No mocking needed for this case, the validation runs before any API call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions