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

@lewiej08/pr-cli

v1.1.1

Published

A simple CLI to create and manage pull requests

Downloads

616

Readme

PR-CLI

A tool that allows users to create and manage pull requests from the command line.

NPM Package: https://www.npmjs.com/package/@lewiej08/pr-cli

Features

Core pull request operations

Pull request inspection

Pull request actions

Architecture

pr-cli/
├── bin/            # Executable pr program
├── src/            # Source code
│   ├── commands/   # Core command logic files
│   ├── config/     # Configuration (GitHub token, env vars)
│   ├── services/   # Third party services
│   ├── utils/      # Global utils
│   └── index.ts    # CLI entry point
├── package.json
├── README.md
└── tsconfig.json

Prerequisites

In order to use pr-cli you will need a Github Token. If you do not have a Github token you will need to create one. We recommend a personal fine-grained token: https://github.com/settings/personal-access-tokens

Ensure you have these permissions:

Read and Write for Pull Requests, Issues and Contents

Installation

Option 1 - Install with NPM (Recommended)

npm install -g @lewiej08/pr-cli

Option 2 - Clone the repo

git clone https://github.com/LewieJ08/pr-cli.git
cd pr-cli

Install dependencies:

npm install

Build the TypeScript code:

npm run build

Link the CLI globally:

npm link

Authentication / Login

Once you have installed the package you will need to authenticate your GitHub token with the following command:

pr auth

Auth Help

Commands

pr list

List pull requests

Usage

pr list [options]

Options

-a, --all

List all pull requests open and closed. This option cannot be used with the --state option.

--state [state]

Set state of pull request either open or closed. Cannot be used with --all option.

Default: open

--sort [sort]

What to sort pull requests by. popularity will sort by the number of comments. long-running will sort by date created and will limit the results to pull requests that have been open for more than a month and have had activity within the past month.

Default: created

Can be one of: created, updated, popularity, long-running

Example Usage (Colours will differ)

> pr list --state closed 

PR 25 CLOSED https://github.com/LewieJ08/pr-cli/pull/25
Refactor pr-merge edge case handling
Merged mainline ← develop
Author: LewieJ08 · Created: Thu, 08 Jan 2026 16:00:49 GMT
────────────────────────────────────────────────────────────

PR 26 CLOSED https://github.com/LewieJ08/pr-cli/pull/26
TEST PR FOR CLOSING
Not Merged mainline ← test/close-pr
Author: LewieJ08 · Created: Fri, 09 Jan 2026 16:08:59 GMT
────────────────────────────────────────────────────────────
>

pr create

Create a pull request. When using this command you will be asked to provide the PR title and body.

Usage

pr create [options]

Options

-d, --draft

Create a draft pull request

-i --issue <issue-number>

An issue in the repository to convert to a pull request. The issue title, body, and comments will become the title, body, and comments on the new pull request.

Example usage

> pr create 
PR Title > New feature added
PR body > Added a new feature that does something i guess

Pull Request 29 for 'REPO' created successfully 
https://github.com/LewieJ08/REPO/pull/29
>

pr get

Get a pull request

Usage

pr get <pr-number>

Example Usage

> pr get 5
PR 16 CLOSED https://github.com/LewieJ08/pr-cli/pull/16
Merged mainline ← develop
Author: LewieJ08 · Created: Tue, 30 Dec 2025 00:50:11 GMT
────────────────────────────────────────────────────────────
Refactor error types in each command
Added the 'unknown' type to all errors in command files
>

pr update

Update a pull request. When using this command you will be asked for the new PR title and body similar to pr create

Usage

pr update <pr-number>

Example Usage

> pr update 20
New Title > Updated title for new feature or something
New Body > New body of long text for pointless feature

Pull Request 20 for 'REPO' Updated Successfully 
https://github.com/LewieJ08/REPO/pull/20
> 

pr commits

List commits on a pull request

Usage

pr commits <pr-number>

Example Usage

> pr commits 14
Pull request #14 commits:

commit d2ae3ca0a7753e3162b08ac52fae95b22e06e923
Author: LewieJ08
Date: Sun, 21 Dec 2025 22:17:11 GMT

    Add ? operator to body property of PullRequest interface

