npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

git-context

v1.1.0

Published

Secure CLI to manage multiple GitHub/GitLab accounts with per-folder git credentials

Readme

git-context

🔐 Secure CLI to manage multiple GitHub/GitLab accounts with per-folder git credentials

npm version License: MIT

Why?

If you work with multiple GitHub/GitLab accounts (personal, work, client projects), managing different credentials for each repository can be painful. git-context solves this by:

  • ✅ Storing multiple git profiles securely in the cloud
  • ✅ Applying per-folder git configurations
  • Cloning repositories without credential prompts
  • ✅ Encrypting sensitive tokens locally
  • ✅ Never touching your global git config

Installation

npm install -g git-context

Quick Start

# 1. Login to your account
lexa login

# 2. Create a git profile
lexa git setup my-personal-account

# 3. Clone a repo using your profile (no credential prompts!)
lexa clone https://github.com/user/repo.git -p my-personal-account

# 4. Or apply profile to an existing repo
cd ~/projects/my-personal-project
lexa git use my-personal-account

# That's it! Your repo now uses the correct identity.

Activity Logging

Track all your lexa actions with detailed logs.

lexa logs

View recent activity logs including actions, profiles used, and time.

# View recent logs
lexa logs

# View logs from last 2 days
lexa logs --days 2

# View last 10 entries
lexa logs --last 10

# Clear all logs
lexa logs --clear

Output:

Date/Time            │ Action       │ Profile      │ Details
───────────────────────────────────────────────────────────────────────────────────
01/01/26 20:15 IST   │ git use      │ om-ghante    │ Applied to /path/repo
01/01/26 20:10 IST   │ clone        │ om-ghante    │ github.com/user/repo
01/01/26 19:45 IST   │ init         │ work         │ /home/user/project
01/01/26 18:00 IST   │ login        │ -            │ [email protected]

Natural Language Interface

You can simply type what you want to do in plain English!

lexa "init repo in /my/folder with github.com/user/repo"
lexa "clone github.com/user/repo using work"
lexa "list my profiles"
lexa "use personal profile here"

Commands

Authentication

lexa login

Authenticate with your lexa account using email and password.

lexa login

Options:

  • Create a new account or login with existing account
  • Email and password authentication via Firebase

lexa logout

Clear stored credentials and logout from the current session.

lexa logout

lexa whoami

Display information about the currently logged-in user.

lexa whoami

Output:

Current User
Email: [email protected]
User ID: abc123...
Session expires: 1/2/2026, 10:30:00 AM

lexa status

Show overall status including authentication state and current git context.

lexa status

Output:

lexa Status

[OK] Authenticated
  Email: [email protected]

[OK] In git repository
  Root: /home/user/projects/my-repo
  Local config:
    user.name = your-username
    user.email = [email protected]
  Active profile: personal

Cloning Repositories

lexa clone <repository-url>

Clone a repository using stored credentials. No more credential prompts!

# Interactive: prompts you to select a profile
lexa clone https://github.com/user/repo.git

# Specify profile directly
lexa clone https://github.com/user/repo.git --profile my-work-account
lexa clone https://github.com/user/repo.git -p my-work-account

# Clone to a custom directory
lexa clone https://github.com/user/repo.git -d my-folder

# Combine options
lexa clone https://github.com/user/private-repo.git -p work -d project-folder

Options: | Option | Alias | Description | |--------|-------|-------------| | --profile <name> | -p | Profile to use for cloning | | --directory <path> | -d | Directory to clone into |

How it works:

  1. Fetches credentials from the selected profile
  2. Injects username:PAT into the clone URL
  3. Clones without asking for credentials
  4. Automatically applies the profile (user.name, user.email)
  5. Configures credential helper for future push/pull

Git Profiles

lexa git setup [profile-name]

Create a new git profile or update an existing one.

# Interactive mode
lexa git setup

# Create/update a specific profile
lexa git setup my-work-account

You'll be prompted for: | Field | Description | |-------|-------------| | Profile Name | Unique identifier for this profile (e.g., work, personal) | | Provider | GitHub, GitLab, Bitbucket, or Other | | Username | Your git username | | Email | Email address for git commits | | Personal Access Token (PAT) | For HTTPS authentication (stored encrypted) | | SSH Key Path | Optional path to SSH private key |

Example:

$ lexa git setup personal

Git Profile Setup

? Profile name: personal
? Git provider: GitHub
? Git username: john-doe
? Git email: [email protected]
? Personal Access Token (PAT): ********
? SSH private key path (optional): 

