MCPcopy Create free account
hub / github.com/anomalyco/opencode / writeProposedEdit

Method writeProposedEdit

packages/opencode/src/acp/permission.ts:99–115  ·  view source on GitHub ↗
(sessionId: string, metadata: ToolInput)

Source from the content-addressed store, hash-verified

97 }
98
99 private async writeProposedEdit(sessionId: string, metadata: ToolInput) {
100 const filepath = stringValue(metadata.filepath)
101 const diff = stringValue(metadata.diff)
102 if (!filepath || !diff || !this.input.connection.writeTextFile) return
103
104 const content = (await exists(filepath)) ? await readText(filepath) : ""
105 const next = applyPatch(content, diff)
106 if (next === false) {
107 return
108 }
109
110 void this.input.connection.writeTextFile({
111 sessionId,
112 path: filepath,
113 content: next,
114 })
115 }
116}
117
118async function permissionToolCall(input: {

Callers 1

processMethod · 0.95

Calls 3

existsFunction · 0.90
readTextFunction · 0.90
stringValueFunction · 0.70

Tested by

no test coverage detected