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

@k2ksv/cpt-cli

v1.0.0

Published

Competitive Programming Terminal — scaffold, compile, and test C++ solutions instantly from your terminal.

Readme

⚡ cpt — Competitive Programming Terminal

Scaffold, compile, and test C++ solutions in seconds — right from your terminal.

License: MIT npm version Shell: Zsh C++17


cpt is a minimal, opinionated Zsh CLI that eliminates the repetitive boilerplate of competitive programming. One command to create a file, one to compile, one to run — with automatic input detection and customisable compiler flags.

✨ Features

  • ⚡ Instant Scaffolding — Generate C++ files from a personal template (~/.cpt_template.cpp) or a sensible built-in default.
  • 🔧 Smart Compilation — Compiles with competitive-programming-friendly flags out of the box (-std=c++17 -Wall -Wextra -O2 -fsanitize=undefined).
  • 🎯 Automatic Input Detection — If input.txt exists in the working directory it is piped into your solution automatically.
  • ⏱️ Built-in Timing — Every run is wrapped in time so you can spot TLE risks early.
  • 🎨 Colourful Output — Clear, colour-coded terminal messages so you never miss an error.
  • 🛠️ Fully Configurable — Override compiler flags globally via $CPT_CXXFLAGS.

📦 Installation

Via npm (recommended)

npm install -g cpt-cli

That's it — cpt is now available globally.

Via curl (one-liner)

sudo curl -fsSL https://raw.githubusercontent.com/k2ksv/CPT_CLI/main/cpt \
     -o /usr/local/bin/cpt && sudo chmod +x /usr/local/bin/cpt

Manual Install

git clone https://github.com/k2ksv/CPT_CLI.git
cd CPT_CLI
chmod +x cpt
sudo cp cpt /usr/local/bin/

Template (optional but recommended)

Copy the included template to your home directory so cpt init uses it:

cp .cpt_template.cpp ~/.cpt_template.cpp

⚙️ Configuration

cpt uses sensible defaults that work for most competitive programming judges. You can override the compiler flags by exporting CPT_CXXFLAGS in your shell config:

# ~/.zshrc (or ~/.bashrc)
export CPT_CXXFLAGS="-std=c++20 -O2 -DLOCAL"

| Variable | Default | Description | |---|---|---| | CPT_CXXFLAGS | -std=c++17 -Wall -Wextra -O2 -fsanitize=undefined | Flags passed to g++ during compilation |

🚀 Usage

1. Create a new solution file

cpt init A.cpp

This copies ~/.cpt_template.cpp into A.cpp. If no template is found, a minimal boilerplate is generated.

2. Compile

cpt build A.cpp

Compiles A.cppA using your configured (or default) flags.

3. Run

cpt run A.cpp
  • If input.txt exists in the current directory → ./A < input.txt
  • Otherwise → runs interactively so you can type input manually.

Full Workflow Example

cpt init B.cpp        # scaffold
vim B.cpp             # write your solution
echo "5" > input.txt  # prepare sample input
cpt build B.cpp       # compile
cpt run B.cpp         # test against input.txt

🗂️ Project Structure

CPT_CLI/
├── cpt                  # Main CLI script
├── .cpt_template.cpp    # Sample C++ template
├── package.json         # npm package manifest
├── README.md
└── LICENSE

📄 License

This project is licensed under the MIT License.