MCPcopy Index your code
hub / github.com/anomalyco/opencode / emitPatch

Function emitPatch

packages/opencode/src/cli/cmd/run/demo.ts:629–656  ·  view source on GitHub ↗
(state: State)

Source from the content-addressed store, hash-verified

627}
628
629function emitPatch(state: State): void {
630 const file = path.join(process.cwd(), "src", "demo-format.ts")
631 const ref = make(state, "apply_patch", {
632 patchText: "*** Begin Patch\n*** End Patch",
633 })
634 doneTool(state, ref, {
635 title: "apply_patch",
636 output: "",
637 metadata: {
638 files: [
639 {
640 type: "update",
641 filePath: file,
642 relativePath: "src/demo-format.ts",
643 diff: "@@ -1 +1 @@\n-export const demo = 1\n+export const demo = 42\n",
644 deletions: 1,
645 },
646 {
647 type: "add",
648 filePath: path.join(process.cwd(), "README-demo.md"),
649 relativePath: "README-demo.md",
650 diff: "@@ -0,0 +1,4 @@\n+# Demo\n+This is a generated preview file.\n",
651 deletions: 0,
652 },
653 ],
654 },
655 })
656}
657
658function emitTask(state: State): void {
659 const ref = make(state, "task", {

Callers 1

emitFmtFunction · 0.85

Calls 3

makeFunction · 0.70
doneToolFunction · 0.70
cwdMethod · 0.65

Tested by

no test coverage detected