Skip to content

Add thv skill builds command to list and remove locally-built OCI skill artifacts#4674

Merged
samuv merged 9 commits intomainfrom
skills-build-deletion
Apr 8, 2026
Merged

Add thv skill builds command to list and remove locally-built OCI skill artifacts#4674
samuv merged 9 commits intomainfrom
skills-build-deletion

Conversation

@samuv
Copy link
Copy Markdown
Contributor

@samuv samuv commented Apr 8, 2026

Summary

thv skill build packages a skill directory into a local OCI artifact, but there was no way to see or manage what had been built. This adds:

  • thv skill builds — lists all locally-built OCI skill artifacts with tag, digest, name, and version
  • thv skill builds remove <tag> — removes a locally-built artifact and garbage-collects its blobs when no other tag shares the same digest

Key design decisions

  • ListBuilds filters by ArtifactType == "dev.toolhive.skills.v1" so that remotely-pulled skills sharing the local OCI store are not surfaced
  • Metadata extraction (name, description, version) is best-effort: artifacts without parseable OCI config labels still appear with those fields empty
  • DeleteBuild delegates to Store.DeleteBuild (toolhive-core v0.0.14) which handles orphaned-blob cleanup atomically — blobs are retained when another tag shares the same digest

Type of change

  • New feature

Changes

File Change
go.mod / go.sum Bump toolhive-core to v0.0.14
pkg/skills/options.go Add LocalBuild type
pkg/skills/service.go Add ListBuilds and DeleteBuild to SkillService interface
pkg/skills/skillsvc/skillsvc.go Implement ListBuilds (with ArtifactType filter), DeleteBuild, and isSkillArtifact helper
pkg/skills/skillsvc/skillsvc_test.go 7 tests for ListBuilds, 4 tests for DeleteBuild
pkg/skills/mocks/mock_service.go Regenerated mock
pkg/api/v1/skills.go + skills_types.go GET /builds and DELETE /builds/{tag} handlers
pkg/api/v1/skills_test.go 6 router tests for the new endpoints
pkg/skills/client/client.go + dto.go ListBuilds and DeleteBuild HTTP client methods
cmd/thv/app/skill_builds.go thv skill builds CLI command
cmd/thv/app/skill_builds_remove.go thv skill builds remove CLI subcommand
docs/server/ Regenerated OpenAPI spec

Does this introduce a user-facing change?

Yes. Users can now run:

  • thv skill builds to list locally-built artifacts
  • thv skill builds remove <tag> to remove an artifact and its blobs

The same operations are available via the API at GET /api/v1beta/skills/builds and DELETE /api/v1beta/skills/builds/{tag}.

Special notes for reviewers

DELETE /builds/{tag} is registered as a more-specific route than the existing DELETE /{name} wildcard in the chi router, so there is no routing conflict. The 404 on a missing tag is propagated directly from Store.DeleteBuild in toolhive-core.

@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Apr 8, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.92%. Comparing base (8b8412b) to head (6cc3288).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/skills/client/client.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4674      +/-   ##
==========================================
+ Coverage   68.84%   68.92%   +0.07%     
==========================================
  Files         509      509              
  Lines       52668    52684      +16     
==========================================
+ Hits        36259    36310      +51     
+ Misses      13606    13570      -36     
- Partials     2803     2804       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/S Small PR: 100-299 lines changed labels Apr 8, 2026
@samuv samuv force-pushed the skills-build-deletion branch from f333f40 to 6cc3288 Compare April 8, 2026 16:35
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Apr 8, 2026
@samuv samuv merged commit 1ada27f into main Apr 8, 2026
40 checks passed
@samuv samuv deleted the skills-build-deletion branch April 8, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants