Package io.github.jbastgen.stemma.app.ai
Class CoworkContext
java.lang.Object
io.github.jbastgen.stemma.app.ai.CoworkContext
Puts data of the repository into a prompt of the Cowork view. Only what a prompt asks for by name is added:
{repo},
{branch}, {tags}, {commits} (short id, subject, date and labels, never the author or the changes),
{changes} (status and path of the changed files, never their content; files that match the privacy patterns are left out)
and {committers} (the number of commits per person). A prompt without these words sends nothing but the repository's name and
the branch.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordOne commit as it is sent: short id, subject, date and labels; no author.static final recordstatic final recordWhat is known about the repository.static final recordA word that a prompt can use to ask for data of the repository, with what it stands for (shown as a tool tip). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List<CoworkContext.Placeholder> All wordsexpand(java.lang.String, io.github.jbastgen.stemma.app.ai.CoworkContext.Facts, java.util.List<java.lang.String>, java.lang.String)knows, in the order the Cowork view offers them. -
Method Summary
Modifier and TypeMethodDescriptionstatic CoworkContext.ExpandedReplaces the words of the prompt with data of the repository.
-
Field Details
-
PLACEHOLDERS
All wordsexpand(java.lang.String, io.github.jbastgen.stemma.app.ai.CoworkContext.Facts, java.util.List<java.lang.String>, java.lang.String)knows, in the order the Cowork view offers them.
-
-
Method Details
-
expand
public static CoworkContext.Expanded expand(String prompt, CoworkContext.Facts facts, List<String> excludePatterns, String language) Replaces the words of the prompt with data of the repository. Only what the prompt asks for is added, the paths of excluded files are left out, and a hint to answer inlanguageis added when one is given.- Parameters:
excludePatterns- the privacy patterns of the AI settings- Returns:
- the text to send and what was attached, for the user to see
-