Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/sync_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def collect_needed_commands() -> list[CommandSpec]:
meta = parse_frontmatter(skill_md.read_text())
desc = str(meta.get("description", ""))
for trigger in slash_triggers(meta):
cmd_name = trigger.lstrip("/")
# Replace colons with dashes for cross-platform filename compatibility
cmd_name = trigger.lstrip("/").replace(":", "-")
cmd_path = skill_dir / "commands" / f"{cmd_name}.md"
needed.append(CommandSpec(path=cmd_path, trigger=trigger, description=desc))
return needed
Expand Down
14 changes: 14 additions & 0 deletions tests/test_sync_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ def test_paths_are_under_commands_dir(self):
assert spec.path.parent.name == "commands"
assert spec.path.suffix == ".md"

def test_colon_triggers_are_normalized_for_filenames(self, tmp_path, monkeypatch):
skill_dir = tmp_path / "skills" / "test-skill"
skill_dir.mkdir(parents=True)
(skill_dir / "SKILL.md").write_text(
"---\nname: test-skill\ndescription: Test\ntriggers:\n - /test:command\n---\nBody\n"
)

monkeypatch.setattr("sync_extensions.SKILL_DIRS", [tmp_path / "skills"])

specs = collect_needed_commands()
assert [spec.path.relative_to(tmp_path).as_posix() for spec in specs] == [
"skills/test-skill/commands/test-command.md"
]


# ── load_marketplaces ────────────────────────────────────────────────

Expand Down
Loading