Add push SDK for uploading container images to OCI registry#8
Merged
Conversation
Ports the push functionality from hypeman-go/lib/push.go to TypeScript, following the same patterns established by cp.ts. Provides: - pushImage(): Push any OciImageSource to the registry - push(): Convenience to load from Docker daemon and push - pushFromURL(): Convenience with raw URL/apiKey - loadDockerImage(): Load image from local Docker via docker save Uses the OCI Distribution Spec for blob and manifest uploads with JWT bearer auth matching the Go implementation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hand-rolled docker save shelling and tar parsing with proper libraries: - Use dockerode for Docker daemon interaction (image.get() streams the tar, equivalent to go-containerregistry's daemon.Image) - Use tar-stream for parsing the docker save archive - Add extractPushConfig() to match Go's ExtractPushConfig API - Change PushConfig to use registryHost (matching Go) instead of baseURL Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- push.ts: import Docker from 'dockerode' and import * as tar from 'tar-stream' at top level, remove getDockerode/getTarStream wrappers - cp.ts: import WebSocket from 'ws' at top level, remove getWebSocket wrapper and its call sites No bundling concerns for this SDK so lazy loading is unnecessary. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Unit tests cover extractPushConfig, image reference parsing, blob upload flow (auth headers, skip-existing, full upload sequence, error cases), manifest content type, and pushFromURL. Integration tests are gated behind HYPEMAN_INTEGRATION_TESTS=1 env var. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Regenerate pnpm-lock.yaml to include dockerode and tar-stream deps. Fix TS4111 errors by using bracket notation for process.env access. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Default to hypeman-test repo (matching scoped token claims). Allow override via HYPEMAN_TEST_REPO env var. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sjmiller609
approved these changes
Mar 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports the push functionality from
hypeman-go/lib/push.goto TypeScript, following the same patterns established bycp.ts.Exported API
pushImage(cfg, image, targetName)— Push anyOciImageSourceto the hypeman OCI registry. Core function analogous to Go'sPushImage().push(cfg, sourceImage, targetName?)— Convenience: load from local Docker daemon and push. Analogous to Go'sPush().pushFromURL(baseURL, apiKey, image, targetName)— Convenience with raw URL/apiKey instead of config object. Analogous to Go'sPushFromURL().loadDockerImage(imageRef)— Load an image from the Docker daemon viadocker save, returning anOciImageSource.OciImageSourceinterface — Abstraction for container images from any source (Docker daemon, custom builds, etc.).Implementation details
docker saveoutput (no external tar dependency)src/lib/index.tsbarrel, importable as@onkernel/hypeman/lib/pushDifferences from Go
PushConfigusesbaseURL(likeCpConfigin TS) instead ofregistryHost— more consistent with the TS SDK pattern where users construct configs directlyExtractPushConfig— the TS SDK doesn't use the request options extraction patternOciImageSourceinterface replaces Go'sv1.Image— lightweight interface, no dependency on go-containerregistry equivalentchild_process.spawnfordocker saveinstead of Docker daemon API directlyTest plan
tsc --noEmit)push()with a local Docker image against a hypeman registrypushImage()with a customOciImageSourceloadDockerImage()parses multi-layer images correctlyNote
Medium Risk
Adds new container image push functionality that performs authenticated HTTP uploads and parses
docker savearchives, which could impact users via network/protocol edge cases and large payload handling.Overview
Adds a new
lib/pushmodule that can upload container images to Hypeman’s OCI registry, including helpers to derivePushConfigfrom a client, push an arbitraryOciImageSource, and load/push images from the local Docker daemon.Implements the OCI Distribution upload flow (blob existence checks, blob uploads, and manifest publishing) and introduces accompanying Jest coverage for config extraction, reference parsing, and upload request behavior; also re-exports the new API from
src/lib/index.tsand adds required dependencies (dockerode,tar-stream).Written by Cursor Bugbot for commit 01ffee7. This will update automatically on new commits. Configure here.