This page provides information for developers who want to contribute to or modify gh-manager-cli.
- UI:
ink,ink-text-input,ink-spinner - API:
@octokit/graphql, Apollo Client - Config paths:
env-paths - Language: TypeScript
- Build:
tsup(CJS output with shebang)
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 modeREPOS_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
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
gh-manager-cli includes built-in Apollo Client caching to reduce GitHub API calls and improve performance. Caching is always enabled for optimal performance.
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
-
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
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
# 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-cliThe project uses automated releases with two complementary GitHub Actions workflows:
Workflow: automated-release.yml
Triggers: Every push to main branch
Process:
- Semantic Release analyzes commit messages since the last release
- Version Calculation based on conventional commits:
feat:→ Minor version (1.0.0 → 1.1.0)fix:→ Patch version (1.0.0 → 1.0.1)BREAKING CHANGE:→ Major version (1.0.0 → 2.0.0)chore:,docs:,style:,refactor:,test:→ No release
- Automated Actions:
- Updates
package.jsonversion - Generates
CHANGELOG.md - Creates GitHub release with tag
- Publishes to NPM registry
- Publishes to GitHub Packages
- Updates Homebrew formula in wiiiimm/homebrew-tap
- Updates
Workflow: release-on-version-change.yml
Triggers: When package.json version field changes
Purpose: Backup mechanism for manual releases
Process:
- Detects version change in
package.json - Verifies version doesn't exist on NPM
- Publishes to NPM if new
- Updates Homebrew formula with new SHA256
- Creates GitHub release
To trigger automatic releases, follow the Conventional Commits specification:
# Features (minor version bump)
git commit -m "feat: add repository transfer functionality"
git commit -m "feat(ui): implement dark mode toggle"
# Fixes (patch version bump)
git commit -m "fix: resolve rate limit handling issue"
git commit -m "fix(api): correct pagination cursor logic"
# Breaking changes (major version bump)
git commit -m "feat!: redesign configuration format
BREAKING CHANGE: Config files from v1.x need migration"
# No release triggered
git commit -m "chore: update dependencies"
git commit -m "docs: improve README examples"
git commit -m "style: format code with prettier"
git commit -m "refactor: extract utility functions"
git commit -m "test: add unit tests for auth flow"To manually trigger a release:
# Update version using npm
npm version patch # 1.0.0 → 1.0.1
npm version minor # 1.0.0 → 1.1.0
npm version major # 1.0.0 → 2.0.0
# Or edit package.json directly
vim package.json # Change "version" field
# Commit and push
git add package.json
git commit -m "chore(release): 1.2.3"
git push origin mainThe release-on-version-change.yml workflow will detect the change and publish to NPM and Homebrew.
Each release publishes to multiple destinations:
-
NPM Registry (npmjs.com/package/gh-manager-cli)
- Public package for
npm install -g gh-manager-cli - Used by
npx gh-manager-cli@latest
- Public package for
-
GitHub Packages (@wiiiimm/gh-manager-cli)
- Alternative registry for GitHub users
- Install with:
npm install -g @wiiiimm/gh-manager-cli
-
GitHub Releases (github.com/wiiiimm/gh-manager-cli/releases)
- Tagged releases with changelogs
- Pre-built binaries for Windows, macOS, Linux
-
Homebrew Tap (github.com/wiiiimm/homebrew-tap)
- Formula automatically updated with new version and SHA256
- Install with:
brew install wiiiimm/tap/gh-manager-cli
- GitHub Actions: Check Actions tab for workflow status
- NPM Versions: Run
npm view gh-manager-cli versionsto see all published versions - Release Notes: View Releases page for changelogs
If a release fails:
- Check GitHub Actions logs for error details
- Verify secrets are configured:
NPM_TOKEN- For NPM publishingGH_TOKEN- For Homebrew tap updates (needs repo write access)
- Semantic Release issues:
- Ensure commit messages follow conventional format
- Check
.releaserc.jsonconfiguration
- Manual intervention:
- Can manually publish to NPM:
npm publish - Can manually update Homebrew tap PR
- Can manually publish to NPM:
For detailed information about testing, see the Testing page.