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

@anygpt/cody

v2.0.2

Published

Cody CLI connector for AnyGPT

Readme

@anygpt/cody

Sourcegraph Cody connector for AnyGPT with flexible API and CLI modes.

Features

  • 🚀 Dual-mode - API (fast) or CLI (feature-rich) with auto-fallback
  • 🔄 Multiple models - Claude, GPT-4, Gemini, and more
  • 🎯 Enterprise ready - Works with any Sourcegraph instance
  • 🔧 Auto-config - Reads from ~/.config/Cody-nodejs/config.json

Installation

npm install @anygpt/cody

Prerequisites:

  • Access to a Sourcegraph instance with API token
  • API mode (default): No CLI installation required
  • CLI mode: Requires @sourcegraph/cody CLI installed

Quick Start

import { createCodyConnector } from '@anygpt/cody';

// Auto-reads from ~/.config/Cody-nodejs/config.json
const connector = await createCodyConnector();

const response = await connector.chatCompletion({
  model: 'anthropic::2024-10-22::claude-3-5-sonnet-latest',
  messages: [{ role: 'user', content: 'Hello, Cody!' }]
});

With Configuration

const connector = await createCodyConnector({
  connectionMode: 'api',  // 'api' | 'cli' | 'auto'
  endpoint: 'https://sourcegraph.example.com/',
  accessToken: process.env.SRC_ACCESS_TOKEN
});

Connection Modes

Choose between three modes:

| Mode | Speed | Best For | |------|-------|----------| | api (default) | ⚡ Fast | Production, CI/CD | | cli | 🐢 Slower | Local dev, debugging | | auto | ⚡ Fast* | Resilient setups |

// API mode (default)
const connector = await createCodyConnector({
  connectionMode: 'api'
});

// CLI mode (requires Cody CLI installed)
const connector = await createCodyConnector({
  connectionMode: 'cli',
  showContext: true
});

// Auto mode (tries API, falls back to CLI)
const connector = await createCodyConnector({
  connectionMode: 'auto'
});

📖 Detailed Mode Documentation

Configuration

| Option | Type | Default | |--------|------|---------| | connectionMode | 'api' \| 'cli' \| 'auto' | 'api' | | endpoint | string | 'https://sourcegraph.com/' | | accessToken | string | Auto-detected | | timeout | number | 60000 | | model | string | - |

CLI-specific (for cli and auto modes):

  • cliPath, workingDirectory, showContext, debug

💡 Auto-reads from ~/.config/Cody-nodejs/config.json

Models

Models are dynamically fetched from your Sourcegraph instance:

const models = await connector.listModels();

Common models: Claude Sonnet 4, Claude 3.5 Sonnet, GPT-4o, GPT-5, Gemini 2.5 Pro, DeepSeek v3

Authentication

Via environment variables:

export SRC_ACCESS_TOKEN="sgp_your-token"
export SRC_ENDPOINT="https://sourcegraph.example.com/"

Or in config:

const connector = await createCodyConnector({
  accessToken: 'sgp_your-token',
  endpoint: 'https://sourcegraph.example.com/'
});

Examples

See examples/connection-modes.ts for working examples of all modes.

Config examples: examples/cody.config.ts

Troubleshooting

CLI mode fails:

  • Install CLI: npm install -g @sourcegraph/cody
  • Verify: which cody
  • Auth: cody auth

API mode fails:

  • Check token: curl -H "Authorization: token TOKEN" https://instance/.api/llm/models
  • Verify endpoint ends with /

Slow responses:

  • Use API mode (fastest)
  • Check network latency

📖 Detailed Troubleshooting

Documentation

License

MIT