Package org.machanism.machai.gw.reviewer
@guidance instructions for the Ghostwriter documentation
pipeline.
The package defines the Reviewer service
provider interface and its format adapters. A reviewer understands the comment or
document syntax of a supported format, determines whether the file contains a
guidance tag, and returns a prompt fragment containing the context required by the
downstream guidance processor. Implementations return null when a file does
not contain applicable guidance and may throw IOException when its
content cannot be read.
The available reviewers are:
JavaReviewer, which handles Java source files, including package-level guidance inpackage-info.java;MarkdownReviewer, which handles Markdown files with guidance in HTML comments;HtmlReviewer, which handles HTML, HTM, and XML comment syntax;PythonReviewer, which handles Python line comments and triple-quoted guidance blocks;TypeScriptReviewer, which handles TypeScript line and block comments;PumlReviewer, which handles PlantUML files; andTextReviewer, which handles files named@guidance.txt.
Each implementation exposes its supported extensions through
Reviewer.getSupportedFileExtensions().
A caller can use those extensions to select a reviewer, then invoke
Reviewer.perform(java.io.File, java.io.File).
The first argument is the project root and the second is the file being reviewed;
the root is used to provide stable project-relative path context in the result.
For example, a caller can try the reviewer associated with a file's extension and forward only applicable results:
Reviewer reviewer = new JavaReviewer();
String prompt = reviewer.perform(projectDirectory, sourceFile);
if (prompt != null) {
guidanceProcessor.process(prompt);
}
Reviewers are intentionally format-specific: they identify guidance according to
the syntax they support rather than treating every file as plain text. This keeps
extraction rules isolated and allows additional formats to be introduced by adding
another Reviewer implementation.
-
ClassDescription
Reviewerimplementation for Java source files (.java).Reviewerimplementation for Markdown files (.md).Reviewer implementation for PlantUML files (.puml).Reviewerimplementation for Python source files (.py).Service-provider interface (SPI) for components that scan project files and extract@guidanceinstructions for downstream processing.Reviewer implementation for generic guidance text files.Reviewerimplementation for TypeScript source files (.ts).