Skip to content

fix(opencode): skip dependency directories during skill discovery - #51278

Open
kugesh-Rajasekaran wants to merge 1 commit into
anomalyco:devfrom
kugesh-Rajasekaran:skill-discovery-ignore
Open

kugesh-Rajasekaran wants to merge 1 commit into
anomalyco:devfrom
kugesh-Rajasekaran:skill-discovery-ignore

Conversation

@kugesh-Rajasekaran

Copy link
Copy Markdown

Issue for this PR

Closes #51080

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Skill discovery scans skills/**/SKILL.md before the TUI is ready. On 1.18.31, three cold starts took 13.3s, 10.0s, and 6.6s to reach booting location services. On the fastest run the skill scan itself was 2.3s. node_modules and .git inside a skill were walked, and ~/.claude/skills is a symlink to ~/.agents/skills, so that tree was walked twice.

Glob.scan now takes an ignore list and passes it to the glob package. Discovery passes **/node_modules/**, **/.git/**, **/dist/**, and **/.cache/**. A pattern ending in /** makes the walker return before it reads that directory. Nested SKILL.md files outside those directories are still found. A scan root already seen by realpath is skipped, so the symlink is walked once.

How did you verify your code works?

  • bun typecheck in packages/core and packages/opencode. The pre-push hook typechecked all 36 packages.
  • bun test for test/skill/skill.test.ts, test/util/glob.test.ts, and test/tool/skill.test.ts. The new case covers node_modules, .git, and a skills symlink.
  • The full packages/opencode suite (3636 tests) had 29 failures in workspace routing and opencode run. Those same tests pass when run on their own, on this branch and on dev.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Pass ignore globs through Glob.scan so discovery does not descend into
node_modules, .git, dist, or .cache. Skip a scan root already seen by
realpath, so a skills symlink is not walked twice.

Fixes anomalyco#51080
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

This branch has not been deployed

No deployments
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.

Skill discovery walks node_modules and .git inside a skill on every startup

1 participant