Skip to content

[skills] Support removing downloaded skills - #585

Open
xsh310 wants to merge 1 commit into
skills-download-attributionfrom
skills-download-remove
Open

xsh310 wants to merge 1 commit into
skills-download-attributionfrom
skills-download-remove

Conversation

@xsh310

@xsh310 xsh310 commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

What

Wire the download side of ug skill remove (until now it errored with "not
supported yet"), mirroring ug skill add's surface. Builds on #584, which records
what was downloaded from Unity Catalog.

Why

With the attribution manifest in place, ucode can finally delete downloaded skills
safely: removal is driven entirely by attribution, so a same-named skill the user
authored themselves is never touched. That safety is the reason this could not ship
before the manifest.

Behavior

  • ug skill remove --location <catalog.schema> deletes every skill downloaded from
    that schema, across all download bases; --path limits it to one base.
  • ug skill remove --skills <fqn>[,<fqn>...] deletes named fully-qualified skills
    that may span schemas (parity with ug skill add --skills).
  • ug skill remove with none of those opens a picker over every downloaded skill,
    across all bases, each row labeled <fqn> (<scope>: <base>).
  • --mcp removal is unchanged; --agents remains --mcp-only, and --location /
    --path / --skills are rejected with --mcp.

Changes

  • skills_state.remove_downloads deletes each record's directories, then forgets it;
    records_for_fqns looks records up by fully-qualified name.
  • remove_downloaded_skills_command and the removal picker live in skills_download,
    next to the download flows they mirror.
  • ug skill remove grows --location, --path, and --skills.

Testing

uv run ruff check, ruff format --check, ty check src, and uv run pytest all
pass (the pre-existing test_e2e_user_agent / test_claude_smart_routing_v2
failures also fail on the base). Added unit coverage for remove_downloads and
records_for_fqns, the by-location / by-name / picker removal paths (including that
a user-authored directory is left alone), and the CLI routing and argument validation.

Screen.Recording.2026-09-12.at.12.17.52.PM.mov

Stack

Part of gh stack #576, on top of #584 (skills-download-attribution).

This pull request and its description were written by Isaac.

@xsh310
xsh310 added this pull request to stack #576 September 12, 2026 18:38
Comment thread src/ucode/cli.py Outdated
Comment thread src/ucode/cli.py
@xsh310
xsh310 force-pushed the skills-download-remove branch from afbe344 to 0dab5b7 Compare September 12, 2026 18:53
Comment thread README.md Outdated
@xsh310
xsh310 force-pushed the skills-download-remove branch from 0dab5b7 to 858ef09 Compare September 12, 2026 19:02
@xsh310
xsh310 marked this pull request as ready for review September 12, 2026 19:25
@xsh310
xsh310 force-pushed the skills-download-remove branch from 858ef09 to 3d39669 Compare September 13, 2026 00:22
@xsh310 xsh310 changed the title [skills] Support removing and listing downloaded skills [skills] Support removing downloaded skills Sep 13, 2026
@xsh310
xsh310 marked this pull request as draft September 13, 2026 00:23
@xsh310
xsh310 force-pushed the skills-download-remove branch from 3d39669 to 3d336ef Compare September 13, 2026 00:46
@xsh310
xsh310 force-pushed the skills-download-remove branch from 3d336ef to 721b50f Compare September 13, 2026 01:04
@xsh310
xsh310 marked this pull request as ready for review September 13, 2026 01:10
@xsh310
xsh310 force-pushed the skills-download-remove branch from 721b50f to 39ad41b Compare September 14, 2026 03:08
@xsh310
xsh310 force-pushed the skills-download-remove branch from 39ad41b to c9b26aa Compare September 14, 2026 20:09
Comment thread src/ucode/skills_state.py
if not records:
return
for record in records:
_delete_dirs(record.get("dirs") or [])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: remove_downloads deletes the on-disk dirs first, then forget() rewrites the manifest. If _save fails after deletion (disk full, etc.), the files are gone but their records remain → phantom entries pointing at deleted dirs on the next run. Also, _delete_dirs uses shutil.rmtree(..., ignore_errors=True), so a dir that's a symlink is silently skipped yet still forget()-ten — the link lingers with no signal. Both are minor; consider forgetting-then-deleting, or at least noting undeletable paths.

@xsh310
xsh310 force-pushed the skills-download-remove branch from c9b26aa to 3a7492a Compare September 14, 2026 22:32
@xsh310
xsh310 force-pushed the skills-download-remove branch from 3a7492a to acf23eb Compare September 14, 2026 23:20
@xsh310
xsh310 force-pushed the skills-download-remove branch from acf23eb to fb6c3e8 Compare September 15, 2026 00:53
@xsh310
xsh310 force-pushed the skills-download-remove branch 2 times, most recently from c48fb8f to 3186994 Compare September 15, 2026 01:41
@xsh310
xsh310 force-pushed the skills-download-remove branch from 3186994 to 00b0da6 Compare September 15, 2026 03:30
@xsh310
xsh310 force-pushed the skills-download-remove branch from 00b0da6 to 98a2cac Compare September 15, 2026 03:40
Wire the download side of `ug skill remove`, which until now errored with "not
supported yet", mirroring `ug skill add`'s surface:

- `ug skill remove --location <catalog.schema>` deletes every skill downloaded
  from that schema (all bases, or one with `--path`).
- `ug skill remove --skills <fqn>[,<fqn>...]` deletes named fully-qualified skills
  that may span schemas.
- Bare `ug skill remove` opens a picker over every downloaded skill across all
  bases, labeled by scope and base, and flagged `(missing)` when the directory is
  already gone.

Removal is driven entirely by the attribution manifest, so a same-named skill the
user authored is never touched. Deletion lives in skills_state.remove_downloads;
the CLI and picker live in skills_download alongside the download flows they mirror.

Co-authored-by: Isaac <no-reply@databricks.com>
@xsh310
xsh310 force-pushed the skills-download-remove branch from 98a2cac to 7dbb63c Compare September 15, 2026 04:42
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.

2 participants