MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / removeNode

Method removeNode

apps/webuiapps/src/lib/FileSystemStore.ts:264–296  ·  view source on GitHub ↗

* Remove a node

(id: string)

Source from the content-addressed store, hash-verified

262 * Remove a node
263 */
264 removeNode(id: string): boolean {
265 const node = this.nodes.get(id);
266 if (!node) {
267 return false;
268 }
269
270 // Cannot delete root node
271 if (id === this.rootId) {
272 throw new Error('Cannot remove root node');
273 }
274
275 // If it's a folder, recursively delete children
276 if (node.type === 'folder' && node.children) {
277 for (const childId of [...node.children]) {
278 this.removeNode(childId);
279 }
280 }
281
282 // Remove from parent's children
283 if (node.parentId) {
284 const parent = this.nodes.get(node.parentId);
285 if (parent && parent.children) {
286 parent.children = parent.children.filter((cid) => cid !== id);
287 }
288 }
289
290 // Remove from store
291 this.pathIndex.delete(node.path);
292 this.nodes.delete(id);
293
294 this.emit('node_removed', id, node.path);
295 return true;
296 }
297
298 /**
299 * Remove a node by path

Callers 2

removeByPathMethod · 0.95
useFileSystemFunction · 0.80

Calls 1

emitMethod · 0.95

Tested by

no test coverage detected