Commit Graph

7 Commits

Author SHA1 Message Date
Kazuki Yamada b7cf3f05e2 refactor(git): Simplify URL construction by leveraging codeload.github.com auto-resolution
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>
2026-04-03 14:47:30 +09:00
Kazuki Yamada 951249f9cf perf(git): Use codeload.github.com directly to skip 302 redirect
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>
2026-04-03 14:35:34 +09:00
Kazuki Yamada 44f15b6477 refactor(core): Remove unused getArchiveFilename function
The streaming tar.gz extraction no longer uses temporary files,
making this filename generation function unnecessary.
2026-02-18 22:41:26 +09:00
Kazuki Yamada ef194b8eeb perf(core): Replace ZIP archive download with streaming tar.gz extraction
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
2026-02-18 00:22:07 +09:00
Kazuki Yamada bea8df18bb feat(git): Use HEAD instead of hardcoded main branch for GitHub archives
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
2025-08-26 01:01:01 +09:00
Kazuki Yamada 8696b32db4 fix(github): Address PR review feedback for archive download feature
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>
2025-06-15 21:28:35 +09:00
Kazuki Yamada 5270bbcafe refactor(remote): Use fflate for ZIP extraction and improve GitHub URL parsing
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>
2025-06-15 20:47:16 +09:00