Skip to content

chore: Simplify skill target installation maintenance#1589

Merged
hatayama merged 2 commits into
v3-betafrom
feature/hatayama/unify-skill-target-installer
Jul 7, 2026
Merged

chore: Simplify skill target installation maintenance#1589
hatayama merged 2 commits into
v3-betafrom
feature/hatayama/unify-skill-target-installer

Conversation

@hatayama

@hatayama hatayama commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Simplify the internal skill target installation flow by routing full sync and per-tool sync through the same core implementation.
  • Preserve the existing cleanup differences between full sync and specific-skill sync so skill setup behavior remains unchanged.

User Impact

  • This is an internal maintenance change; skill installation behavior is intended to remain unchanged.
  • Future skill setup changes should be easier to review because shared target-root setup, writing, and cleanup logic now lives in one path.

Changes

  • Keep InstallSkillsForTarget and InstallSpecificSkillsForTarget as existing entry points.
  • Add a private SkillSyncScope to preserve full-sync pruning and all-layout cleanup separately from specific-skill cleanup.
  • Share target root setup, skill writing, alternate-layout cleanup, cancellation checks, and empty managed folder cleanup through one core method.

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).*'
  • Result: compile errors 0 / warnings 0; tests 59/59 passed

Review in cubic

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.
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 296b3788-46fd-49ab-b862-f36a38d92127

📥 Commits

Reviewing files that changed from the base of the PR and between 3781d5e and 5c73b21.

📒 Files selected for processing (1)
  • Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs

📝 Walkthrough

Walkthrough

SkillTargetInstaller 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.

Changes

Scope-based skill installer refactor

Layer / File(s) Summary
SkillSyncScope enum and core installer entry points
Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs
Adds a SkillSyncScope enum and rewires InstallSkillsForTarget/InstallSpecificSkillsForTarget to delegate into InstallSkillsForTargetCore with FullSync or SpecificSkillsOnly scope.
Scope-aware deprecated/disabled and unexpected directory cleanup
Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs
Replaces layout-specific deletion helpers with scope-aware helpers routed through DeleteSkillDirectoriesForScope, and restricts unexpected-directory cleanup via GetManagedSkillNames to FullSync scope only.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#978: Changes related skill-folder cleanup behavior during install and synchronization, including grouped and ungrouped layout handling.
  • hatayama/unity-cli-loop#980: Updates skill installation cleanup rules for layout switching and directory preservation, which overlaps with the scope-based deletion flow here.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the refactor to simplify skill target installation maintenance.
Description check ✅ Passed The description matches the refactor and explains the shared core flow and preserved cleanup behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/hatayama/unify-skill-target-installer

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs (1)

99-127: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consolidate the duplicated FullSync unexpected-directory cleanup.

When !groupSkillsUnderUnityCliLoop and scope is FullSync, GetManagedSkillNames and DeleteUnexpectedInstalledSkillDirectories are invoked twice across two separate FullSync guards (Lines 99-108 and 112-121), recomputing the same managed-name set. Merging the two FullSync branches 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

📥 Commits

Reviewing files that changed from the base of the PR and between fd9f989 and 3781d5e.

📒 Files selected for processing (1)
  • Packages/src/Editor/Infrastructure/SkillSetup/SkillTargetInstaller.cs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

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.
@hatayama

hatayama commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

@cubic-dev-ai review this PR after the latest commit.

@cubic-dev-ai

cubic-dev-ai Bot commented Jul 7, 2026

Copy link
Copy Markdown

@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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@hatayama
hatayama merged commit 8558b14 into v3-beta Jul 7, 2026
10 checks passed
@hatayama
hatayama deleted the feature/hatayama/unify-skill-target-installer branch July 7, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant