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

codygen

v1.6.0

Published

This CLI is a wrapper around the [Cody CLI](https://sourcegraph.com/docs/cody/clients/install-cli)

Downloads

18

Readme

codygen - Cody CLI Wrapper

This CLI is a wrapper around the Cody CLI

Why

Cody, the AI assistant, provides responses as chat messages. These messages often contain code snippets embedded between placeholders in a specific format. The format used is ```language:path/to/file.ext, which indicates the programming language and the intended file path for the code snippet.

For example, for a command like

cody chat -m "Hello world app in TypeScript"

consider the following Cody response:

Here's the TypeScript configuration file:

```json:tsconfig.json
{
  "compilerOptions": {
    ...
}
```

Create the main TypeScript file:
```typescript:src/index.ts
class Greeter {
  ...

```

As you can see the source files are wrapped in a nested code blocks inside the chat repose. This CLI is capable to parse those bocks and store the content into separated files.

Installation

npm install -g codygen

Usage

Usage: codygen [options] [command]

Sourcegraph Cody CLI wrapper with extra features

Options:
  -h, --help         display help for command

Commands:
  chat [options]     Chat with Cody and extract files from the response
  extract [options]  Extract files from the Cody chat response
  help [command]     display help for command

Commands

Extracting code from a chat reponse

Usage: codygen extract [options]

Extract files from the Cody chat response

Options:
  -o,--output <output>  Output folder
  -h, --help            display help for command

Examples:
  # Chat with Cody and extract results by piping to the codygen
  $ cody chat -m "Sample TS app" | codygen extract -o dist

Wrapping cody chat with further extracting

Usage: codygen chat [options]

Chat with Cody and extract files from the response

Options:
  -o,--output <output>        Output folder
  -f, --context <context...>  Context file(s)
  -c, --config <config>       Codygen config file
  -h, --help                  display help for command

Examples:
  # Pipe promt directly into the codygen chat command and extract files to a target folder
  $ echo "Sample TS app" | codygen chat -o dist

  # Prepare config a run it just with a config file (ts,cts,mts,js,cjs,mjs,json)
  $ codygen chat --config codygen.config.ts

Configuration

The codygen tool can be configured using a configuration file, typically named codygen.config.ts. This file allows you to define prompts, context files, and output directories for your Cody interactions.

Configuration File Format

The configuration file should export a default object that adheres to the CodygenConfig interface. Here's an example structure:

export default {
  prompt: 'Your prompt here', // or a function returning a string or array of strings
  context: ['path/to/context/file1', 'path/to/context/file2'], // optional context files
  output: 'path/to/output/directory', // optional output directory
};
  • prompt: This can be a string, an array of strings, or a function that returns a string or an array of strings. It defines the prompt to be used in the Cody chat.
  • context: An optional array of file paths that provide additional context for the Cody chat.
  • output: An optional path to the directory where the extracted files will be saved.