commit 19cffbde826739b87612733a0107c9c99a418bda
parent 040e1c936feca7aa0cccc3e385cb0819d487f226
Author: admin <unitehenry@gmail.com>
Date: Mon, 19 Oct 2026 01:04:30 +0000
feat: add clear-openpod command to stop all Lima instances and clear ~/.local/share/openpod
Diffstat:
| M | plugin.ts | | | 38 | ++++++++++++++++++++++++++++++++++++++ |
1 file changed, 38 insertions(+), 0 deletions(-)
diff --git a/plugin.ts b/plugin.ts
@@ -215,6 +215,32 @@ function cleanupOpenpod(sessionID: string): void {
}
}
+function clearAllOpenpod(): void {
+ writeLog("[clear] starting full openpod cleanup");
+
+ try {
+ if (!fs.existsSync(openpodRoot)) {
+ writeLog("[clear] openpod root does not exist");
+ return;
+ }
+
+ // Clean up each session/pod individually (stops + deletes lima + removes dir)
+ const entries = fs.readdirSync(openpodRoot, { withFileTypes: true });
+ for (const entry of entries) {
+ if (entry.isDirectory()) {
+ const sessionID = entry.name;
+ cleanupOpenpod(sessionID);
+ }
+ }
+
+ // Remove the root directory entirely (includes .log etc.)
+ fs.rmSync(openpodRoot, { recursive: true, force: true });
+ writeLog(`[clear] removed entire directory ${openpodRoot}`);
+ } catch (err) {
+ writeLog(`[clear] error during cleanup: ${err}`);
+ }
+}
+
export default Plugin.define({
id: "openpod",
async setup(ctx) {
@@ -323,6 +349,18 @@ export default Plugin.define({
}
});
+ writeLog("registering commands");
+
+ await ctx.command.transform((editor) => {
+ editor.add({
+ name: "clear-openpod",
+ description: "Stop and delete all openpod Lima instances and remove the entire ~/.local/share/openpod directory",
+ execute: async () => {
+ clearAllOpenpod();
+ },
+ });
+ });
+
// Listen for session removal (via events, since there is no ctx.session.hook("remove"))
// and clean up the corresponding openpod directory + lima instance.
const controller = new AbortController();