Skip to content

chore: Unify skill source discovery - #1486

Merged
hatayama merged 2 commits into
v3-betafrom
refactor/common-skillscan-identity
Jul 4, 2026
Merged

hatayama merged 2 commits into
v3-betafrom
refactor/common-skillscan-identity

Conversation

@hatayama

@hatayama hatayama commented Jul 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Keep skill discovery behavior unchanged while routing package and source-root discovery through one common entry point.
  • Preserve the existing Unity package root precedence for migration skill lookup.

User Impact

  • No CLI output or wire contract changes are intended.
  • Skill installation and discovery continue to recognize project, package, manifest-local, and cached package skill roots.

Changes

  • Added PackageIdentity and PackageSearchResult to common/skillscan.
  • Replaced the separate source-root enumeration branches with EnumerateSourceRoots backed by package search results.
  • Removed clicore skillscan re-export wrappers and pointed dispatcher skill handling at common/skillscan directly.
  • Refreshed shared release input stamps.

Verification

  • cd cli/common && go test ./skillscan ./clicore
  • cd cli/dispatcher && go test ./internal/dispatcher
  • cd cli/release-automation && go test ./internal/automation -run TestReleaseTriggerGuardCommonPackageWhitelistsMatchGoDependencies -count=1
  • scripts/check-go-cli.sh
  • cd cli/release-automation && go run ./cmd/check-release-triggers --base origin/v3-beta --head HEAD

Review in cubic

Route skill package discovery through PackageIdentity and PackageSearchResult so source roots are enumerated from one skillscan entry point. Remove the clicore re-export wrappers and point dispatcher skill discovery directly at common/skillscan while preserving the existing Unity package root priority.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1f8d6881-d75e-4373-be24-15177512a3ab

📥 Commits

Reviewing files that changed from the base of the PR and between c40e24f and 5a8fc41.

📒 Files selected for processing (4)
  • cli/common/skillscan/packages.go
  • cli/common/skillscan/packages_test.go
  • cli/dispatcher/shared-inputs-stamp.json
  • cli/project-runner/shared-inputs-stamp.json
📝 Walkthrough

Walkthrough

The clicore package's skillscan alias file is deleted, and all consumers (clicore's tool_catalog, dispatcher's skills/skills_discovery/skills_sync) now reference common/skillscan directly. The skillscan package's package-root discovery is rewritten around new PackageIdentity/PackageSearchResult types with revised ranking logic. Stamp hashes are updated.

Changes

Skillscan migration and package discovery rework

Layer / File(s) Summary
Package discovery rework
cli/common/skillscan/packages.go, cli/common/skillscan/packages_test.go
Adds PackageIdentity/PackageSearchResult types, EnumeratePackageSearchResults/FindUnityCliLoopPackage functions, rewrites ResolvePackageRoot and identity/cache resolution and ranking logic; tests updated with reflect.DeepEqual comparisons and a new priority test.
Source root enumeration update
cli/common/skillscan/sources.go
EnumerateSourceRoots and CollectInternalSkillToolNames now iterate EnumeratePackageSearchResults instead of prior multi-step root collection.
clicore switches to skillscan, aliases removed
cli/common/clicore/tool_catalog.go, cli/common/clicore/tool_catalog_test.go, cli/common/clicore/skillscan_aliases.go
tool_catalog.go and its tests call skillscan.CollectInternalSkillToolNames/skillscan.SkillFileName; the alias re-export file is deleted entirely.
Dispatcher skill discovery/sync migrated
cli/dispatcher/internal/dispatcher/skills.go, skills_discovery.go, skills_sync.go
All clicore skill constants/functions used for discovery, parsing, and sync status are replaced with skillscan equivalents.
Stamp hash updates
cli/dispatcher/shared-inputs-stamp.json, cli/project-runner/shared-inputs-stamp.json
sharedInputsHash values are updated in both files.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the core change: consolidating skill source discovery into one path.
Description check ✅ Passed The description matches the diff and objectives, covering unified discovery, removed wrappers, and refreshed stamps.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/common-skillscan-identity

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)
cli/common/skillscan/packages.go (1)

142-218: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Redundant manifest/cache reads within a single discovery pass.

