UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

27 lines • 1.01 kB
import { createUnifiedPatch } from "./unified-diff.js"; export function createWriteDetails(path, content, baseline) { switch (baseline.kind) { case "missing": return { operation: "add", patch: createUnifiedPatch("/dev/null", path, "", content) }; case "present": return baseline.content === content ? undefined : { operation: "update", patch: createUnifiedPatch(path, path, baseline.content, content) }; case "unavailable": return undefined; default: { const exhaustive = baseline; return exhaustive; } } } export function formatWriteResult(result, theme) { if (!result.isError) return undefined; const output = result.content .filter((content) => content.type === "text") .map((content) => content.text || "") .join("\n"); return output ? `\n${theme.fg("error", output)}` : undefined; } //# sourceMappingURL=write-result.js.map