feat(cat,cp): implement cat and cp commands - #13
Merged
Merged
Conversation
Add two new commands for efficient file access from blob archives: cat command: - Print file contents to stdout using HTTP range requests - Support multiple files (concatenated in order) - Validate files exist and reject directories before output - Normalize leading slashes for consistent path handling - Respect --quiet flag after validation cp command: - Copy files/directories from archive to local filesystem - Parse ref:/path format (e.g., ghcr.io/repo:v1:/config.json) - Detect source type (file vs directory) from archive using Stat() - Support multiple sources from different refs (grouped to avoid re-pulling) - Flags: --recursive/-r (default: true), --preserve, --force/-f - Consistent overwrite behavior: skip existing by default, use -f to overwrite - Check destination exists before reading file content (avoid unnecessary downloads) Both commands use lazy archive loading - only manifest + index are downloaded upfront, with actual file data fetched via HTTP range requests on demand. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
blob catcommand for printing file contents to stdoutblob cpcommand for copying files/directories from archives to local filesystemFeatures
blob cat <ref> <file>...blob cp <ref>:<path>... <dest>Stat()--recursive/-r(default: true) - copy directories recursively--preserve- preserve file permissions and timestamps--force/-f- overwrite existing filesImplementation Details
archive.Stat()(not just trailing slash)Test plan
🤖 Generated with Claude Code