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

oj-short

v2.0.4

Published

Short commands for oj

Readme

oj-short

English | 日本語

oj-shortは、競技プログラミングのワークフローを効率化するために設計されたコマンドラインインターフェース(CLI)ツールです。online-judge-tools/oj-toolsの便利なラッパーとして機能し、問題のダウンロード、コードのテスト、解答の提出プロセスを簡素化します。

このツールはTypeScriptで構築されており、Bunランタイム上でのみ動作します。

特徴

  • 問題のダウンロード: AtCoder、Codeforcesなどのさまざまなオンラインジャッジから、問題の詳細とサンプルテストケースを素早く取得します。
  • 解答のテスト: ダウンロードしたサンプルケースに対して、あなたのコードを自動的にテストします。
  • コードの提出: コマンドラインから直接、解答を提出します。これはコンテスト中のAtCoderのような一部の状況で動作します。
  • カスタマイズ可能: あらゆるプログラミング言語に対して、カスタムのビルドコマンドと実行コマンドを設定できます。
  • URL解決: 簡潔な識別子からコンテストのURLを生成することをサポートします。

前提条件

oj-shortを使用する前に、以下をインストールする必要があります:

  1. Bun: このプロジェクトはBunランタイムを使用します。

  2. online-judge-tools: オンラインジャッジと対話するためのコア依存関係です。

    pip3 install online-judge-tools
    # or use uv
    uv tool install online-judge-tools

インストール

npmレジストリからインストール:

bun install -g oj-short@latest

または、配布されているコンパイル済みのバイナリを利用してください。

使い方

このツールは、getとsubmの2つの主要なコマンドを提供します。

get

問題とそのテストケースをダウンロードします。

コマンド:

get <site> <contest> [problem] [options]

引数:

  • <site>: オンラインジャッジの短いコード(例: ac for AtCoder, cf for Codeforces)。

    • ac, atcoder: AtCoder

    • cf, codeforces: Codeforces

    • cf_gym, codeforces_gym: Codeforces Gym

    • yc, yukicoder: Yukicoder

    • aoj, aizuonlinejudge: Aizu Online Judge

    • hr, hackerrank: HackerRank

    • lc, librarychecker: Library Checker

    • url: 直接URLを入力

  • <contest>: コンテストID。

  • [problem]: 問題ID(一部のサイトではオプション)。

オプション:

  • -s, --submit: 提出を有効にします。

例:

# AtCoder Beginner Contest 100, Problem Aをダウンロード
get ac abc100 a

このコマンドは以下を実行します:

  1. URLを解決します: https://atcoder.jp/contests/abc100/tasks/abc100_a
  2. oj.config.jsonを問題のURLで更新します。
  3. oj-toolsを使用して、サンプルケースを含むtestディレクトリを作成します。

subm

解答ファイルをテストし、提出します。

コマンド:

subm <filepath> [options]

引数:

  • <filepath>: 解答ファイルへのパス。

オプション:

  • -s, --strict: 厳格モード(末尾の空白や改行を厳密に判定)でテストを実行します。
  • -y, --yes: 提出確認に対して自動的に「yes」と回答します。
  • -t, --only-test: 提出せずにテストのみを実行します。

例:

# main.pyをテストして提出
subm main.py --yes

このコマンドは以下を実行します:

  1. oj.config.jsonで.pyファイルの実行コマンドを検索します。
  2. コードをコンパイルします(ビルドコマンドが定義されている場合)。
  3. oj tを使用してテストを実行します。
  4. ~~oj sを使用して解答を提出します。~~

設定

oj.config.jsonファイルを編集することで、ビルドコマンドと実行コマンドをカスタマイズできます。

設定ファイルは以下のような形式です:

{
  "run": {
    ".py": {
      "build": "",
      "run": "python3 $0",
      "lang": 5063
    }
  },
  "submit": false,
  "problem_url": "https://atcoder.jp/contests/abc100/tasks/abc100_a"
}
  • run: ファイル拡張子(例: .py, .cpp)を、対応するビルドおよび実行設定にマッピングするオブジェクト。
    • build: コードをコンパイルするコマンド。$0はソースファイルパスのプレースホルダーです。
    • run: コンパイル済みコードを実行するコマンド。
    • lang: ~~提出用の言語ID(オンラインジャッジ固有)。~~ これは現在不要です。
  • submit: 提出が有効かどうかを示すブール値。これはgetコマンドによって自動的に管理されます。
  • problem_url: 現在の問題のURL。getコマンドによって管理されます。

ライセンス

このプロジェクトはMITライセンスの下でライセンスされています。