Package Exports
- gh-manager-cli
- gh-manager-cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gh-manager-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gh-manager-cli
Interactive terminal app to browse and manage your personal GitHub repositories. Built with Ink (React for CLIs) and the GitHub GraphQL API.
Fast, keyboard-first GitHub repo management from your terminal
Documentation
| Getting Started | Features | Development |
|---|---|---|
| π₯ Installation | π Features Overview | π οΈ Development Guide |
| π Token & Security | β¨οΈ Usage & Controls | π§ͺ Testing |
| β Troubleshooting | πΊοΈ Roadmap | π Wiki Home |
Screenshots
Listing β’ Auth β’ Delete confirmation
Quick Start
# Run with npx (no install)
npx gh-manager-cliOn first run, you'll be prompted for a GitHub Personal Access Token.
Features
Core Repository Management
- Token Authentication: Secure PAT storage with validation and persistence
- Repository Listing: Browse all your personal repositories with metadata (stars, forks, language, etc.)
- Live Pagination: Infinite scroll with automatic page prefetching
- Interactive Sorting: Modal-based sort selection (updated, pushed, name, stars) with direction toggle
- Smart Search: Server-side search through repository names and descriptions (3+ characters)
- Visibility Filtering: Modal-based visibility filter (All, Public, Private, Internal for enterprise) with server-side filtering
- Fork Status Tracking: Toggle display of commits behind upstream for forked repositories
- Repository Actions:
- View detailed info (
I) - Shows repository metadata, language, size, and timestamps - Open in browser (Enter/
O) - Delete repository (
DelorBackspace) with secure two-step confirmation - Archive/unarchive repositories (
Ctrl+A) with confirmation prompts - Sync forks with upstream (
Ctrl+S) with automatic conflict detection
- View detailed info (
User Interface & Experience
- Keyboard Navigation: Full keyboard control (arrow keys, PageUp/Down,
Ctrl+G/G) - Display Density: Toggle between compact/cozy/comfy spacing (
T) - Visual Indicators: Fork status, private/archived badges, language colors, visibility status
- Interactive Modals: Sort selection, visibility filtering, and organization switching via modal dialogs
- Balanced Layout: Repository items with spacing above and below for better visual hierarchy
- Loading States: Contextual loading screens for sorting and refreshing operations
- Rate Limit Monitoring: Live API usage display with visual warnings
- Improved Layout: Balanced spacing above and below repository items for better visual hierarchy
Technical Features
- Preference Persistence: UI settings (sort, density, visibility filter, fork tracking) saved between sessions
- Server-side Filtering: Visibility filtering performed at GitHub API level for accurate pagination
- Cross-platform: Works on macOS, Linux, and Windows
- Secure Storage: Token stored with proper file permissions (0600)
- Error Handling: Graceful error recovery with retry mechanisms
- Performance: Efficient GraphQL queries with virtualized rendering and server-side filtering
Installation
NPX (Recommended - No Installation Required)
Run instantly without installing:
npx gh-manager-cliNPM Global Install
Install globally for persistent gh-manager-cli command:
npm install -g gh-manager-cli
gh-manager-cliPre-built Binaries (No Node.js Required)
Download standalone executables from GitHub Releases:
- Linux:
gh-manager-cli-linux-x64 - macOS:
gh-manager-cli-macos-x64 - Windows:
gh-manager-cli-windows-x64.exe
Make the binary executable (Linux/macOS):
chmod +x gh-manager-cli-*
./gh-manager-cli-*From Source
Prerequisites:
- Node.js 18+
- pnpm
Install and build:
pnpm install
pnpm buildRun locally:
node dist/index.js
# Or add to PATH for dev
pnpm link
gh-manager-cliToken & Security
The app needs a GitHub token to read your repositories.
- Provide via env var:
GITHUB_TOKENorGH_TOKEN, or enter when prompted on first run. - Recommended: classic PAT with
reposcope for listing both public and private repos (read is sufficient). - Validation: a minimal
viewer { login }request verifies the token. - Storage: token is saved as JSON in your OS user config directory with POSIX perms
0600.- macOS:
~/Library/Preferences/gh-manager-cli/config.json - Linux:
~/.config/gh-manager-cli/config.json - Windows:
%APPDATA%\gh-manager-cli\config.json
- macOS:
- Revocation: you can revoke the PAT at any time in your GitHub settings.
Note: Tokens are stored in plaintext on disk with restricted permissions. Future work may add OS keychain support.
PAT Permissions & Scopes
Choose the least-privileged token for the features you plan to use:
- Browsing/searching repos (public only):
public_repo - Browsing/searching repos (includes private):
repo - Archive/Unarchive repository:
repo(and you must have admin or maintainer rights on the repo) - Sync fork with upstream:
repo(you must have push rights to your fork) - Delete repository:
delete_repo(and admin rights on the repo)
Notes:
- Organization repositories may require that your token is SSO-authorized if the org enforces SSO.
- If organization data doesnβt appear in the switcher, ensure your token is authorized for that org and consider adding
read:org(some org setups require it to list memberships). - Fine-grained PATs: grant Repository access to the repos you need and enable at least:
- Metadata: Read
- Contents: Read (list/search), Read & Write (sync/archive)
- Administration: Manage (only if you need delete)
If in doubt, the classic
reposcope plusdelete_repo(for deletion) is the simplest equivalent.
Usage
Launch the app, then use the keys below:
Navigation & View Controls
- Top/Bottom:
Ctrl+G(top),G(bottom) - Page Navigation: ββ Arrow keys, PageUp/PageDown
- Search:
/to enter search mode, type 3+ characters for server-side search- Down arrow or Enter: Start browsing search results
- Esc: Clear search and return to full repository list
- Sort:
Sopens sort modal with options:- Updated: When the repository was last modified
- Pushed: When code was last pushed
- Name: Alphabetical by repository name
- Stars: Number of stars
- Sort Direction:
Dto toggle ascending/descending - Display Density:
Tto toggle compact/cozy/comfy - Fork Status:
Fto toggle showing commits behind upstream - Visibility Filter:
Vopens modal (All, Public, Private, Internal for enterprise)
Navigation & Account
- Open in browser: Enter or
O - Refresh:
R - Organization switcher:
Wto switch between personal account and organizations - Logout:
Ctrl+L - Quit:
Q
Repository Actions
- Repository info:
Ito view detailed metadata (size, language, timestamps) - Cache info:
Ctrl+Ito inspect Apollo cache status - Archive/Unarchive:
Ctrl+Awith confirmation prompt - Delete repository:
DelorBackspace(with two-step confirmation modal)- Type confirmation code β confirm (Y/Enter)
- Cancel: press
Cor Esc
- Sync fork:
Ctrl+S(for forks only, shows commit status and handles conflicts)
General
- Esc: Cancels modals, clears search, or returns to normal listing (does not quit)
The header displays the current owner context (Personal Account or Organization name), active sort and direction, fork status tracking state, and active search/filter.
Status bar shows loaded count vs total. A rate-limit line displays remaining/limit and the reset time; it turns yellow when remaining β€ 10% of the limit.
Pagination Details
- Uses GitHub GraphQL
viewer.repositorieswithownerAffiliations: OWNER, ordered byUPDATED_AT DESC. - Fetches 15 repos per page by default (configurable via
REPOS_PER_FETCHenvironment variable, 1-50). - Updates
totalCounteach time and prefetches the next page when selection nears the end of loaded list.
Development
Stack:
- UI:
ink,ink-text-input,ink-spinner - API:
@octokit/graphql, Apollo Client - Config paths:
env-paths - Language: TypeScript
- Build:
tsup(CJS output with shebang)
Scripts:
pnpm build # build to dist/
pnpm build:binaries # build cross-platform binaries to ./binaries/
pnpm dev # watch mode
pnpm start # run normally
pnpm start:debug # run with debug mode enabled
pnpm start:dev # run with 5 repos per page and debug modeEnvironment variables:
REPOS_PER_FETCH: Number of repositories to fetch per page (1-50, default: 15)GH_MANAGER_DEBUG=1: Enables debug mode with performance metrics and detailed errors
Project layout:
src/index.tsxβ CLI entry and error handlingsrc/ui/App.tsxβ token bootstrap, rendersRepoListsrc/ui/RepoList.tsxβ main list UI with modal managementsrc/ui/components/β modular components (modals, repo, common)modals/β DeleteModal, ArchiveModal, SyncModal, InfoModal, LogoutModalrepo/β RepoRow, FilterInput, RepoListHeadercommon/β SlowSpinner and shared UI elements
src/ui/OrgSwitcher.tsxβ organization switching componentsrc/github.tsβ GraphQL client and queries (repos + rateLimit)src/config.tsβ token read/write and UI preferencessrc/types.tsβ shared typessrc/utils.tsβ utility functions (truncate, formatDate)src/apolloMeta.tsβ Apollo cache management
Apollo Cache (Performance)
gh-manager-cli includes built-in Apollo Client caching to reduce GitHub API calls and improve performance. Caching is always enabled for optimal performance.
Debug Mode
Run with GH_MANAGER_DEBUG=1 to enable debugging features:
GH_MANAGER_DEBUG=1 npx gh-manager-cliDebug mode provides:
- Apollo performance metrics: Query execution time, cache hit/miss indicators
- Detailed error messages: Full GraphQL and network errors for troubleshooting
- Data source tracking: Shows whether data came from cache or network
Verifying Cache is Working
Performance Indicators (visible in debug mode):
- From cache: YES = Data served from cache
- Query time < 50ms = Likely cache hit
- Network status codes = Shows Apollo's internal cache state
API Credits: Monitor the API counter in the header - it should remain stable when navigating previously loaded data
Cache Inspection: Press
Ctrl+I(available anytime) to see:- Cache file location and size
- Recent cache entries with timestamps
- Cache age for each query type
Why API Credits Might Still Decrease
Even with caching enabled, API credits may decrease due to:
- First-time requests: Initial data must be fetched and cached
- Cache expiration: Default 30-minute TTL (customize with
APOLLO_TTL_MS) - Pagination: New pages beyond the cache are fetched from API
- Cache-and-network policy: Updates stale cache data in background
- Sorting changes: Different sort orders create new cache entries
Configuration
# Number of repositories to fetch per page (1-50, default: 15)
REPOS_PER_FETCH=10 npx gh-manager-cli
# Custom cache TTL (milliseconds) - default: 30 minutes
APOLLO_TTL_MS=1800000 npx gh-manager-cli
# Enable debug mode to see cache performance
GH_MANAGER_DEBUG=1 npx gh-manager-cli
# Combine multiple environment variables
REPOS_PER_FETCH=5 GH_MANAGER_DEBUG=1 npx gh-manager-cli-cliTroubleshooting
- Invalid token: enter a valid PAT (recommended scope:
repo). - Rate limited: wait for the reset shown in the banner or reduce navigation.
- Network errors: check connectivity and press
rto retry.
Todo & Roadmap
For the up-to-date task board, see TODOs.md.
Recently implemented:
- β Density toggle for row spacing (compact/cozy/comfy)
- β Repo actions (archive/unarchive, delete) with confirmations
- β
Organization support and switching (press
W) - β Enhanced server-side search with improved UX
- β Smart infinite scroll with 80% prefetch trigger
- β Modal-based sort and visibility filtering
- β Server-side visibility filtering for accurate pagination
Highlights on deck:
- Optional OS keychain storage via
keytar - Bulk selection and actions
- Repository renaming
License
MIT