copit
v1.0.2
Published
GitHub File Fetcher TUI - Download files from GitHub repositories with OAuth authentication, fuzzy search, and download history
Readme
copit
A GitHub File Fetcher TUI application that allows you to browse and download files from GitHub repositories with OAuth authentication, fuzzy search, and download history management.
Features
- 🔐 GitHub OAuth Authentication - Secure Device Flow authentication
- 🔍 Fuzzy Search - Fast file and repository search using fuse.js
- 📋 Download History - Track and quickly re-download recent files
- 🚀 Terminal UI - Beautiful terminal interface built with ink + React
- 💾 Encrypted Storage - Secure token storage with AES-256-GCM encryption
- 🛡️ Security - Path traversal protection and input validation
Installation
Global Installation
# Install globally via npm
npm install -g copit
# Or install via bunx (recommended)
bunx copitLocal Development
# Clone the repository
git clone https://github.com/mrsekut/copit.git
cd copit
# Install dependencies
bun install
# Run in development mode
bun run devUsage
Basic Usage
# Run the application
copit
# Or with bunx
bunx copitEnvironment Variables
Create a .env file or set environment variables:
# GitHub OAuth Client ID (optional - uses default if not set)
GITHUB_CLIENT_ID=your_github_client_idFirst Run
- Run
copitcommand - Follow the OAuth authentication flow
- Browse repositories and download files
- Use Tab to switch between History and Browse modes
Navigation
- ↑/↓ - Navigate through lists
- Enter - Select/Download files
- Tab - Switch between History and Browse modes
- Esc - Go back or exit
- Type - Fuzzy search in any list
GitHub OAuth Setup
To use your own GitHub OAuth App:
- Go to GitHub Developer Settings
- Create a new OAuth App with these settings:
- Application name:
copit(or your preferred name) - Homepage URL:
https://github.com/mrsekut/copit - Authorization callback URL:
http://localhost(not used for device flow)
- Application name:
- Enable "Device Flow" in the app settings
- Copy the Client ID and set it as
GITHUB_CLIENT_IDenvironment variable
Architecture
Built with modern technologies and patterns:
- Runtime: Bun
- UI: ink + React for terminal interface
- State Management: jotai
- Authentication: GitHub OAuth Device Flow
- Search: fuse.js for fuzzy search
- Architecture: Package by Feature pattern
- Language: TypeScript with strict type checking
Security
- OAuth tokens are encrypted using AES-256-GCM
- Path traversal protection for file downloads
- Input validation and sanitization
- No hardcoded secrets (configurable via environment variables)
Scripts
# Development
bun run dev # Start development server
bun run build # Build for production
bun run typecheck # Run TypeScript type checking
bun run lint # Run ESLint
bun run format # Format code with Prettier
bun run test # Run tests
bun run check # Run all checks (typecheck + lint + format + test)Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run
bun run checkto ensure code quality - Submit a pull request
License
MIT License - see LICENSE file for details.
