Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

add enhance-response command #209

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/org/springframework/cli/command/AiCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

import java.util.Optional;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.jline.utils.AttributedStringBuilder;
import org.jline.utils.AttributedStyle;

import org.springframework.beans.BeansException;
import org.springframework.cli.merger.ai.OpenAiHandler;
import org.springframework.cli.merger.ai.ResponseModifier;
import org.springframework.cli.merger.ai.service.GenerateCodeAiService;
import org.springframework.cli.util.TerminalMessage;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -57,6 +59,16 @@ public void aiAdd(@Option(
this.openAiHandler.add(description, path, preview, rewrite, terminalMessage);
}

@Command(command = "enhance-response",
description = "Enhance the AI response for a Spring project, i.e. make response Boot 3 compliant if necessary etc.")
public String aiModifyResponse(
@Option(description = "README.md file path containing the response from the AI.") String file,
@Option(description = "Path on which to run the command. Most of the time, you can not specify the path and use the default value, which is the current working directory.") String path)
throws JsonProcessingException {
ResponseModifier responseModifier = new ResponseModifier();
return responseModifier.modify(file, path);
}

private void printMissingDescriptionMessage() {
AttributedStringBuilder sb = new AttributedStringBuilder();
sb.style(sb.style().foreground(AttributedStyle.WHITE));
Expand Down