Skip to content

feat(skill-loader): recursive merge for multi-file skills#6

Closed
codewithkenzo wants to merge 6 commits into
devfrom
feat/skill-loader-extension
Closed

feat(skill-loader): recursive merge for multi-file skills#6
codewithkenzo wants to merge 6 commits into
devfrom
feat/skill-loader-extension

Conversation

@codewithkenzo

Copy link
Copy Markdown
Owner

Summary

Extends the OpenCode skill loader to recursively merge all .md files from skill subdirectories into the skill content, enabling multi-file skills like react-best-practices to work out-of-the-box without pre-compilation.

Changes

  • Recursive merge: Collects .md files from subdirectories up to depth 3
  • Frontmatter stripping: Subdir files have frontmatter removed (only body content merged)
  • Alphabetical ordering: Merged files sorted by path
  • Edge case handling: Hidden files excluded, symlinks skipped, empty subdirs handled gracefully
  • Backward compatible: Single-file skills work unchanged

Test Coverage

  • 14 new tests for recursive merge functionality
  • 60 total tests pass in skill-loader module
  • TDD approach: RED-GREEN-REFACTOR workflow followed

Verification

  • bun test src/features/opencode-skill-loader/ → 60 pass
  • bun run typecheck → clean
  • bun run build → success
  • Integration test with real skill → PASS

codewithkenzo added 6 commits January 20, 2026 20:02
- Reactivated disabled agents
- Created test fixtures for multi-file skills
- Multiple improvements and refactoring
- Export loadSkillFromPath for testing
- Add recursive merge test describe block
- Test expects merged content from subdirectories
- RED phase: test fails as implementation doesn't merge yet
- Add collectSubdirMdFiles helper to collect .md from immediate subdirs
- Integrate helper into loadSkillFromPath after mcpConfig
- Merge content appended with HTML comment marker
- Files sorted alphabetically by path
- Frontmatter stripped from subdir files
- Test nested subdirs at depth 2 (rules/auth/advanced.md)
- Test nested subdirs at depth 3 (rules/auth/oauth/spec.md)
- Test depth 4+ exclusion (should NOT appear)
- RED phase: tests fail as recursive merge not implemented
- Replace collectSubdirMdFiles with recursive collectMdFilesRecursive
- Add currentDepth/maxDepth tracking (default max 3)
- Add basePath for relative path construction
- Skip symlinks for security
- Collect .md files only at depth > 0 (skip SKILL.md at root)
- Sort results alphabetically by path
- Test root README.md exclusion (passes - depth 0 files skipped)
- Test hidden file exclusion (passes - startsWith('.') check)
- Test frontmatter stripping in subdirs (passes - parseFrontmatter)
- Test empty subdir handling (passes - graceful empty return)
- Test backward compat with single-file skills (passes - no merge comment)
@greptile-apps

greptile-apps Bot commented Jan 20, 2026

Copy link
Copy Markdown

Skipped: This PR changes more files than the configured file change limit: (510 files found, 500 file limit)

@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA).

To sign the CLA, please comment on this PR with:

I have read the CLA Document and I hereby sign the CLA

This is a one-time requirement. Once signed, all your future contributions will be automatically accepted.


I have read the CLA Document and I hereby sign the CLA


codewithkenzo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@codewithkenzo

Copy link
Copy Markdown
Owner Author

I have read the CLA Document and I hereby sign the CLA

@codewithkenzo codewithkenzo deleted the feat/skill-loader-extension branch January 20, 2026 19:55
codewithkenzo pushed a commit that referenced this pull request Jan 21, 2026
#6)

* fix(publish): make git operations idempotent

- Check for staged changes before commit
- Check if tag exists before creating
- Check if release exists before creating

* fix(session-recovery): handle empty content from interrupted reasoning

- Add THINKING_TYPES set including 'reasoning' type (OpenCode's thinking)
- Add hasNonEmptyOutput() to detect messages with only thinking/meta parts
- Add findEmptyContentMessage() to scan all messages for empty content
- Handle step-start/step-finish meta parts in empty content detection
- Patch interrupted messages with '(interrupted)' text before falling back to revert
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