MCPcopy Index your code
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 # -- cleanup ----------------------------------------------------------
95
96 def cleanup(self) -> None:
97 """Remove the session directory and try to prune empty parents."""
98 if self.root.exists():
99 shutil.rmtree(self.root, ignore_errors=True)
100 # Walk up and remove empty parent directories
101 try:
102 sessions_dir = self.root.parent # .codewiki/sessions
103 if sessions_dir.exists() and not any(sessions_dir.iterdir()):
104 sessions_dir.rmdir()
105 base_dir = sessions_dir.parent # .codewiki
106 if base_dir.exists() and not any(base_dir.iterdir()):
107 base_dir.rmdir()
108 except OSError:
109 pass
110 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