enumerateManifestLocalPackageResults (Line 143) and enumeratePackageCacheResults (Line 164) each independently call readManifestDependencies(projectRoot), parsing Packages/manifest.json twice per EnumeratePackageSearchResults call. Likewise, enumeratePackageCacheResults (Line 173) and enumerateUnityCliLoopPackageCacheFallbackResults (Line 201) both call os.ReadDir on the same Library/PackageCache directory. Since EnumeratePackageSearchResults chains all four helpers on every discovery pass (invoked from both ResolvePackageRoot/FindUnityCliLoopPackage and EnumerateSourceRoots), this doubles the file/dir I/O unnecessarily.

Consider reading the manifest and cache directory listing once and threading the results into the relevant helpers.

♻️ Sketch of the refactor
-func enumerateManifestLocalPackageResults(projectRoot string) []PackageSearchResult {
-	dependencies := readManifestDependencies(projectRoot)
+func enumerateManifestLocalPackageResults(projectRoot string, dependencies map[string]string) []PackageSearchResult {
 	if len(dependencies) == 0 {
 		return []PackageSearchResult{}
 	}
 	...
 }

-func enumeratePackageCacheResults(projectRoot string) []PackageSearchResult {
-	dependencies := readManifestDependencies(projectRoot)
+func enumeratePackageCacheResults(projectRoot string, dependencies map[string]string) []PackageSearchResult {
 	if len(dependencies) == 0 {
 		return []PackageSearchResult{}
 	}
 	...
-	entries, err := os.ReadDir(packageCacheDir)
+	entries, err := readPackageCacheEntries(projectRoot) // shared, memoized read
 	...
 }
🤖 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 `@cli/common/skillscan/packages.go` around lines 142 - 218,
`EnumeratePackageSearchResults` currently triggers duplicate I/O by letting both
`enumerateManifestLocalPackageResults` and `enumeratePackageCacheResults` call
`readManifestDependencies`, and both `enumeratePackageCacheResults` and
`enumerateUnityCliLoopPackageCacheFallbackResults` call `os.ReadDir` on the same
cache directory. Refactor the discovery flow so the manifest dependencies and
PackageCache entries are read once per pass, then pass those shared results into
the affected helpers (`enumerateManifestLocalPackageResults`,
`enumeratePackageCacheResults`, and
`enumerateUnityCliLoopPackageCacheFallbackResults`) instead of re-reading them
internally.
🤖 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 `@cli/common/skillscan/packages.go`:
- Around line 142-218: `EnumeratePackageSearchResults` currently triggers
duplicate I/O by letting both `enumerateManifestLocalPackageResults` and
`enumeratePackageCacheResults` call `readManifestDependencies`, and both
`enumeratePackageCacheResults` and
`enumerateUnityCliLoopPackageCacheFallbackResults` call `os.ReadDir` on the same
cache directory. Refactor the discovery flow so the manifest dependencies and
PackageCache entries are read once per pass, then pass those shared results into
the affected helpers (`enumerateManifestLocalPackageResults`,
`enumeratePackageCacheResults`, and
`enumerateUnityCliLoopPackageCacheFallbackResults`) instead of re-reading them
internally.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 06ca2b90-1056-4c46-9b99-be075cf2b3bd

📥 Commits

Reviewing files that changed from the base of the PR and between af76631 and c40e24f.

📒 Files selected for processing (11)
  • cli/common/clicore/skillscan_aliases.go
  • cli/common/clicore/tool_catalog.go
  • cli/common/clicore/tool_catalog_test.go
  • cli/common/skillscan/packages.go
  • cli/common/skillscan/packages_test.go
  • cli/common/skillscan/sources.go
  • cli/dispatcher/internal/dispatcher/skills.go
  • cli/dispatcher/internal/dispatcher/skills_discovery.go
  • cli/dispatcher/internal/dispatcher/skills_sync.go
  • cli/dispatcher/shared-inputs-stamp.json
  • cli/project-runner/shared-inputs-stamp.json
💤 Files with no reviewable changes (1)
  • cli/common/clicore/skillscan_aliases.go

@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 11 files

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

Re-trigger cubic

Comment thread cli/common/skillscan/packages.go Outdated
Keep the legacy marker-only fallback scoped to Packages/src so unrelated project packages with FirstPartyTools markers are not resolved as the Unity CLI Loop package.
@hatayama
hatayama merged commit 6746927 into v3-beta Jul 4, 2026
10 checks passed
@hatayama
hatayama deleted the refactor/common-skillscan-identity branch July 4, 2026 03:03
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