chore: Simplify skill target installation maintenance#1589
Conversation
Route full and per-tool target installation through one core path so their shared directory setup, skill writing, and layout cleanup logic stays consistent while preserving the existing scope-specific cleanup behavior.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSkillTargetInstaller now routes full and targeted installs through a shared core method with a scope flag. Cleanup for deprecated, disabled, and unexpected skill directories is now scope-aware, with unexpected-directory removal limited to full sync. ChangesScope-based skill installer refactor
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs (1)
99-127: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsolidate the duplicated FullSync unexpected-directory cleanup.
When
!groupSkillsUnderUnityCliLoopand scope isFullSync,GetManagedSkillNamesandDeleteUnexpectedInstalledSkillDirectoriesare invoked twice across two separateFullSyncguards (Lines 99-108 and 112-121), recomputing the same managed-name set. Merging the twoFullSyncbranches and hoisting the shared set computation removes the redundancy and makes the "clean both layouts when ungrouped" intent explicit.♻️ Suggested consolidation
- if (syncScope == SkillSyncScope.FullSync) - { - HashSet<string> managedSkillNames = GetManagedSkillNames(skills, disabledSkills); - DeleteUnexpectedInstalledSkillDirectories( - targetRoot, - skills.Select(skill => skill.Name), - managedSkillNames, - groupSkillsUnderUnityCliLoop, - ct); - } - - if (!groupSkillsUnderUnityCliLoop) - { - if (syncScope == SkillSyncScope.FullSync) - { - HashSet<string> managedSkillNames = GetManagedSkillNames(skills, disabledSkills); - DeleteUnexpectedInstalledSkillDirectories( - targetRoot, - skills.Select(skill => skill.Name), - managedSkillNames, - groupSkillsUnderUnityCliLoop: true, - ct); - } - - DeleteEmptyManagedSkillsParentDirectoryIfNeeded( - targetRoot, - groupSkillsUnderUnityCliLoop: true, - ct); - } + if (syncScope == SkillSyncScope.FullSync) + { + HashSet<string> managedSkillNames = GetManagedSkillNames(skills, disabledSkills); + IEnumerable<string> expectedSkillNames = skills.Select(skill => skill.Name); + DeleteUnexpectedInstalledSkillDirectories( + targetRoot, + expectedSkillNames, + managedSkillNames, + groupSkillsUnderUnityCliLoop, + ct); + if (!groupSkillsUnderUnityCliLoop) + { + DeleteUnexpectedInstalledSkillDirectories( + targetRoot, + expectedSkillNames, + managedSkillNames, + groupSkillsUnderUnityCliLoop: true, + ct); + } + } + + if (!groupSkillsUnderUnityCliLoop) + { + DeleteEmptyManagedSkillsParentDirectoryIfNeeded( + targetRoot, + groupSkillsUnderUnityCliLoop: true, + ct); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs` around lines 99 - 127, The FullSync cleanup in SkillTargetInstaller is duplicated across two separate branches, causing GetManagedSkillNames and DeleteUnexpectedInstalledSkillDirectories to run twice for the same unmanaged-name set when !groupSkillsUnderUnityCliLoop. Consolidate the FullSync logic in SkillTargetInstaller’s cleanup flow by computing the managed skill names once, then reusing that set for both directory-layout cleanup paths so the intent to clean both layouts when ungrouped is explicit and redundant work is removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs`:
- Around line 99-127: The FullSync cleanup in SkillTargetInstaller is duplicated
across two separate branches, causing GetManagedSkillNames and
DeleteUnexpectedInstalledSkillDirectories to run twice for the same
unmanaged-name set when !groupSkillsUnderUnityCliLoop. Consolidate the FullSync
logic in SkillTargetInstaller’s cleanup flow by computing the managed skill
names once, then reusing that set for both directory-layout cleanup paths so the
intent to clean both layouts when ungrouped is explicit and redundant work is
removed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 04655e52-3e6a-4386-896b-3ebaac16feb9
📒 Files selected for processing (1)
Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs
Build the full-sync removable skill name set once and share it between the selected-layout and grouped-layout prune passes so both passes stay tied to the same inputs.
|
@cubic-dev-ai review this PR after the latest commit. |
@hatayama I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Summary
User Impact
Changes
InstallSkillsForTargetandInstallSpecificSkillsForTargetas existing entry points.SkillSyncScopeto preserve full-sync pruning and all-layout cleanup separately from specific-skill cleanup.Verification
dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)"dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type regex --filter-value '.*(ToolSkillSynchronizerTests|SkillInstallLayoutTests).*'