MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / commit

Method commit

src/orchestration/staging.ts:182–195  ·  view source on GitHub ↗

Commit a node's staged edits to disk and record the snapshot.

(node: TaskNode, result: WorkerResult)

Source from the content-addressed store, hash-verified

180
181 /** Commit a node's staged edits to disk and record the snapshot. */
182 async commit(node: TaskNode, result: WorkerResult): Promise<void> {
183 for (const edit of result.fileEdits) {
184 const abs = this.abs(edit.path);
185 await fs.mkdir(path.dirname(abs), { recursive: true });
186 // Atomic write: temp + rename.
187 const tmp = `${abs}.qodex-tmp-${process.pid}`;
188 await fs.writeFile(tmp, edit.content, 'utf-8');
189 await fs.rename(tmp, abs);
190 this.committed.set(edit.path, edit.content);
191 this.staged.delete(edit.path);
192 this.deleted.delete(edit.path);
193 logger.debug('Committed staged edit', { task: node.id, file: edit.path });
194 }
195 }
196
197 committedPaths(): string[] { return [...this.committed.keys()]; }
198}

Callers 1

executeMethod · 0.95

Calls 4

absMethod · 0.95
deleteMethod · 0.80
debugMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected