Skip to content

fix: strip 'skills/' prefix in _collect_bare_skill to prevent double nesting#734

Open
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee:fix/719-skills-double-nesting
Open

fix: strip 'skills/' prefix in _collect_bare_skill to prevent double nesting#734
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee:fix/719-skills-double-nesting

Conversation

@Jah-yee
Copy link
Copy Markdown
Contributor

@Jah-yee Jah-yee commented Apr 16, 2026

Summary

When a dependency has virtual_path='skills/javascript-typescript-jest', the bare skill collector in _collect_bare_skill was producing output paths like skills/skills/javascript-typescript-jest/SKILL.md instead of skills/javascript-typescript-jest/SKILL.md.

This happens because the slug (derived from virtual_path) already contains the skills/ prefix, and the code unconditionally prepends another skills/ to the output path.

Fix

Strip the skills/ prefix from the slug before prepending skills/ in the output path:

# Strip "skills/" prefix to avoid double nesting like "skills/skills/..."
if slug.startswith("skills/"):
    slug = slug[len("skills/"):]

Test added

test_virtual_path_with_skills_prefix_no_double_nesting in tests/unit/test_plugin_exporter.py covers this exact bug scenario.

Fixes #719.

…nesting

When a dependency has virtual_path='skills/javascript-typescript-jest', the
bare skill collector was producing 'skills/skills/javascript-typescript-jest/'
instead of 'skills/javascript-typescript-jest/'.

Fixes microsoft#719.
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.

[BUG] apm pack --format plugin produces duplicated skills/ directory nesting

1 participant