MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / cleanup

Method cleanup

codewiki/mcp/workspace.py:96–110  ·  view source on GitHub ↗

Remove the session directory and try to prune empty parents.

(self)

Source from the content-addressed store, hash-verified

94
95 # -- cleanup ----------------------------------------------------------
96
97 def cleanup(self) -> None:
98 """Remove the session directory and try to prune empty parents."""
99 if self.root.exists():
100 shutil.rmtree(self.root, ignore_errors=True)
101 # Walk up and remove empty parent directories
102 try:
103 sessions_dir = self.root.parent # .codewiki/sessions
104 if sessions_dir.exists() and not any(sessions_dir.iterdir()):
105 sessions_dir.rmdir()
106 base_dir = sessions_dir.parent # .codewiki
107 if base_dir.exists() and not any(base_dir.iterdir()):
108 base_dir.rmdir()
109 except OSError:
110 pass
111 logger.debug("Workspace cleaned up: %s", self.root)

Callers 5

call_toolFunction · 0.80
createMethod · 0.80
getMethod · 0.80
_purge_expired_lockedMethod · 0.80
mainFunction · 0.80

Calls 1

debugMethod · 0.80

Tested by 1

mainFunction · 0.64