Skip to content

fix(cli): bound skill discovery in non-git projects - #12475

Merged
johnnyeric merged 1 commit into
Kilo-Org:mainfrom
LCZcn96:fix/non-git-global-skills
Jul 24, 2026
Merged

fix(cli): bound skill discovery in non-git projects#12475
johnnyeric merged 1 commit into
Kilo-Org:mainfrom
LCZcn96:fix/non-git-global-skills

Conversation

@LCZcn96

@LCZcn96 LCZcn96 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Issue

Fixes #12461

Context

Global skills under ~/.agents/skills and ~/.claude/skills fail 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 projectRoot as the upper bound for external project-skill discovery. For Git projects, projectRoot is 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 .agents and .claude global 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

  • Before the implementation change, bun test ./test/kilocode/non-git-global-skills.test.ts failed with the expected global skill path receiving undefined; after the change, it passed with 1 test and 2 assertions.
  • bun test ./test/skill/skill.test.ts passed: 16 tests, 44 assertions.
  • bun run typecheck passed from packages/opencode.
  • bun run script/check-opencode-annotations.ts --worktree passed.
  • The repository pre-push checks passed for all 22 non-JetBrains package tasks and the JetBrains typecheck task under JDK 21.
  • Prettier, git diff --check, and strict UTF-8 without BOM checks passed for all changed files.

Reviewer test steps

  1. From packages/opencode, run bun test ./test/kilocode/non-git-global-skills.test.ts.
  2. Confirm both home-level .agents and .claude skills load from the nested non-Git project fixture.
  3. Run bun test ./test/skill/skill.test.ts to verify existing Git and global skill discovery behavior.

Blocked checks and substitute verification

None.

Checklist

  • Issue linked above
  • Tests and verification described
  • Screenshots/video marked N/A because there are no visual changes
  • Patch changeset added for @kilocode/cli
  • I personally reviewed the diff and can explain the change

@LCZcn96
LCZcn96 marked this pull request as ready for review July 23, 2026 01:29
@LCZcn96
LCZcn96 force-pushed the fix/non-git-global-skills branch from 4a768d0 to ff45985 Compare July 23, 2026 01:30
@kilo-code-bot

kilo-code-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • .changeset/bound-non-git-skill-discovery.md
  • packages/opencode/src/skill/index.ts
  • packages/opencode/test/kilocode/non-git-global-skills.test.ts

Reviewed by claude-sonnet-5 · Input: 18 · Output: 3.7K · Cached: 349.5K

Review guidance: REVIEW.md from base branch main

@johnnyeric
johnnyeric merged commit c72817e into Kilo-Org:main Jul 24, 2026
29 checks passed
@johnnyeric

Copy link
Copy Markdown
Contributor

Thanks for submitting this fix! Merged.

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.

Global .agents and .claude skills fail in non-Git projects under home

2 participants