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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ai-codex-cli

v1.0.3

Published

Your AI Dev Companion - A powerful CLI tool for developers

Downloads

16

Readme

🚀 AI Codex CLI - Your AI Dev Companion

A powerful command-line interface that brings AI assistance directly to your terminal. Get instant help with coding concepts, debugging, code generation, and more!

✨ Features

  • 🤖 AI-Powered Assistance: Integrated with OpenAI GPT and Google Gemini
  • 💡 Multiple Commands: Explain concepts, debug errors, generate code, and ask questions
  • 💬 Interactive Chat: Continuous conversation mode with context awareness
  • 📝 History Tracking: Save and review past queries and responses
  • 🔄 Response Management: Save responses to files and share via GitHub Gists
  • ⚙️ Configurable: Switch between AI providers and test connections
  • 🎨 Beautiful UI: Colorful output with ASCII art branding

🛠️ Installation

Global Installation (Recommended)

Install the package globally to use it as a command-line tool:

npm install -g ai-codex-cli

After installation, you can use the tool with either codex or ai commands:

codex explain "async/await in JavaScript"
# OR
ai explain "async/await in JavaScript"

Local Installation

To use it within a project:

npm install ai-codex-cli

Set Up Your API Keys

After installation, run the config command to set up your API keys:

codex config

Or manually create a .env file in your home directory:

# Choose your preferred AI provider
AI_PROVIDER=gemini  

# Add your API keys
GEMINI_API_KEY=your_gemini_api_key_here

# Optional: GitHub token for sharing gists
GITHUB_TOKEN=your_github_token_here

🎯 Commands

Core Commands

# Explain programming concepts
codex explain "async/awcodext in JavaScript"
codex explain "Docker containers"

# Debug errors and get solutions
codex debug "TypeError: Cannot read property 'length' of undefined"
codex debug "CORS error in Express.js"

# Generate code snippets
codex generate "React login form with validation"
codex generate "Python function to parse CSV files"

# Ask any programming question
codex ask "What's the difference between let and const?"
codex ask "How to optimize SQL queries?"

# Interactive chat mode
codex chat

Utility Commands

# Save last response to file
codex save my-solution.md

# View command history
codex history

# Share last response to GitHub Gist
codex share

# Configure settings
codex config

🚀 Getting Started

  1. First, test your setup:

    codex config
    # Choose "Test API Connection"
  2. Try explaining a concept:

    codex explain "REST API"
  3. Generate some code:

    codex generate "Express.js hello world server"
  4. Start an interactive chat:

    codex chat

🔧 Configuration

Switching AI Providers

You can easily switch between OpenAI and Gemini:

codex config
# Choose "Switch AI Provider"

Or manually edit your .env file:

AI_PROVIDER=gemini  # or openai

API Keys Setup

For Google Gemini:

  1. Go to Google AI Studio
  2. Create an API key
  3. Add it to your .env file as GEMINI_API_KEY

For OpenAI:

  1. Go to OpenAI API Keys
  2. Create an API key
  3. Add it to your .env file as OPENAI_API_KEY

For GitHub Gists (optional):

  1. Go to GitHub Personal Access Tokens
  2. Create a token with gist permissions
  3. Add it to your .env file as GITHUB_TOKEN

🎨 Examples

Explaining Concepts

$ codex explain "GraphQL vs REST"

🤖 Explaining: GraphQL vs REST

📖 Explanation:

GraphQL and REST are both approaches for building APIs, but they differ significantly...
[Detailed explanation follows]

Debugging Errors

$ codex debug "Module not found error in Node.js"

🐛 Debugging Error: Module not found error in Node.js

🔧 Debug Analysis:

This error typically occurs when Node.js cannot locate a module...
[Detailed debugging steps follow]

Code Generation

$ codex generate "Python function to validate email addresses"

⚡ Generating Code: Python function to validate email addresses

💻 Generated Code:

```python
import re

def validate_email(email):
    """
    Validates an email address using regex pattern
    [Complete implementation follows]

Interactive Chat

$ codex chat

💬 Interactive Chat Mode
Type "exit" or "quit" to end the chat session

You: How do I handle errors in async functions?
AI: Great question! Here are the main ways to handle errors in async functions...

You: Can you show me an example?
AI: Certainly! Here's a practical example...

🤝 Contributing

Feel free to contribute by:

  • Adding new commands
  • Improving existing functionality
  • Adding support for more AI providers
  • Enhancing the user interface
  • Fixing bugs

📄 License

MIT License - feel free to use this project for personal or commercial purposes.

🆘 Troubleshooting

Common Issues

  1. "No valid AI provider configured"

    • Check your .env file has the correct API keys
    • Run codex config to test your connection
  2. "Module not found" errors

    • Run npm install to install dependencies
  3. "Permission denied" when running commands

    • Make sure cli.js is executable: chmod +x cli.js
  4. API rate limits

    • Both OpenAI and Gemini have rate limits
    • Wait a moment between requests if you hit limits

Getting Help

  • Use codex --help for command list
  • Use codex config to test your setup
  • Check the .env file for proper API key configuration
  • Review command history with codex history

Happy Coding! 🎉

Made with ❤️ for developers who love AI assistance in their terminal.