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

kgp-erp-cli

v1.1.0

Published

CLI tool for IIT KGP ERP auto-login

Readme

KGP ERP CLI (beta)

A sleek, state-of-the-art Command Line Interface (CLI) tool designed for auto-logging into the Indian Institute of Technology Kharagpur (IIT KGP) ERP system. Say goodbye to repeatedly typing roll numbers, solving security questions, and entering OTPs manually.

           .:...:
           ::...:.
           -     :
           :  K  .
           -  G  :    ╔═╗ ╔═╗ ╔═╗ ╔═╗ ╔═╗  ╦ ╦ ╔═╗ ╦
           :  P  :    ╠═╝ ║╣  ╠═╣ ║   ║╣   ╠═╣ ╠═╣ ║
           :     :    ╩   ╚═╝ ╩ ╩ ╚═╝ ╚═╝  ╩ ╩ ╩ ╩ ╩
      .:......:  .
       :..=      :
       :---..    :
       :::..:....:..............:
       :::..:...:----:--:::--.:..
.......:::-.:.. :.---:.::.:.:-...
-.---.----..:..---.:.:--:.:-....:

Features

  • Instant Session Caching: Keeps your session active using secure token storage. Bypasses the OTP flow entirely on subsequent logins unless the session has expired.
  • Secure Credentials: Saves passwords and answers to security questions in your system's native keychain (Windows Credential Manager / macOS Keychain) using @napi-rs/keyring.
  • Automated OTP Fetching: Connects to your Gmail inbox via IMAP to automatically fetch the OTP requested during the ERP login flow.
  • ** Parallel Optimization**: Connects to the ERP portal and Gmail concurrently to authenticate as fast as possible.
  • Cross-Platform Browser Integration: Automatically launches your default browser with your authenticated session token.

Installation

Prerequisites

  • Node.js (v18 or higher recommended)
  • Gmail App Password: For security reasons, Gmail requires an App Password to authenticate over IMAP. You can create one in your Google Account settings (Security > 2-Step Verification > App passwords).

Global Installation (Recommended)

You can install this package globally using npm:

npm install -g kgp-erp-cli

(Or build locally and link using npm link)


Getting Started

0. Try run erp

1. Setup Configuration

Run the setup command to configure your Roll Number, Gmail address, ERP Password, Gmail App Password, and answers to your security questions.

erp setup

Follow the interactive prompts. The security question answers and passwords will be stored securely in your system's keychain.

2. Login

To auto-login and launch your browser:

erp login
  • If you have an active cached session, it will say Session alive — skipping OTP! and immediately open your browser in under 1 second.
  • If the session is expired or not found, it will trigger the full authentication flow (requires Gmail connectivity) and automatically renew the cache.

3. Check Configuration Status

To view your saved Roll Number and Gmail email:

erp status

To reveal the stored passwords and security question answers, use the --reveal flag:

erp status --reveal

(Requires entering your ERP password for authorization)

4. Clear/Reset Everything

To delete all local configurations and clear credentials from your system keychain:

erp reset

CLI Commands

If you run erp with no arguments, an interactive menu will guide you:

| Command | Option | Description | | ------------ | ---------- | ----------------------------------------------------------------------------- | | erp login | --fresh | Log in to ERP. The --fresh flag forces a new OTP login, clearing the cache. | | erp setup | - | Configure credentials and security questions. | | erp status | --reveal | View configuration details. --reveal displays the passwords/answers. | | erp reset | - | Safely delete configuration file and all keychain secrets. |


How Session Caching Works

  1. Authentication: Upon a successful login using password and OTP, the server returns an ssoToken.
  2. Persistence: The CLI securely saves this token inside ~/.config/erp-cli/session.json along with its creation time.
  3. Live Probe Verification: Before attempting to request a new OTP, the CLI sends a lightweight background request to the ERP server using redirect: "manual" to verify the token.
    • If the token is still valid, the browser is launched immediately, saving time and resources.
    • If the server redirects the request to logout.htm, the token is flagged as expired and the CLI falls back to the full OTP flow.

Future Plan

  • Watch Mode: A background service/daemon that monitors session state and automatically renews cookies/tokens to keep you logged in indefinitely.
  • CDC Integration: Follow standard redirection chains automatically to authenticate into the Placement/Internship sub-portal directly.
  • Browser Extension Support: Connect the CLI with a lightweight Chrome/Firefox browser extension to sync login states without launching new tabs manually.