Package org.egothor.methodatlas.ai
This package contains the infrastructure required to obtain AI-assisted suggestions for security tagging of JUnit 5 tests. The subsystem analyzes complete test classes, submits classification prompts to an AI provider, and converts the returned results into structured suggestions that can be consumed by the main application.
Architecture Overview
The AI subsystem follows a layered design:
- Engine layer –
AiSuggestionEngineorchestrates provider communication and taxonomy handling. - Provider layer – implementations of
AiProviderClientintegrate with specific AI services such as Ollama, OpenAI-compatible APIs, or Anthropic. - Prompt construction –
PromptBuilderbuilds the prompt that instructs the model how to perform security classification. - Taxonomy definition –
DefaultSecurityTaxonomyandOptimizedSecurityTaxonomydefine the controlled vocabulary used for tagging. - Result normalization – AI responses are converted into the
structured domain model (
AiClassSuggestionandAiMethodSuggestion).
Security Considerations
Source code analyzed by the AI subsystem may contain sensitive information.
For environments where external transmission of code is undesirable, the
subsystem supports local inference through
OllamaClient.
Deterministic Output
The subsystem is designed to obtain deterministic, machine-readable output from AI models. Prompts enforce strict JSON responses and classification decisions are constrained by a controlled taxonomy.
Extensibility
Additional AI providers can be integrated by implementing
AiProviderClient and registering the
implementation in AiProviderFactory.
- Since:
- 1.0.1
-
ClassDescriptionImmutable AI-generated classification result for a single parsed test class.Immutable AI-generated security classification result for a single test method.Immutable configuration describing how AI-based enrichment should be performed during a
MethodAtlasAppexecution.Mutable builder used to construct validatedAiOptionsinstances.Built-in taxonomy modes used for security classification.Enumeration of supported AI provider implementations used by theAiSuggestionEngine.Provider-specific client abstraction used to communicate with external AI inference services.Factory responsible for creating provider-specific AI client implementations.High-level AI orchestration contract for security classification of parsed test classes.Default implementation ofAiSuggestionEnginethat coordinates provider selection and taxonomy loading for AI-based security classification.Checked exception indicating failure during AI-based suggestion generation or related AI subsystem operations.AiProviderClientimplementation for the Anthropic API.Provides the default built-in taxonomy used to guide AI-based security classification of JUnit test methods.Small HTTP utility component used by AI provider clients for outbound network communication and JSON processing support.Utility methods for extracting JSON fragments from free-form text produced by AI model responses.Handles the consume phase of the manual AI workflow.Handles the prepare phase of the manual AI workflow.AiProviderClientimplementation for a locally running Ollama inference service.AiProviderClientimplementation for AI providers that expose an OpenAI-compatible chat completion API.Provides the optimized built-in taxonomy used to guide AI-based security classification when prompt compactness and model reliability are prioritized.Utility responsible for constructing the prompt supplied to AI providers for security classification of JUnit test classes.Deterministically extracted test method descriptor supplied to the prompt.Immutable lookup structure providing efficient access to AI-generated method suggestions by method name.