You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.6 KiB
43 lines
1.6 KiB
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<void> => {
|
|
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!")
|
|
}
|
|
}
|
|
} |