codeload.github.com resolves branches, tags, and SHAs automatically
without refs/heads/ or refs/tags/ prefixes. This eliminates the tag
fallback URL entirely and simplifies buildGitHubArchiveUrl to a single
return statement, saving an extra round trip for tag-based downloads.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Download archives from codeload.github.com instead of github.com/archive
to eliminate the intermediate 302 redirect, saving ~100-300ms per request.
This is the same pattern used by create-react-app and degit.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous ZIP-based archive download used fflate's in-memory extraction,
which failed on large repositories (e.g. facebook/react) due to memory
constraints and ZIP64 limitations.
Switch to tar.gz format with Node.js built-in zlib + tar package, enabling
a full streaming pipeline (HTTP response -> gunzip -> tar extract -> disk)
with no temporary files and constant memory usage regardless of repo size.
Key changes:
- Replace fflate with tar package for archive extraction
- Change archive URLs from .zip to .tar.gz
- Use streaming pipeline instead of download-then-extract
- Leverage tar's built-in strip and path traversal protection
- Explicitly destroy streams after pipeline for Bun compatibility
- Use child_process runtime under Bun to avoid worker_threads hang
Replace hardcoded 'main' branch with 'HEAD' to automatically use the repository's default branch, eliminating issues with repositories that use different default branch names like 'master' or custom branches.
Changes:
- buildGitHubArchiveUrl now uses HEAD.zip instead of refs/heads/main.zip
- getArchiveFilename defaults to HEAD instead of main
- Updated corresponding tests to reflect the new behavior
User requested fixes for GitHub archive download implementation based on PR review comments:
- Fix ref assignment to use nullish coalescing (??) instead of logical OR for proper empty string handling
- Add comprehensive test coverage for archive download path and git clone fallback scenarios
- Implement main/master branch fallback strategy to handle repositories with different default branches
- Enhance test assertions to verify fallback execution in remoteAction tests
- Add buildGitHubMasterArchiveUrl function with corresponding test coverage
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
User requested performance and reliability improvements:
- User asked: "zipの展開はfflateを使ってください"
- User asked: "gitのURLのパースは @src/core/git/gitRemoteParse.ts を参考にするか利用"
- User asked: "githubモジュールではなくgitフォルダに入れてください"
Key improvements:
- Replace system unzip dependency with fflate for cross-platform compatibility
- Move GitHub modules from core/github/ to core/git/ for better organization
- Consolidate GitHub URL parsing with existing git-url-parse functionality
- Fix branch name parsing for complex branch names like feature/test
- Improve URL parsing to handle slash-separated branch names correctly
Technical changes:
- Added fflate dependency for ZIP extraction
- Moved and renamed files: githubApi.ts -> gitHubArchiveApi.ts, githubArchive.ts -> gitHubArchive.ts
- Enhanced parseGitHubRepoInfo() to extract branches directly from URLs
- Updated all imports and test files for new structure
- All 661 tests passing with improved reliability
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>