fix(cli): bound skill discovery in non-git projects - #12475
Merged
Conversation
LCZcn96
marked this pull request as ready for review
July 23, 2026 01:29
LCZcn96
force-pushed
the
fix/non-git-global-skills
branch
from
July 23, 2026 01:30
4a768d0 to
ff45985
Compare
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by claude-sonnet-5 · Input: 18 · Output: 3.7K · Cached: 349.5K Review guidance: REVIEW.md from base branch |
johnnyeric
approved these changes
Jul 24, 2026
Contributor
|
Thanks for submitting this fix! Merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Fixes #12461
Context
Global skills under
~/.agents/skillsand~/.claude/skillsfail to load when the selected project is below the home directory and is not a Git repository.Non-Git projects use
/as the worktree sentinel. The external project-skill scan currently uses that sentinel as its upper bound, so it can walk past the selected project, rediscover home-level global skills, and replace their trusted discovery metadata with project-scoped metadata. Markdown loading then rejects the valid global skill as outside the project scope.Implementation
Use the normalized
projectRootas the upper bound for external project-skill discovery. For Git projects,projectRootis already the worktree, so existing worktree behavior is unchanged. For non-Git projects, discovery now stops at the selected project directory and cannot overwrite trusted global matches found above it.The regression test creates a temporary home containing both
.agentsand.claudeglobal skills, then loads them from a nested non-Git project. A patch changeset is included for@kilocode/cli.Screenshots / Video
N/A — no visual changes.
How to Test
Manual/local verification
bun test ./test/kilocode/non-git-global-skills.test.tsfailed with the expected global skill path receivingundefined; after the change, it passed with 1 test and 2 assertions.bun test ./test/skill/skill.test.tspassed: 16 tests, 44 assertions.bun run typecheckpassed frompackages/opencode.bun run script/check-opencode-annotations.ts --worktreepassed.git diff --check, and strict UTF-8 without BOM checks passed for all changed files.Reviewer test steps
packages/opencode, runbun test ./test/kilocode/non-git-global-skills.test.ts..agentsand.claudeskills load from the nested non-Git project fixture.bun test ./test/skill/skill.test.tsto verify existing Git and global skill discovery behavior.Blocked checks and substitute verification
None.
Checklist
@kilocode/cli