Class ProjectStructureContextProvider
java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.context.BasicContextProvider
uno.anahata.asi.intellij.tools.project.context.AbstractProjectContextProvider
uno.anahata.asi.intellij.tools.project.context.ProjectStructureContextProvider
- All Implemented Interfaces:
ContextProvider, PropertyChangeSource, Rebindable
Provides a source-root-aware map of a project's Java structure.
Unlike a raw filesystem walk, this provider uses the IntelliJ project model
(ProjectRootManager.getContentSourceRoots() + ProjectFileIndex) so the
ASI sees the logical layout the IDE sees: each configured source root, labelled as
production or test, with its package/type tree. All model and VFS access runs inside a
ReadAction because context is assembled on a background thread.
- Author:
- anahata
-
Field Summary
Fields inherited from class AbstractProjectContextProvider
project, projectPath, projectsToolkitFields inherited from class BasicContextProvider
children, parentFields inherited from class BasicPropertyChangeSource
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionProjectStructureContextProvider(Projects projectsToolkit, String projectPath) Constructs a new project structure context provider. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappendTree(com.intellij.openapi.vfs.VirtualFile dir, StringBuilder sb, String indent, int depth) Recursively renders a source-root subtree as Markdown: directories (packages) as folders and.javafiles as types, skipping build-output and hidden dirs and capping recursion to keep the context lean.voidpopulateMessage(RagMessage ragMessage) Populates the givenRagMessagewith dynamic, just-in-time context parts.Methods inherited from class AbstractProjectContextProvider
getProjectMethods inherited from class BasicContextProvider
getAgi, getChildrenProviders, getParentProvider, setParentProviderMethods inherited from class BasicPropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, rebind, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContextProvider
getContextPosition, getDescription, getFlattenedHierarchy, getFullyQualifiedId, getHeader, getIconId, getId, getInstructionsTokenCount, getName, getRagTokenCount, getSystemInstructions, isEffectivelyProviding, isProviding, setProvidingMethods inherited from interface PropertyChangeSource
getPropertyChangeSupport
-
Constructor Details
-
ProjectStructureContextProvider
-
-
Method Details
-
populateMessage
Populates the givenRagMessagewith dynamic, just-in-time context parts. These parts are appended to the end of the user's prompt (RAG).Renders each content source root (flagged main/test) and its package/type tree, built from the IntelliJ project model inside a read action.
- Parameters:
ragMessage- The message to be augmented with context.- Throws:
Exception- if an error occurs during context generation.
-
appendTree
private void appendTree(com.intellij.openapi.vfs.VirtualFile dir, StringBuilder sb, String indent, int depth) Recursively renders a source-root subtree as Markdown: directories (packages) as folders and.javafiles as types, skipping build-output and hidden dirs and capping recursion to keep the context lean.Must be called inside a read action.
- Parameters:
dir- the current directory node.sb- the Markdown accumulator.indent- the current indentation prefix.depth- the current recursion depth.
-