[OK] Profile "personal" saved successfully!

To use this profile in a git repository:
  lexa git use personal

lexa git use <profile-name>

Apply a git profile to the current repository.

cd ~/projects/my-repo
lexa git use personal

What it does:

  1. Sets git config --local user.name and user.email
  2. Configures credential helper with your PAT
  3. Configures SSH key (if specified in profile)
  4. Saves profile info to .gitcontext/ folder

Example:

$ lexa git use personal

Apply Git Profile

Repository: /home/user/projects/my-repo
Fetching profile...

Applying configuration...
  [OK] user.name = john-doe
  [OK] user.email = [email protected]
  [OK] HTTPS credentials configured for github.com
  [OK] Saved to .gitcontext/

[OK] Profile "personal" applied successfully!

Provider: github
Username: john-doe
Email: [email protected]

[OK] Git push/pull will now use your stored credentials automatically!

lexa git list

List all your saved git profiles.

lexa git list
# Alias:
lexa git ls

Example:

$ lexa git list

Your Git Profiles

Fetching profiles...

Found 2 profile(s):

  1. personal
     Provider: github
     Username: john-doe
     Email:    [email protected]
     Token:    ******** (stored)
     Created:  Dec 28, 2025, 11:04 PM

  2. work
     Provider: github
     Username: john-work
     Email:    [email protected]
     Token:    ******** (stored)
     Created:  Dec 20, 2025, 04:43 PM

--------------------------------------------------

Commands:
  Use a profile:    lexa git use <name>
  Update a profile: lexa git setup <name>
  Remove a profile: lexa git remove <name>

lexa git remove <profile-name>

Delete a git profile permanently.

lexa git remove old-account
# Alias:
lexa git rm old-account

Example:

$ lexa git remove old-account

Remove Git Profile

? Are you sure you want to delete profile "old-account"? Yes

[OK] Profile "old-account" deleted successfully!

How It Works

  1. Profiles stored in Firebase: Your profiles are stored securely in Firebase Firestore, so you can access them from any machine.

  2. Local git config only: When you run lexa git use, it sets git config --local values, affecting only that repository.

  3. Credential-embedded cloning: lexa clone injects your PAT into the clone URL (https://user:[email protected]/...), so Git never prompts for credentials.

  4. Encrypted tokens: PAT tokens are encrypted using AES-256-GCM before storage.

  5. .gitcontext/ folder: Each repo gets a .gitcontext/ folder (auto-added to .gitignore) containing the active profile info.


SSH Key Setup

For SSH authentication with multiple accounts:

  1. Generate separate SSH keys:

    ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_personal -C "[email protected]"
    ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_work -C "[email protected]"
  2. Add the public keys to GitHub/GitLab

  3. When creating profiles, specify the SSH key path:

    lexa git setup personal
    # When prompted for SSH key, enter: ~/.ssh/id_ed25519_personal
  4. lexa git use will configure core.sshCommand for that repo


Security

  • 🔒 No global git config changes - Only --local configuration
  • 🔒 Encrypted token storage - AES-256-GCM with machine-derived keys
  • 🔒 Firebase Auth - Secure authentication with ID tokens
  • 🔒 Owner-only access - Firestore rules restrict profile access
  • 🔒 Credentials not logged - PAT is masked in clone URLs during display

Examples

Clone a private repo without credential prompts

# First, set up a profile with your PAT
lexa git setup work

# Now clone any private repo
lexa clone https://github.com/company/private-repo.git -p work

# Done! No username/password prompts
cd private-repo
git pull  # Works automatically!

Switching between accounts

# Work on personal project
cd ~/personal/my-app
lexa git use personal
git commit -m "Personal commit"
git push  # Uses personal credentials

# Switch to work project
cd ~/work/company-app
lexa git use work
git commit -m "Work commit"
git push  # Uses work credentials

Checking current status

lexa status
# Shows:
# ✓ Authenticated ([email protected])
# ✓ In git repository
#   Local config: user.name = your-username
#   Active profile: personal

Troubleshooting

"Not logged in"

Run lexa login to authenticate first.

"Not a git repository"

The lexa git use command must be run inside a git repository. Use git init or clone a repo first.

"Profile not found"

Run lexa git list to see available profiles. Profile names are case-sensitive.

"Clone still asks for credentials"

Make sure your profile has a PAT (Personal Access Token) stored. Update it with:

lexa git setup <profile-name>

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Repository: https://github.com/om-ghante/git-context.npmpkg


License

MIT © Om Ghante