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

@apekshik/grok-cli-apek

v0.1.6

Published

A command-line AI workflow tool powered by xAI's Grok

Downloads

23

Readme

Grok CLI

A command-line AI workflow tool powered by xAI's Grok that connects to your tools, understands your code, and accelerates your workflows.

Grok CLI Screenshot

With the Grok CLI you can:

  • Query and edit large codebases with intelligent context management for Grok's token limits
  • Generate new apps and solve complex coding problems using Grok's reasoning capabilities
  • Automate operational tasks, like querying pull requests or handling complex rebases
  • Use tools and MCP servers to connect new capabilities
  • Smart file selection that adapts to Grok's context window for optimal performance

Quickstart

  1. Prerequisites: Ensure you have Node.js version 18 or higher installed.

  2. Install globally:

    npm install -g @apekshik/grok-cli-apek
  3. Set up your xAI API Key:

    Get your API key from xAI Console and set it as an environment variable:

    export XAI_API_KEY="your-api-key-here"
  4. Run the CLI:

    grok
  5. Pick a color theme and start chatting with Grok!

You are now ready to use the Grok CLI!

Examples

Once the CLI is running, you can start interacting with Grok from your shell.

You can start a project from a new directory:

cd new-project/
grok
> Write me a Discord bot that answers questions using a FAQ.md file I will provide

Or work with an existing project:

git clone https://github.com/apekshik/grok-cli-apek
cd grok-cli-apek
grok
> Give me a summary of all of the changes that went in yesterday

Provider Switching

The CLI supports both Grok and Gemini providers. You can switch between them during a conversation:

# Switch to Grok (default)
/provider grok

# Switch to Grok Mini for faster responses
/provider grok-mini

# Switch to Gemini (requires GEMINI_API_KEY)
/provider gemini

Smart Context Management

The Grok CLI includes intelligent context management that automatically adapts to Grok's token limitations:

  • Automatic file selection: When reading many files, it previews them and asks Grok to select the most relevant ones
  • Token-aware processing: Tracks token usage and prevents API errors
  • Graceful fallbacks: Multiple strategies to handle large codebases effectively

Popular tasks

Explore a new codebase

Start by cding into an existing or newly-cloned repository and running grok.

> Describe the main pieces of this system's architecture.
> What security mechanisms are in place?

Work with your existing code

> Implement a first draft for GitHub issue #123.
> Help me migrate this codebase to the latest version of Node.js. Start with a plan.

Automate your workflows

> Convert all the images in this directory to png, and rename them to use dates from the exif data.
> Organize my PDF invoices by month of expenditure.

Authentication

xAI API Key (Recommended)

  1. Sign up at xAI Console

  2. Generate an API key

  3. Set it as an environment variable:

    export XAI_API_KEY="your-api-key-here"

Alternative: Gemini API Key

You can also use Google's Gemini API by setting:

export GEMINI_API_KEY="your-gemini-api-key"

Get your Gemini API key from Google AI Studio.

CLI Commands

Available slash commands:

  • /help - Show help information
  • /provider <provider> - Switch between grok, grok-mini, and gemini
  • /clear - Clear conversation history
  • /theme - Change color theme
  • /memory - Show current context files
  • /tools - List available tools

Features

  • Context Files: Create GROK.md files to provide persistent context
  • File Operations: Read, edit, and write files with confirmation
  • Shell Integration: Run shell commands with !command
  • Web Search: Built-in web search capabilities
  • MCP Support: Model Context Protocol for extensible tools

Installation from Source

git clone https://github.com/apekshik/grok-cli-apek
cd grok-cli-apek
npm install
npm run build
npm run bundle
npm link

Troubleshooting

Common Issues

  1. API Key Issues: Make sure XAI_API_KEY is set correctly
  2. Token Limits: The CLI automatically handles Grok's context limits with smart selection
  3. Node.js Version: Ensure you're using Node.js 18 or higher

Debug Mode

Run with debug mode for detailed logging:

grok --debug

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

Apache-2.0 License - see LICENSE for details.