import {CommandModule} from "yargs"; import {inquire} from "../prompts/Inquire.js"; import {registerPrompts} from "../prompts/types/index.js"; import {LocalRepository} from "../repository/LocalRepository.js"; import {empathyGroupPrompt} from "../prompts/implementations/EmpathyGroupPrompt.js"; import {empathyGroupListPrompt} from "../prompts/implementations/EmpathyGroupListPrompt.js"; import {empathyGuidePrompt} from "../prompts/implementations/EmpathyGuidePrompt.js"; import {yamlPrompt} from "../schemata/YAMLPrompt.js"; export function updateEmpathyGuideCommand(): CommandModule { return { command: "update-empathy-guide", describe: "Makes changes to the empathy guide.", handler: async (): Promise => { registerPrompts() const storage = new LocalRepository() const empathyGuide = await storage.loadEmpathyGuide() const promptYaml = yamlPrompt({ inquire, showError: async (text) => console.error(text), }) const empathyGroup = empathyGroupPrompt({ inquire, promptYaml, }) const empathyList = empathyGroupListPrompt({ inquire, promptForEmpathyGroup: empathyGroup }) const newGuide = await empathyGuidePrompt({ inquire, promptYaml, promptForEmpathyGroupList: empathyList, })({default: empathyGuide}) await storage.saveEmpathyGuide(newGuide) console.log("Empathy guide saved!") } } }