Class TextReviewer

java.lang.Object
org.machanism.machai.gw.reviewer.TextReviewer
All Implemented Interfaces:
Reviewer

public class TextReviewer extends Object implements Reviewer
Reviewer implementation for generic guidance text files.

This reviewer only processes files named @guidance.txt. When such a file is found, its full contents are returned formatted as a prompt fragment with directory context for downstream processing.

  • Constructor Details

    • TextReviewer

      public TextReviewer()
  • Method Details

    • getSupportedFileExtensions

      public String[] getSupportedFileExtensions()
      Returns the file extensions supported by this reviewer.
      Specified by:
      getSupportedFileExtensions in interface Reviewer
      Returns:
      an array containing "txt"
    • perform

      public String perform(File projectDir, File guidancesFile) throws IOException
      Reads and formats the guidance file if the provided file is named @guidance.txt.
      Specified by:
      perform in interface Reviewer
      Parameters:
      projectDir - the project root directory used to compute related paths for context
      guidancesFile - the file to analyze
      Returns:
      the formatted guidance prompt, or null when the file is not a guidance file
      Throws:
      IOException - if an error occurs reading the file
    • getPrompt

      public String getPrompt(File projectDir, File guidancesFile, String guidance)
      Formats the raw guidance content into a prompt fragment.
      Parameters:
      projectDir - the project root directory used to compute related paths for context
      guidancesFile - the guidance file (used to compute the parent directory context)
      guidance - the raw guidance content
      Returns:
      the formatted prompt fragment, or the original guidance content if blank