Class GuidanceProcessor
java.lang.Object
org.machanism.machai.project.ProjectProcessor
org.machanism.machai.gw.processor.AbstractFileProcessor
org.machanism.machai.gw.processor.AIFileProcessor
org.machanism.machai.gw.processor.GuidanceProcessor
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 Summary
FieldsFields inherited from class org.machanism.machai.gw.processor.AIFileProcessor
CONTINUE_SPECIAL_PROMPT_COMMAND, EXIT_SPECIAL_PROMPT_COMMAND, FILE_INCLUDED_MARKER, GW_TEMP_DIR, LOG_OUTPUT_PREFIX, NOT_DEFINED_VALUE, PUBLIC_PROP_GROUP_NAMEFields inherited from class org.machanism.machai.gw.processor.AbstractFileProcessor
GW_PROJECT_LAYOUT_PROP_PREFIXFields inherited from class org.machanism.machai.project.ProjectProcessor
MACHAI_TEMP_DIR -
Constructor Summary
ConstructorsConstructorDescriptionGuidanceProcessor(File rootDir, String genai, Configurator configurator) Constructs a newGuidanceProcessorfor processing files with guidance tags. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandeleteTempFiles(File basedir) Deletes the input-log temporary directory.protected booleanApplies matching logic and default-guidance behavior.process(ProjectLayout projectLayout, File file, String guidance) Composes the final prompt and dispatches it to the configured provider.protected voidprocessFile(ProjectLayout projectLayout, File file) Extracts guidance for a file and, when present, performs provider processing.protected voidprocessModule(File projectDir, String module) Processes a module directory.protected voidprocessParentFiles(ProjectLayout projectLayout) Processes files and folders under the parent project directory (excluding modules).Methods inherited from class org.machanism.machai.gw.processor.AIFileProcessor
addTool, getDefaultPrompt, getInstructions, getModel, getProcessInfo, input, isInteractive, isLogInputs, parseLines, process, processFolder, scanDocuments, setDefaultPrompt, setInstructions, setInteractive, setLogInputs, setModel, setProjectLayoutContextMethods inherited from class org.machanism.machai.gw.processor.AbstractFileProcessor
getConfigurator, getExcludes, getModuleThreadTimeoutMinutes, getPath, getPathMatcher, getRootDir, isModuleDir, isNonRecursive, processProjectDir, scanFolder, setDegreeOfConcurrency, setExcludes, setModuleThreadTimeoutMinutes, setNonRecursive, setPath, setPathMatcher, shouldExcludePathMethods inherited from class org.machanism.machai.project.ProjectProcessor
getProjectLayout
-
Field Details
-
GUIDANCE_TAG_NAME
Tag name for guidance comments.- See Also:
-
-
Constructor Details
-
GuidanceProcessor
Constructs a newGuidanceProcessorfor 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 filesgenai- the GenAI model identifier to use for processing (may benull)configurator- the configuration object for property resolution and runtime settings
-
-
Method Details
-
match
Applies matching logic and default-guidance behavior.- Overrides:
matchin classAbstractFileProcessor- Parameters:
file- candidate file/directoryprojectDir- current project directory- Returns:
truewhen the candidate should be processed
-
processModule
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:
processModulein classProjectProcessor- Parameters:
projectDir- parent project directorymodule- module relative path- Throws:
IOException- if scanning the module fails
-
processParentFiles
Processes files and folders under the parent project directory (excluding modules).- Overrides:
processParentFilesin classAbstractFileProcessor- Parameters:
projectLayout- project layout- Throws:
IOException- if file reading fails
-
processFile
Extracts guidance for a file and, when present, performs provider processing.- Overrides:
processFilein classAbstractFileProcessor- Parameters:
projectLayout- project layoutfile- file to process- Throws:
IOException- if reading the file or provider execution fails
-
process
Composes the final prompt and dispatches it to the configured provider.- Overrides:
processin classAIFileProcessor- Parameters:
projectLayout- project layoutfile- file currently being processedguidance- extracted guidance and/or default guidance- Returns:
- provider output
-
deleteTempFiles
Deletes the input-log temporary directory.- Parameters:
basedir- project base directory- Returns:
trueif the directory was deleted, otherwisefalse
-
getReport
- Returns:
- the report
-