commit d87e063671cd8425d0b0ab1eeaeaae9648208a95
Author: LewieJ08
Date: Tue, 23 Dec 2025 04:09:27 GMT

    Refactor pull requesr display for get and list

commit da36bcc440d3d3ed9fa9817759100802052586a2
Author: LewieJ08
Date: Tue, 23 Dec 2025 04:14:02 GMT

    Resolve conflict

>

pr files

List files in a pull request, including file changes

Usage

pr files <pr-number>

Example Usage

> pr files 2
Pull request #2 files:

src/commands/create.ts
Changes: +4 -3 (7)

@@ -1,15 +1,16 @@
-import { TOKEN } from "../config/env";
+import { resolveGithubToken } from "../config/env";
+import { resolveGitContext } from "../utils/gitContext";
 import { GithubService } from "../services/githubService";
 import { prompt } from "../utils/prompt";
 import { NoGitRepoError, InvalidRemoteUrlError } from "../utils/gitUtils";
-import { resolveGitContext } from "../utils/gitContext";

 async function createCommand(): Promise<void> {
     try {
         const context = resolveGitContext();
+        const token = resolveGithubToken();

         const github = new GithubService({
-            token: TOKEN,
+            token: token,
             owner: context.owner,
             repo: context.repo
         });

src/commands/list.ts
Changes: +5 -3 (8)

@@ -1,13 +1,15 @@
-import { TOKEN } from "../config/env";
+import { resolveGithubToken } from "../config/env";
 import { resolveGitContext } from "../utils/gitContext";
 import { GithubService } from "../services/githubService";
 import { NoGitRepoError, InvalidRemoteUrlError } from "../utils/gitUtils";

 async function listCommand(): Promise<void> {
     try {
-        const { owner, repo } = resolveGitContext();
+        const { owner, repo } = resolveGitContext();
+        const token = resolveGithubToken();
+
         const github = new GithubService({
-            token: TOKEN,
+            token: token,
             owner: owner,
             repo: repo
         });

src/config/env.ts
Changes: +6 -11 (17)

@@ -1,16 +1,11 @@
 import { configDotenv } from "dotenv";
 configDotenv({quiet: true});

-// fetch env vars
-function fetchEnvVar(name: string): string {
-    const value = process.env[name];
-
-    if (!value) {
-        console.log(`Missing required environment variable: ${name}`);
-        process.exit(1)
+// get github token env var
+export function resolveGithubToken(): string {
+    if (process.env.GITHUB_TOKEN) {
+        return process.env.GITHUB_TOKEN
     }

-    return value;
-}
-
-export const TOKEN = fetchEnvVar('TOKEN');
\ No newline at end of file
+    throw new Error("Missing Github Token Config. Please run 'pr auth login' to authenticate")
+}
\ No newline at end of file

> 

pr status

Check if a pull request has been merged

Usage

pr status <pr-number>

Example Usage

> pr status 1
Pull Request #1
Merge Status: Merged
> 

pr merge

Merge a pull request. When using this command you will be asked if you are sure you want to merge the pull request.

Usage

pr merge [options] <pr-number>

Options

-m, --method [merge-method]

Set the merge method to use.

Can be one of: merge, squash, rebase

Example Usage

> pr merge 33
Are you sure you want to merge PR #33 (y/n) > y
Pull Request #33 successfully merged
>

pr sync

Update and sync a pull request branch. This is a good way to ensure your pull request remain up to date with the main branch when new commits have been pushed into the main branch. You will be asked to input the latest commit SHA (hash) in the pull request. This can be found using pr commits

Usage

pr sync <pull-number>

Example Usage

> pr sync 33
Enter the latest commit SHA (hash) of the pull request branch (HEAD) > e39b3fb4owd39rh4fnienf933f
Pull Request branch successfully updated and synced
>

pr auth

In order to use pr-cli you will need to authenticate your GitHub token using the pr auth command. This will store your token in a global config file on your computer meaning pr-cli can access your token from anywhere.

Usage

pr auth [options]

Options

-d, -delete

Clears global config removing your github token.

Example Usage

> pr auth
Github Token> YOUR TOKEN
Github token for user 'USERNAME' authenticated successfully
>