Archive GitHub repositories via CLI
npm install github-archiver


A powerful CLI for mass archiving GitHub repositories with parallel processing and comprehensive error handling.
- ⨠Mass Archive - Archive multiple repositories in parallel
- š Secure Auth - Token stored locally at ~/.github-archiver/config.json
- ā” Parallel Processing - Configurable concurrency (1-50)
- š Flexible Input - Load repos from editor, file, or stdin
- š Validation - Dry-run mode to validate without archiving
- š Progress Tracking - Real-time progress bars and ETA
- š”ļø Error Recovery - Comprehensive error handling with helpful guidance
- š Detailed Logging - Structured logging to files and console
``bash`
npm install -g github-archiver
or with Bun:
`bash`
bun install -g github-archiver
`bash`
git clone https://github.com/mynameistito/github-archiver.git
cd github-archiver
bun install && bun run build
bun install -g .
`bash`
bun install
bun run dev --
Note: This project is optimized for Bun. While it works with Node.js (v22+), Bun provides faster installation, execution, and development experience.
`bashAuthenticate
github-archiver auth login
Commands
$3
Manage GitHub authentication.
| Command | Description |
| -------------- | ---------------------------------- |
|
auth login | Authenticate with Personal Access Token |
| auth logout | Remove stored token |
| auth status | Check authentication status |$3
Archive multiple repositories.
`bash
github-archiver archive [options]
`| Option | Default | Description |
| --------------------- | ------- | -------------------------------------- |
|
--file | - | Read repository URLs from file |
| --stdin | - | Read from stdin |
| --dry-run | false | Validate without archiving |
| --concurrency | 3 | Parallel operations (1-50) |
| --timeout | 300 | API timeout in seconds (10-3600) |
| --verbose | false | Enable verbose logging |
| --force | false | Skip confirmation prompts |Examples:
`bash
Interactive (opens editor)
github-archiver archiveFrom file
github-archiver archive --file repos.txtFrom stdin
cat repos.txt | github-archiver archive --stdinDry-run
github-archiver archive --file repos.txt --dry-runHigh concurrency
github-archiver archive --file repos.txt --concurrency 10Force without confirmation
github-archiver archive --file repos.txt --force
`Input Format
Supported formats:
- HTTPS:
https://github.com/owner/repo or https://github.com/owner/repo.git
- SSH: git@github.com:owner/repo.git or git@github.com:owner/repo
- Shorthand: owner/repoFile Example:
`
Repositories to archive
https://github.com/facebook/react
torvalds/linux
owner/private-repoComments ignored
https://github.com/nodejs/node
`GitHub Token Requirements
- Scope:
repo (Full control of private repositories)
- Minimum Permissions: Push access to target repositoriesGenerate token: https://github.com/settings/tokens/new ā Create with
repo scope ā Run github-archiver auth loginOutput Example
`
š Checking authentication...
ā
Authenticated as: usernameš Getting repositories...
š Will archive 5 repositories:
1. facebook/react
2. torvalds/linux
3. owner/repo-1
4. owner/repo-2
5. owner/repo-3
Are you sure you want to archive these repositories? [y/N]: y
Starting to archive repositories... (concurrency: 3)
[======================= ] 4/5 (80%) - owner/repo-3
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Archive Operation Summary ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Successful: 5 ā
ā Skipped: 0 ā
ā Failed: 0 ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Total: 5 ā
ā Duration: 2m 45s ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
All repositories processed successfully!
`Troubleshooting
$3
No token found: Run
github-archiver auth loginInvalid/expired token: Generate new token at https://github.com/settings/tokens ā
auth logout ā auth login$3
Permission denied: Verify repo ownership/push access, check
repo scope, ensure repo isn't already archived$3
Rate limit exceeded: Wait (resets hourly), lower
--concurrency 1, increase --timeout 600$3
Network error/timeout: Check connection, GitHub API may be unavailable, retry with
--timeout 600$3
Repository not found: Verify URL, check if deleted, confirm GitHub access
Configuration
Config:
~/.github-archiver/config.json (Linux/macOS) or %USERPROFILE%\.github-archiver\config.json (Windows)Logs:
~/.github-archiver/logs/ (Linux/macOS) or %USERPROFILE%\.github-archiver\logs\ (Windows)Architecture
`
src/
āāā commands/ # CLI commands (auth, archive)
āāā services/ # GitHub API, archiving, auth management
āāā utils/ # Parsing, formatting, logging
āāā types/ # TypeScript definitions
āāā constants/ # Configuration constantstests/
āāā unit/ # Unit tests
`Core Services:
- GitHubService: GitHub API interactions with retry logic
- Archiver: Parallel archiving with p-queue
- AuthManager: Secure token storage
- InputHandler: Input from editor, file, or stdin
- ProgressDisplay: Progress bar and summary output
Development
`bash
bun installDevelopment commands
bun run typecheck # Check TypeScript
bun run test # Run unit tests
bun run test:coverage # Run tests with coverage
bun run build # Build production bundle
bun run lint # Check code style
bun run format # Auto-format code
bun run dev -- auth login # Run dev mode
`Using npm instead?
`bash
npm install
npm run typecheck # Equivalent commands
npm run test
npm run build
npm run lint
npm run format
`$3
This project uses Ultracite (Biome) for:
- Strict TypeScript (no implicit
any)
- Accessibility, performance, security best practices
- Consistent formatting
- Comprehensive error handlingRun code quality checks:
`bash
Check for issues
bun run lintAuto-fix and format code
bun run format
`See
AGENTS.md for detailed code standards and best practices.Release Process
This project uses semantic-release for automated versioning and publishing.
Commit format (Conventional Commits):
-
feat: ā minor bump
- fix: ā patch bump
- BREAKING CHANGE: ā major bump
- chore:, docs:, test: ā no bumpPushing to
main triggers automatic release. See docs/RELEASE.md for detailed setup and workflow.Contributing
1. Install dependencies:
bun install
2. Follow code standards: bun run format
3. Add tests for new features
4. Ensure bun run typecheck and bun run test pass
5. Create pull request with clear descriptionBefore committing:
`bash
bun run format # Auto-fix code style
bun run lint # Check for issues
bun run typecheck # Verify TypeScript
bun run test # Run test suite
bun run build # Build production bundle
``MIT - See LICENSE file for details.
Check the Troubleshooting section or open an issue on GitHub.
- Runtime: Bun (primary) or Node.js 22+
- Package Manager: Bun (recommended) or npm
- Language: TypeScript
- CLI Framework: Commander.js
- GitHub API: Octokit
- Logging: Winston
- Code Quality: Biome (via Ultracite preset)
- Task Queue: p-queue
- Release Management: Changesets
Built with TypeScript, Commander.js, Octokit, Winston, Biome, and optimized for Bun runtime.
---