Switch to the YAML-based prompt file
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 31 Aug 2025 01:04:16 +0000 (04:04 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 31 Aug 2025 01:04:16 +0000 (04:04 +0300)
src/main/java/eu/svjatoslav/alyverkko_cli/commands/WizardCommand.java
src/main/java/eu/svjatoslav/alyverkko_cli/configuration/Configuration.java
src/main/java/eu/svjatoslav/alyverkko_cli/configuration/PromptConfig.java [new file with mode: 0644]

index f68192f..742bd06 100644 (file)
@@ -154,7 +154,7 @@ public class WizardCommand implements Command {
                         configuration.getPromptsDirectory(),
                         "Prompts directory",
                         null,
-                        "The prompts directory is where the AI prompt files (*.txt) are stored. " +
+                        "The prompts directory is where the AI prompt files (*.yaml) are stored. " +
                                 "Please specify new prompts directory path.",
                         true)
         );
index 01ed019..db4d82f 100644 (file)
@@ -5,8 +5,9 @@ import lombok.Data;
 
 import java.io.*;
 import java.util.List;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
 
-import static eu.svjatoslav.commons.file.IOHelper.getFileContentsAsString;
 
 /**
  * <p>Central configuration class storing all application parameters.
@@ -79,11 +80,14 @@ public class Configuration {
      * maps to "writer.txt" in the prompt's directory.
      *
      * @param promptName the name of the prompt file (without ".txt").
-     * @return the full text content of the prompt file.
+     * @return the full-text content of the prompt file.
      * @throws IOException if reading the prompt file fails.
      */
     public String getPromptByName(String promptName) throws IOException {
-        File promptFile = new File(promptsDirectory, promptName + ".txt");
-        return getFileContentsAsString(promptFile);
+        File promptFile = new File(promptsDirectory, promptName + ".yaml");
+        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+        PromptConfig config = mapper.readValue(promptFile, PromptConfig.class);
+        return config.getPrompt();
     }
+
 }
diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/PromptConfig.java b/src/main/java/eu/svjatoslav/alyverkko_cli/configuration/PromptConfig.java
new file mode 100644 (file)
index 0000000..55cb4e7
--- /dev/null
@@ -0,0 +1,8 @@
+package eu.svjatoslav.alyverkko_cli.configuration;
+
+import lombok.Data;
+
+@Data
+public class PromptConfig {
+    private String prompt;
+}
\ No newline at end of file