Skip to content

oci: extract artifact-agnostic primitives into oci/artifact (Phase 0, THV-0077)#133

Open
JAORMX wants to merge 1 commit into
mainfrom
feat/oci-artifact-shared-primitives
Open

oci: extract artifact-agnostic primitives into oci/artifact (Phase 0, THV-0077)#133
JAORMX wants to merge 1 commit into
mainfrom
feat/oci-artifact-shared-primitives

Conversation

@JAORMX

@JAORMX JAORMX commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Phase 0 of plugin support (RFC THV-0077)

Extracts the artifact-agnostic OCI primitives out of oci/skills into a new oci/artifact package so the upcoming oci/plugins package can reuse them. Behavior-preserving refactor — no logic changes.

What moved to oci/artifact

  • tarCreateTar/ExtractTar/ExtractTarWithLimit, FileEntry, TarOptions/DefaultTarOptions, MaxTarFileSize, path-traversal/symlink rejection
  • gzipCompress/Decompress/DecompressWithLimit, CompressTar/DecompressTar, GzipOptions/DefaultGzipOptions, MaxDecompressedSize (decompression-bomb guard)
  • platformPlatformString/ParsePlatform/DefaultPlatforms + OS/Arch consts
  • pull-hardening — promoted to exported ValidatingTarget/NewValidatingTarget (+ manifest/blob size caps and manifest-count limits, digest verification)

Backward compatibility

oci/skills re-exports every moved symbol via type aliases (type X = artifact.X), var-forwarding for funcs, and const re-declaration (oci/skills/artifact_aliases.go). The public surface of oci/skills is unchanged — no exported signature changed, and downstream consumers (toolhive) are unaffected. The skills determinism tests still assert byte-stable artifact digests, proving published skill digests don't change.

Notes

  • Skill-specific code (media types, labels, SkillConfig, Packager, Registry, Store) stays in oci/skills.
  • New package is Alpha (per CLAUDE.md stability tracks).
  • This phase precedes GATE-C1 (tag toolhive-core + bump toolhive's go.mod), which is tracked in the epic.

Closes #130
Part of stacklok/toolhive#5525
RFC: stacklok/toolhive-rfcs#77

🤖 Generated with Claude Code

Phase 0 of plugin support (THV-0077). Move the artifact-agnostic OCI
primitives out of oci/skills into a new oci/artifact package so a future
oci/plugins can reuse them:

- tar (CreateTar/ExtractTar*/FileEntry/TarOptions, MaxTarFileSize)
- gzip (Compress/Decompress*/CompressTar/DecompressTar, MaxDecompressedSize)
- platform helpers (PlatformString/ParsePlatform/DefaultPlatforms, OS/Arch)
- pull-hardening, exported as ValidatingTarget/NewValidatingTarget plus the
  manifest/blob size caps and manifest-count limits

oci/skills re-exports every moved symbol via type aliases, var-forwarding,
and const re-declaration (oci/skills/artifact_aliases.go), so the package's
public surface is unchanged and downstream consumers (toolhive) are
unaffected — no exported signature changed. Behavior-preserving move:
function bodies are identical and the oci/skills determinism tests still
assert byte-stable artifact digests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

[plugins] Phase 0: extract artifact-agnostic OCI primitives (THV-0077)

1 participant