getgrabkit
v0.1.5
Published
Deterministic advanced TUI for selecting and downloading GitHub repository files
Maintainers
Readme
GrabKit
Dependency-aware GitHub file extraction from an interactive terminal UI.
GrabKit helps you explore a repository tree, preview files, select exactly what you need, and download only the minimal working set.
Quick Fixes
Use these when you want to get unblocked quickly.
- Start the app:
grabkit - If repo load fails, use a branch URL:
https://github.com/<owner>/<repo>/tree/main(or.../tree/master) - Smart Grab flow:
select file(s) -> press
s-> confirmy - Dependency preview before download:
press
d - Token note:
GITHUB_TOKENis optional; set it for higher rate limits and private repos.
Overview
Modern repositories are large. Cloning an entire repo when you only need a few files is slow and noisy.
GrabKit solves this by providing an interactive TUI workflow for selective extraction with optional dependency awareness.
Key benefits:
- Faster than full-clone workflows for targeted use cases
- Minimal and deterministic file extraction
- Built-in visibility (tree explorer + preview + dependency insight)
- Developer-friendly CLI controls and restore workflow
Documentation Website
- Live docs URL: https://getgrabkit.vercel.app/
- Source files:
docs/ - Deployment workflow:
.github/workflows/deploy-docs.yml
GitHub setup (one-time):
- Open repository Settings -> Pages.
- Set Build and deployment Source to GitHub Actions.
- Push to
mainto trigger docs deployment.
Local preview:
python -m http.server 4173 --directory docsThen open: http://localhost:4173
Features
- Interactive full-screen TUI file explorer
- Live file preview panel
- Multi-file and folder subtree selection
- Smart Grab (dependency-aware download)
- Dependency insight view before downloading
- Real-time filter/search inside repository
- Download modes:
- Flat
- Preserve structure
- Zip archive
- Project snapshot and restore (
grabkit.config.json)
Installation
npm install -g getgrabkitNote:
- Official package for this project:
getgrabkit - CLI commands supported:
grabkitandgetgrabkit
Usage
grabkitor
getgrabkitTypical flow:
- Enter a GitHub repository URL.
- Navigate the tree with arrow keys.
- Select files/folders with Space.
- Download selected files with Enter, or use Smart Grab with
s.
If repository loading fails with default branch resolution, use a branch-specific URL:
https://github.com/<owner>/<repo>/tree/mainhttps://github.com/<owner>/<repo>/tree/master
Help:
grabkit --helpor
getgrabkit --helpCLI Controls
| Key | Action | | --------- | -------------------------------------- | | ↑ ↓ ← → | Navigate tree | | Space | Select/unselect file or folder subtree | | Enter | Open folder or download selected files | | Backspace | Go to parent folder | | s | Smart Grab (dependency-aware) | | d | Dependency insight view | | / | Filter/search mode | | m | Choose download mode | | p | Toggle preview panel | | a | Select all | | x | Deselect all | | i | Invert selection | | t | Toggle theme | | q | Quit |
Examples
Example 1: Selective download from a large repo
- Run
grabkit(orgetgrabkit) - Enter:
https://github.com/owner/repo - Navigate to
src/utils - Select
format.jsandvalidate.js - Press Enter to download
Example 2: Dependency-aware extraction (Smart Grab)
- Highlight/select
src/server/index.js - Press
s - Review dependency count in confirmation prompt
- Press
yto continue, ornto cancel - (Optional) Press
dbefore Smart Grab to view dependency insight - Continue to download a minimal working set
Example 3: Restore previous snapshot
grabkit restoreor
grabkit restore ./backup/grabkit.config.jsonEquivalent alias commands:
getgrabkit restore
getgrabkit restore ./backup/grabkit.config.jsonSmart Grab
Smart Grab parses selected JavaScript files and recursively resolves local dependencies.
How to use:
- Load a repository in the TUI.
- Select one or more files (or highlight a file).
- Press
s. - Confirm the prompt:
Found N dependencies. Continue? (y/n). - Download includes selected files plus resolved local dependencies.
What it detects:
import ... from '...'require('...')- dynamic
import('...')
Current language support:
- JavaScript family (
.js,.mjs,.cjs,.jsx)
Limitations:
- External packages (
react,express, etc.) are intentionally ignored - Non-local imports are not pulled
- Missing or circular references are reported, then handled safely
Configuration
User-level configuration location:
~/.grabkit/config.jsonExample structure:
{
"savedRepos": [
"https://github.com/owner/repo",
"https://github.com/org/project"
],
"preferences": {
"downloadMode": "preserve",
"theme": "classic",
"previewEnabled": true
},
"githubToken": "optional_token_value"
}Field notes:
savedRepos: quick-access repository historypreferences: UI/download defaultsgithubToken: optional; environment variables are preferred for security
GitHub API Strategy
GrabKit minimizes API usage to reduce rate-limit pressure.
- Uses one tree API call for repository structure:
GET /repos/:owner/:repo/git/trees/:branch?recursive=1- Uses
raw.githubusercontent.comfor file content downloads:
https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{path}- Avoids
/contentsAPI usage for file payloads
Troubleshooting
grabkit or getgrabkit is not recognized
- Verify installation:
npm ls -g --depth=0 getgrabkit- Check npm prefix:
npm config get prefix- Ensure npm global bin is in PATH.
Windows common PATH entry:
C:\Users\<your-user>\AppData\Roaming\npm- Restart terminal.
Permission issues (global install)
- On Windows, run terminal as Administrator if needed.
- If stale shim conflicts appear, uninstall and reinstall globally.
Rate limit issues
GITHUB_TOKEN is optional. You can run and build without it.
Use a token for higher rate limits and private repository access.
Set token temporarily:
$env:GITHUB_TOKEN="your_token_here"Persist token:
setx GITHUB_TOKEN "your_token_here"Could not resolve repository default branch
If you see this message in TUI, provide a branch-specific URL:
https://github.com/<owner>/<repo>/tree/mainhttps://github.com/<owner>/<repo>/tree/master
You can also set a default branch for the current shell session:
$env:GRABKIT_DEFAULT_BRANCH="main"Invalid repository URL
- Ensure URL format is
https://github.com/<owner>/<repo> - For branch-specific URLs, use
.../tree/<branch>
Development
Project structure:
/bin
/cli
/ui
/services/github
/services/parser
/services/downloader
/utilsRun locally:
npm install
npm startLink local build globally for testing:
npm link
grabkit --help
getgrabkit --helpContributing
See CONTRIBUTING.md for contribution workflow and development setup.
See CODE_OF_CONDUCT.md for community standards.
- Fork the repository.
- Create a feature branch.
- Make focused changes with tests/validation.
- Open a Pull Request with a clear description.
Recommended PR content:
- What changed
- Why it changed
- How to verify
- Screenshots or terminal output (if relevant)
Security
See SECURITY.md for vulnerability reporting guidance.
Skills and Technologies
- Node.js (CLI development): runtime and module ecosystem for shipping portable command-line tools.
- Terminal UI (blessed): full-screen interactive interface with panels, lists, and keyboard-driven navigation.
- GitHub API integration: repository tree retrieval with minimal API surface.
- File system handling: deterministic writing, snapshot persistence, and mode-based output layouts.
- Dependency parsing (AST/regex): local import/require extraction for Smart Grab and dependency insight.
- CLI UX design: keybinding ergonomics, status messaging, error recovery, and flow clarity.
- Package publishing (npm): global-installable distribution with executable bin mapping.
- Cross-platform CLI development: Windows/macOS/Linux command behavior and path handling considerations.
License
MIT
