relaycode
Version:
A developer assistant that automates applying code changes from LLMs.
2 lines • 1.32 kB
JavaScript
import n from'chalk';import {normalizeGitCommitMsg}from'relaycode-core';const m=e=>{switch(e.type){case "write":return `${n.green("write")}: ${n.cyan(e.path)}`;case "delete":return `${n.red("delete")}: ${n.cyan(e.path)}`;case "rename":return `${n.yellow("rename")}: ${n.cyan(e.from)} -> ${n.cyan(e.to)}`}},$=(e,r={})=>{const{showOperations:s,showSpacing:a,showReasoning:t=true}=r,o=[`- ${n.bold("UUID")}: ${n.gray(e.uuid)}`,` ${n.bold("Date")}: ${new Date(e.createdAt).toLocaleString()}`];if(e.promptSummary&&o.push(` ${n.bold("Prompt Summary")}: ${e.promptSummary}`),e.gitCommitMsg&&o.push(` ${n.bold("Git Commit")}: "${normalizeGitCommitMsg(e.gitCommitMsg)}"`),typeof e.linesAdded=="number"&&typeof e.linesRemoved=="number"){const i=typeof e.linesDifference=="number"?` (${n.yellow(`${e.linesDifference} total`)})`:"";o.push(` ${n.bold("Lines Changed")}: ${n.green(`+${e.linesAdded}`)}, ${n.red(`-${e.linesRemoved}`)}${i}`);}return t&&e.reasoning&&e.reasoning.length>0&&(o.push(` ${n.bold("Reasoning")}:`),e.reasoning.forEach(i=>o.push(` - ${i}`))),s&&e.operations&&e.operations.length>0&&(o.push(` ${n.bold("Changes")}:`),e.operations.forEach(i=>o.push(` - ${m(i)}`))),a&&o.push(""),o};export{$ as formatTransactionDetails};//# sourceMappingURL=formatters.js.map
//# sourceMappingURL=formatters.js.map