theoforger / mastermind

An LLM-powered CLI tool to help you be a better spymaster in Codenames
GNU General Public License v3.0
3 stars 2 forks source link

[Feature]: Add Validation for Empty Input Files #3

Closed mayank-Pareek closed 2 weeks ago

mayank-Pareek commented 2 weeks ago

Description:

When the program receives empty input files for --to-link and --to-avoid arguments, it proceeds with calling the API and simply reports that no useful clues were returned. It should, instead, check if the input files are empty before making the API request and provide a more meaningful error message to inform the user that the input files are empty.

The language model didn't return any useful clues.

Screenshot:

image

Steps to Reproduce:

  1. Create two empty files (e.g., link.txt and avoid.txt).
  2. Run the program with these files as inputs:
    cargo run -- avoid link
  3. Observe the output:
    The language model didn't return any useful clues.

    Expected Behavior:

    The program should detect that the input files are empty and provide an error message such as:

    The input files are empty. Please provide non-empty files for the words to link and words to avoid.

    Impact:

    This issue leads to unnecessary API requests, which could be avoided by early validation. It also results in unclear feedback for the user, who may not realize that their input files are empty.

Proposed Solution:

Add a check after reading the input files to ensure that they contain at least one word before proceeding. If the files are empty, the program should terminate early with a clear message to the user.

Environment: