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

@uk-hot/cx

v0.2.5

Published

Synchronize Codex session provider metadata across rollout files and SQLite state.

Readme

@uk-hot/cx

Manage multiple Codex accounts and keep their session provider metadata consistent. cx switches between saved Codex accounts and, on every switch, rewrites the model_provider field across your rollout files (rollout-*.jsonl) and the Codex SQLite state (state_5.sqlite) so the whole session history stays in sync with the active account's provider.

Codex home is fixed to ~/.codex.

Requirements

  • Node.js >= 22
  • Native dependency better-sqlite3 (compiled/prebuilt at install time)

Note (npm 11.16+ / npm 12): install scripts are gated by allowScripts. If the native build is skipped during a global install, allow it explicitly:

npm install -g --allow-scripts=better-sqlite3 @uk-hot/cx

Install

npm install -g @uk-hot/cx

Usage

cx status
cx switch <email|alias>
cx save [alias]
cx list
cx remove <email|alias>

cx status

Shows the current provider (from ~/.codex/config.toml) and the per-provider counts found in your rollout files and in the SQLite state, so you can see at a glance whether everything is aligned.

cx save [alias]

Snapshots the current ~/.codex/auth.json and config.toml into ~/.codex/accounts/ and registers the account. For ChatGPT/OAuth logins the identity (email, account id) is auto-detected from auth.json; for other logins provide an alias:

cx save work

cx switch <email|alias>

Restores a saved account's auth.json/config.toml, then synchronizes the model_provider metadata of all rollout files and SQLite rows to the switched account's provider. If the account can't be identified uniquely, you'll be prompted to choose (in a TTY).

cx list

Lists the accounts saved in the registry (email/alias and provider), marking the active one with *. It is read-only and offline — it does not contact any provider/usage API.

cx remove <email|alias>

Removes a saved account and its snapshot files from the registry.

How it works

On a switch (and its underlying sync), cx:

  1. Acquires a lock under ~/.codex/tmp/ so two runs can't interfere.
  2. Scans sessions/ and archived_sessions/ for rollout-*.jsonl files and collects those whose session_meta first line has a different provider.
  3. Verifies the SQLite database is writable, then rewrites the rollout files first (outside any DB transaction) and updates SQLite in a short transaction — keeping the database lock brief regardless of file count.
  4. If the SQLite update fails, the already-rewritten rollout files are rolled back byte-for-byte, so the two stores never diverge.

On Windows, rollout files are opened exclusively and rewritten via a single batched PowerShell pass; files locked by a running Codex are skipped and reported rather than corrupted.

Data & safety

  • cx reads and writes only under ~/.codex.
  • cx save copies your auth.json (which contains OAuth tokens) into ~/.codex/accounts/. Treat that directory as sensitive.
  • Close Codex and the Codex app before switching if files are reported as locked.

Changelog

0.2.5

  • cx list no longer prints the trailing per-provider count summary; it now shows only the saved-accounts listing.

0.2.4

  • Restored the list command — a lightweight, offline listing of the accounts saved in the registry (email/alias, provider, active marker) with a per-provider count summary. Unlike the pre-0.2.3 version it does not contact any usage API.

0.2.3

  • Removed the list and usage subcommands.
  • Sync now rewrites rollout files first and updates SQLite in a short transaction, rolling the files back byte-for-byte if the database update fails — keeping the database lock brief and the two stores consistent.
  • On Windows, rollout rewrites and rollbacks run in a single batched pass instead of one PowerShell process per file.

License

MIT © uk-hot