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

ai-switch

v0.2.0

Published

[![npm version](https://img.shields.io/npm/v/ai-switch.svg?color=cb3837)](https://www.npmjs.com/package/ai-switch) Link to the NPM Package: (https://www.npmjs.com/package/ai-switch)

Readme

ai-switch

npm version Link to the NPM Package: (https://www.npmjs.com/package/ai-switch)

ai-switch is a lightweight Node/TypeScript CLI that locates (via which), optionally installs, and launches popular AI coding agents (Codex, Claude Code, Gemini, Aider, Amp, Qwen). Every tool has a two-letter alias for fast invocation. It can layer project defaults, surface each tool's documented YOLO flag, and always shows the exact command before it runs. It is published as a verified package on npm.

Features

  • ai use [tool] launches any supported agent; omit the tool to pick interactively or fall back to the project's configured default.
  • Two-letter aliases for every tool: ai yolo cc launches Claude Code, ai use cx launches Codex.
  • If the binary is missing, the CLI offers curated install commands (npm / pip / Homebrew) and streams output so you can see what runs.
  • --dry-run prints the resolved launch/install command without executing anything, helping you sanity-check automation.
  • ai yolo <tool> forwards the first documented skip-approvals flag for that tool and prints a bold warning.
  • ai doctor reports PATH status for every supported agent in a quick checklist.
  • Arguments after -- are passed verbatim to the downstream CLI; defaults from .ai-switch.json are prepended first.

Installation

npm install
npm run build           # emits compiled JS to dist/src
npm link                # exposes the `ai` binary from dist/src/index.js

Usage

ai                      # interactive picker unless a default tool is configured
ai use codex            # launch OpenAI Codex in the current directory
ai use cc               # same thing using the alias for Claude Code
ai yolo cx              # launch Codex with skip-approvals via alias
ai use claude -- --help # pass flags through with "--"
ai --dry-run use gm     # dry-run Gemini via alias
ai yolo codex           # launch with the tool's YOLO/skip-approvals flag
ai doctor               # show which binaries are currently on PATH

When YOLO mode is requested, the wrapper warns in red and only appends the first YOLO flag declared for the tool (e.g. Codex --yolo). If a tool has no documented skip-approvals flag (Aider, Amp), it simply launches normally after warning you.

Aliases

Every tool has a short alias for quick invocation:

| Tool | Alias | Example | |---------|-------|------------------| | codex | cx | ai yolo cx | | claude | cc | ai use cc | | gemini | gm | ai yolo gm | | aider | ad | ai use ad | | amp | am | ai use am | | qwen | qw | ai yolo qw |

Aliases work everywhere tool names are accepted: CLI arguments, defaultTool in .ai-switch.json, and the interactive picker shows them as hints.

Supported tools

| Tool | Binary | Install | YOLO flag | |------|--------|---------|-----------| | OpenAI Codex CLI | codex | npm, brew | --yolo | | Anthropic Claude Code | claude | npm, brew | --dangerously-skip-permissions | | Google Gemini CLI | gemini | npm, brew | --yolomode | | Aider | aider | pip, brew | -- | | Sourcegraph Amp | amp | npm | -- | | Qwen Code | qwen | npm | --yolo |

Project configuration

Add an optional .ai-switch.json to your project root to establish defaults for use and yolo commands:

{
  "defaultTool": "codex",
  "defaultFlags": ["--model", "gpt-5-codex"]
}
  • defaultTool accepts full names or aliases (e.g. "cc" for Claude Code).
  • defaultFlags are inserted ahead of any passthrough args (including those provided after --).

The loader validates both fields: unknown tools or non-string arrays are ignored with a console warning so the CLI never crashes on malformed config, and parse errors fall back to empty defaults.

Safety defaults

Every downstream CLI has its own sandboxing and approval controls. Prefer enabling approvals and a workspace-write sandbox in their native configs so that launching through ai-switch inherits those safer defaults. For example, Codex users can add this to ~/.codex/config.toml:

[session]
approval_policy = "auto"
sandbox_mode = "workspace-write"

Doctor command

ai doctor runs a simple PATH probe for each supported tool. Missing binaries show up with a yellow cross and will trigger the installer prompt the next time you run ai use / ai yolo.

Security

  • npm audit (last run 2025-09-20) reports zero known vulnerabilities after upgrading dev tooling to vitest@^3.2.4.
  • Installer commands are hard-coded and executed with execaCommand; tool launches use argv arrays to avoid shell injection (Windows uses shell: true only to support .cmd shims).
  • Treat .ai-switch.json as trusted input; untrusted defaults could add flags to downstream CLIs, so review contributions before committing.
  • Run npm audit and npm test before publishing new versions to catch regressions early.

Development

npm install
npm run build
npm run typecheck
npm test

The sources live in src/ and compile to dist/src. Keep the build output current before publishing or linking locally.

Run npm test -- --watch while iterating; the expanded suite details live in docs/testing.md.

Documentation

  • Development guide covers architecture, installer safety, and publishing steps.
  • Testing guide outlines the Vitest suite, fixtures, and future coverage goals.

Roadmap

  • Add a VS Code command runner that shells out to ai use <tool>
  • Offer optional Docker sandbox profiles for YOLO sessions
  • Replace the prompt with a richer Ink-powered TUI picker
  • Add more agents as they stabilize (Cline, Cursor CLI, Devin)

📄 License

This project is open source and available under the MIT License.