Skip to content

Commit 03c30d7

Browse files
committed
skills: clarify download_skills docstring and ruff format
Address review nit — restructure the download_skills docstring into explicit list/decide/fetch stages. Run ruff format to wrap an over-length line in tests (fixes the test_ruff_format CI check).
1 parent c468eec commit 03c30d7

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/ucode/skills_download.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,19 @@ def _fetch_bundles(
259259
def download_skills(workspace: str, token: str, locations: list[str], path: str | None) -> None:
260260
"""Download every skill in each ``<catalog>.<schema>`` location to disk.
261261
262-
Locations are processed sequentially. Within each, overwrite prompts run
263-
first so declined skills are never fetched, then the survivors' bundles are
264-
fetched concurrently (with a progress bar) and written. Processing one
265-
location fully before the next lets a same-named skill from a later location
266-
see the earlier one on disk and prompt. A failure on one skill warns and
267-
skips it without aborting the batch.
262+
Locations are processed one at a time, and each runs three stages:
263+
264+
1. **List** the schema's skill leaves.
265+
2. **Decide** which to download via ``should_download_skill`` (skips invalid
266+
names and prompts before overwriting a skill already on disk), so a
267+
declined skill is never fetched.
268+
3. **Fetch** the survivors' bundles concurrently (with a progress bar) and
269+
**write** them.
270+
271+
Finishing one location before starting the next means a skill written for an
272+
earlier location is already on disk when a same-named skill in a later
273+
location reaches its decide stage, so the overwrite prompt still fires. A
274+
failure on one skill warns and skips it without aborting the batch.
268275
"""
269276
roots = skill_dir_roots(path)
270277
roots_display = " and ".join(str(root) for root in roots)

tests/test_skills_download.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ def test_writes_bundle_into_every_root(self, tmp_path):
291291
def test_path_traversal_is_rejected(self, tmp_path):
292292
roots = skill_dir_roots(str(tmp_path))
293293

294-
write_skill(roots, "triage", {"SKILL.md": b"ok", "../escape.md": b"nope", "/abs.md": b"nope"})
294+
write_skill(
295+
roots, "triage", {"SKILL.md": b"ok", "../escape.md": b"nope", "/abs.md": b"nope"}
296+
)
295297

296298
assert (roots[0] / "triage/SKILL.md").read_bytes() == b"ok"
297299
assert not (tmp_path / "escape.md").exists()

0 commit comments

Comments
 (0)