(path: string)
| 127 | }; |
| 128 | |
| 129 | const deleteFile = async (path: string): Promise<void> => { |
| 130 | const normalizedPath = normalizePath(path); |
| 131 | const node = findNodeByPath(normalizedPath); |
| 132 | |
| 133 | if (!node) { |
| 134 | throw new Error(`File not found: ${path}`); |
| 135 | } |
| 136 | |
| 137 | if (node.parentId) { |
| 138 | const parentNode = store.get(node.parentId); |
| 139 | if (parentNode && parentNode.children) { |
| 140 | parentNode.children = parentNode.children.filter((id) => id !== node.id); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | if (node.type === 'folder' && node.children) { |
| 145 | for (const childId of node.children) { |
| 146 | const child = store.get(childId); |
| 147 | if (child) { |
| 148 | await deleteFile(child.path); |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | store.delete(node.id); |
| 154 | }; |
| 155 | |
| 156 | return { |
| 157 | listFiles, |
nothing calls this directly
no test coverage detected