[PR #2182] [MERGED] fix(setup): remove emptied skill directories on uninstall #5070

Closed
opened 2026-10-31 01:02:27 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2182
Author: @kaoru0822-kitauji
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/issue-2159


📝 Commits (2)

  • f25cc49 fix(setup): remove emptied skill directories on uninstall
  • a25aaa8 fix(setup): report emptied skill directories that cannot be removed

📊 Changes

2 files changed (+120 additions, -4 deletions)

View changed files

📝 src/application/Uninstall.ts (+57 -4)
📝 tests/boundary/filesystem/clientLifecycle.test.ts (+63 -0)

📄 Description

Summary

Since a01148553, uninstall removes only the files in MANAGED_SKILL_FILES, so user files in a skill directory survive. Nothing removes the managed directories once they are empty. After rea uninstall, every skill destination (~/.agents/skills, Claude Code, Antigravity, Hermes) therefore kept an empty reverse-engineer-anything/ directory with an empty references/ inside, while the summary reported the skill as removed.

Once the ownership manifest itself has been removed, uninstall now removes the managed directories deepest first (references/, then the skill root). It uses a non-recursive rmdir through a new optional UninstallFileSystem.removeEmptyDirectory. rmdir cannot delete content, so a directory that still holds user files (or was replaced by a symlink) is left exactly as it was. No item status or message changes. Injected test file systems without the new method keep the previous behavior.

Fixes #2159

Before / after (isolated HOME, setup for Claude Code, Hermes and Antigravity, then uninstall)

before: ~/.claude/skills/reverse-engineer-anything/{references/}   (empty)  — same for every destination
after:  empty skill directories are gone; a directory containing a user notes.md keeps that file (only its emptied references/ is removed)

Validation

  • New boundary test removes emptied skill directories and keeps ones with user files (tests/boundary/filesystem/clientLifecycle.test.ts). It fails on main and passes with this change; all 49 tests in the file pass.
  • npm run lint passes.
  • npm test: 9155 passed, 14 failed in 7 files. These are the same environmental files that fail on clean origin/main on this host: Hopper not installed, Command Line Tools only (ibtool), hdiutil, and inspector target-location cases.

#2154 also edits src/application/Uninstall.ts, but in the configuration-reading path; the two changes do not overlap.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2182 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/issue-2159` --- ### 📝 Commits (2) - [`f25cc49`](https://github.com/morluto/rea/commit/f25cc49a39a61d2c48a6419e413d830d0c2857b7) fix(setup): remove emptied skill directories on uninstall - [`a25aaa8`](https://github.com/morluto/rea/commit/a25aaa8109e912e0d102ef55657ba15a2f545887) fix(setup): report emptied skill directories that cannot be removed ### 📊 Changes **2 files changed** (+120 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/application/Uninstall.ts` (+57 -4) 📝 `tests/boundary/filesystem/clientLifecycle.test.ts` (+63 -0) </details> ### 📄 Description ## Summary Since a01148553, uninstall removes only the files in `MANAGED_SKILL_FILES`, so user files in a skill directory survive. Nothing removes the managed directories once they are empty. After `rea uninstall`, every skill destination (`~/.agents/skills`, Claude Code, Antigravity, Hermes) therefore kept an empty `reverse-engineer-anything/` directory with an empty `references/` inside, while the summary reported the skill as `removed`. Once the ownership manifest itself has been removed, uninstall now removes the managed directories deepest first (`references/`, then the skill root). It uses a non-recursive `rmdir` through a new optional `UninstallFileSystem.removeEmptyDirectory`. `rmdir` cannot delete content, so a directory that still holds user files (or was replaced by a symlink) is left exactly as it was. No item status or message changes. Injected test file systems without the new method keep the previous behavior. Fixes #2159 ## Before / after (isolated HOME, setup for Claude Code, Hermes and Antigravity, then uninstall) ```text before: ~/.claude/skills/reverse-engineer-anything/{references/} (empty) — same for every destination after: empty skill directories are gone; a directory containing a user notes.md keeps that file (only its emptied references/ is removed) ``` ## Validation - New boundary test `removes emptied skill directories and keeps ones with user files` (`tests/boundary/filesystem/clientLifecycle.test.ts`). It fails on main and passes with this change; all 49 tests in the file pass. - `npm run lint` passes. - `npm test`: 9155 passed, 14 failed in 7 files. These are the same environmental files that fail on clean `origin/main` on this host: Hopper not installed, Command Line Tools only (`ibtool`), `hdiutil`, and inspector target-location cases. #2154 also edits `src/application/Uninstall.ts`, but in the configuration-reading path; the two changes do not overlap. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:02:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5070
No description provided.