Class GuidanceProcessor


public class GuidanceProcessor extends AIFileProcessor
Scans a project tree, extracts per-file @guidance directives through Reviewers, and dispatches the resulting prompts to a configured Genai.

The processor supports single-module and multi-module project layouts. For multi-module builds, modules are processed child-first (each module is scanned before the parent project directory). Processing is traversal-based; it does not attempt to build projects or resolve dependencies.

  • Field Details

  • Constructor Details

    • GuidanceProcessor

      public GuidanceProcessor(File rootDir, String genai, Configurator configurator)
      Constructs a new GuidanceProcessor for processing files with guidance tags.

      Initializes the processor with the specified root directory, GenAI model identifier, and configuration. Logs the root directory and GenAI model (if provided), and loads reviewer information for guidance processing.

      Parameters:
      rootDir - the root directory to scan for files
      genai - the GenAI model identifier to use for processing (may be null)
      configurator - the configuration object for property resolution and runtime settings
  • Method Details

    • match

      protected boolean match(File file, File projectDir)
      Applies matching logic and default-guidance behavior.
      Overrides:
      match in class AbstractFileProcessor
      Parameters:
      file - candidate file/directory
      projectDir - current project directory
      Returns:
      true when the candidate should be processed
    • processModule

      protected void processModule(File projectDir, String module) throws IOException
      Processes a module directory.

      When a scan directory or pattern is configured, modules are only processed when the module itself matches or contains the scan directory.

      Overrides:
      processModule in class ProjectProcessor
      Parameters:
      projectDir - parent project directory
      module - module relative path
      Throws:
      IOException - if scanning the module fails
    • processParentFiles

      protected void processParentFiles(ProjectLayout projectLayout) throws IOException
      Processes files and folders under the parent project directory (excluding modules).
      Overrides:
      processParentFiles in class AbstractFileProcessor
      Parameters:
      projectLayout - project layout
      Throws:
      IOException - if file reading fails
    • processFile

      protected void processFile(ProjectLayout projectLayout, File file) throws IOException
      Extracts guidance for a file and, when present, performs provider processing.
      Overrides:
      processFile in class AbstractFileProcessor
      Parameters:
      projectLayout - project layout
      file - file to process
      Throws:
      IOException - if reading the file or provider execution fails
    • process

      public String process(ProjectLayout projectLayout, File file, String guidance)
      Composes the final prompt and dispatches it to the configured provider.
      Overrides:
      process in class AIFileProcessor
      Parameters:
      projectLayout - project layout
      file - file currently being processed
      guidance - extracted guidance and/or default guidance
      Returns:
      provider output
    • deleteTempFiles

      public static boolean deleteTempFiles(File basedir)
      Deletes the input-log temporary directory.
      Parameters:
      basedir - project base directory
      Returns:
      true if the directory was deleted, otherwise false
    • getReport

      public List<Map<String,Object>> getReport()
      Returns:
      the report