Class LabelEstimator

java.lang.Object
io.github.jbastgen.stemma.app.label.LabelEstimator

public final class LabelEstimator extends Object
Guesses the labels of commits with the AI, one commit at a time: for each commit the prompt names the configured labels and shows the commit's message and changes, the answer is read strictly (only configured labels count), and the labels found are applied. Commits for which the AI names no label are left alone.
  • Field Details

  • Method Details

    • buildPrompt

      public static String buildPrompt(String template, String repo, String branch, CommitData commit, List<LabelIndex.LabelDef> labels, AiConfig config)
      Fills the template for one commit: {labels} with the configured labels, and (as for the description of a commit) {repo}, {branch}, {commits} and {diff}. Files that match the privacy patterns never appear, not even by name.
    • parse

      public static List<LabelIndex.LabelDef> parse(String answer, List<LabelIndex.LabelDef> labels)
      Reads the answer: the names of labels, separated by commas, semicolons or line breaks. Only configured labels count (by name or id, without regard to case); anything else, and NONE, is ignored. At most 3.