From 2f1175b9fe7d49bee76ca758914916c6a9dcf136 Mon Sep 17 00:00:00 2001 From: mkorwel Date: Wed, 18 Mar 2026 23:42:51 -0700 Subject: [PATCH] feat(workspaces): consolidate cleanup commands and add safety confirmations --- .gemini/skills/workspaces/SKILL.md | 7 +++++-- .gemini/skills/workspaces/scripts/clean.ts | 9 ++++++++- package.json | 5 ++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.gemini/skills/workspaces/SKILL.md b/.gemini/skills/workspaces/SKILL.md index 89358e0dd3..6f60f551f1 100644 --- a/.gemini/skills/workspaces/SKILL.md +++ b/.gemini/skills/workspaces/SKILL.md @@ -26,8 +26,11 @@ This skill enables the agent to utilize **Gemini Workspaces**—a high-performan npm run workspace [action] ``` - Actions: `review` (default), `fix`, `ready`. -3. **Check Status**: Poll the progress using `npm run workspace:check ` or see the global state with `npm run workspace:status`. -4. **Prune/Clean**: Cleanup old worktrees and dead sessions with `npm run workspace:clean` (all) or `npm run workspace:remove ` (specific). +3. **Check Status**: See global state and active sessions with `npm run workspace:status`, or deep-dive into specific PR logs with `npm run workspace:check `. +4. **Cleanup**: + - **Bulk**: Clear all sessions/worktrees with `npm run workspace:clean-all`. + - **Surgical**: Kill a specific PR task with `npm run workspace:kill `. +5. **Fleet**: Manage VM lifecycle with `npm run workspace:fleet [stop|provision|list]`. ## ⚠️ Important Constraints - **Absolute Paths**: Always use absolute paths (e.g., `/mnt/disks/data/...`) when orchestrating remote commands. diff --git a/.gemini/skills/workspaces/scripts/clean.ts b/.gemini/skills/workspaces/scripts/clean.ts index 3edeb1bb70..d26bb8ff27 100644 --- a/.gemini/skills/workspaces/scripts/clean.ts +++ b/.gemini/skills/workspaces/scripts/clean.ts @@ -61,7 +61,14 @@ export async function runCleanup(args: string[], env: NodeJS.ProcessEnv = proces } // --- Bulk Cleanup --- - console.log(`🧹 Starting BULK cleanup on ${targetVM}...`); + console.log(`⚠️ DANGER: You are about to perform a BULK cleanup on ${targetVM}.`); + const confirmed = await confirm(' Are you sure you want to kill ALL sessions and worktrees?'); + if (!confirmed) { + console.log('❌ Cleanup cancelled.'); + return 0; + } + + console.log(`🧹 Starting BULK cleanup...`); // 1. Standard Cleanup console.log(' - Killing ALL remote tmux sessions...'); diff --git a/package.json b/package.json index e072948287..5d51a2b1bd 100644 --- a/package.json +++ b/package.json @@ -67,13 +67,12 @@ "workspace": "tsx .gemini/skills/workspaces/scripts/orchestrator.ts", "workspace:setup": "tsx .gemini/skills/workspaces/scripts/setup.ts", "workspace:check": "tsx .gemini/skills/workspaces/scripts/check.ts", - "workspace:clean": "tsx .gemini/skills/workspaces/scripts/clean.ts", - "workspace:prune": "tsx .gemini/skills/workspaces/scripts/clean.ts", + "workspace:clean-all": "tsx .gemini/skills/workspaces/scripts/clean.ts", + "workspace:kill": "tsx .gemini/skills/workspaces/scripts/clean.ts", "workspace:fleet": "tsx .gemini/skills/workspaces/scripts/fleet.ts", "workspace:status": "tsx .gemini/skills/workspaces/scripts/status.ts", "workspace:attach": "tsx .gemini/skills/workspaces/scripts/attach.ts", "workspace:logs": "tsx .gemini/skills/workspaces/scripts/logs.ts", - "workspace:remove": "tsx .gemini/skills/workspaces/scripts/clean.ts", "pre-commit": "node scripts/pre-commit.js" }, "overrides": {