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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@celp/celp-cli

v1.0.95

Published

`celp-cli` is a contextually aware, A.I.-driven command line tool that generates unit tests for your TypeScript Node.js projects. It simplifies the testing process by analyzing your code and automatically generating meaningful, comprehensive tests.

Downloads

273

Readme

celp-cli

celp-cli is a contextually aware, A.I.-driven command line tool that generates unit tests for your TypeScript Node.js projects. It simplifies the testing process by analyzing your code and automatically generating meaningful, comprehensive tests.

Table of Contents

Requirements

  • TypeScript Node Projects Only: celp-cli supports backend projects written in TypeScript and running on Node.js. Frontend support is coming soon.
  • Node 20+

Installation

To install celp-cli, run:

npm install -g @celp/celp-cli

Usage

Generate Unit Tests

Navigate to your project directory and run:

celp-cli generate:tests

This command analyzes your staged changes (diff) and generates unit tests based on the identified changes and existing code structure.

Special Features

  • Reflection (--reflection): Automatically run and fix generated tests.
  • Feedback (celp-cli feedback:add <text>): Provide feedback to improve future test generations.

Example

celp-cli generate:tests --reflection --reflection-attempts 3

Optional Parameters

Customize test generation with these parameters:

  • --reflection: Automatically run and fix generated tests on failure.
  • --reflection-attempts <number>: Set the maximum number of reflection attempts (default: 3).
  • --output <path>: Specify the file to write tests to (new or existing).
  • --lines <range>: Define the line range to generate tests for (format: start-end).
  • --layers <number>: Set the number of layers deep to collect context (default: 3).
  • --file <path>: Specify the file to generate tests for.
  • --context <path>: Provide a test file for context (automatic context detection is recommended).
  • --diff-branch: Select a branch to compare your diff to.
  • --entire-file: If you want to generate tests for an entire file, provide the --file and add --entire-file
  • --directory <path>: Generate unit tests for each file in a directory in your project

Configurable Testing Preferences

Configure celp-cli to match your testing preferences:

  • celp-cli feedback:add "Avoid testing implementation details"
  • celp-cli feedback:add "Always use equality assertions"
  • celp-cli feedback:add "Avoid global setups like beforeEach and afterEach"

Example

celp-cli generate:tests --file src/example.ts --context tests/context.test.ts --output tests/output.test.ts

Choosing an AI Provider

celp-cli allows you to choose your preferred AI provider for generating unit tests. You can select from the following options:

  • OpenAI: Use OpenAI's models like GPT-4 for high-quality AI capabilities.
  • Anthropic: Choose Anthropic for advanced and ethical AI models like Claude-3.5-Sonnet.
  • Bedrock + Anthropic: Combine AWS Bedrock infrastructure with Anthropic's AI models for robust performance.

To set your preferred AI provider, run: celp-cli configure:ai

You will then be prompted for the corresponding credentials (api key or access key/secret).

Cost

celp-cli defaults to OpenAI's GPT-4o-mini for generating unit tests. This is FREE to use. If you use another AI model, then the cost varies depending on the size of the git diff and the number of tokens processed.

Commands

  • celp-cli generate:tests <options>: Generates new unit tests for your project.
  • celp-cli configure:path <path>: Configure a custom directory path for storing celp-cli files (default: .celp-ai).
  • celp-cli configure:reset: Reset the configured celp-cli path to the default path.
  • celp-cli feedback:add <text>: Provide feedback to improve future test generations.
  • celp-cli feedback:reset: Reset the feedback data.
  • celp-cli feedback:edit: Edit your feedback.
  • celp-cli help: Display help information.
  • celp-cli --version: Display the current version of celp-cli.

Troubleshooting

Common Issues

  • Permission Denied: Ensure you have the necessary permissions to install to /usr/local/bin. You may need to run the install script with sudo.
  • Unsupported OS/Architecture: Currently, celp-cli supports Linux x86_64 and macOS. Ensure your system meets these requirements.

Reporting Issues

If you encounter any issues or have suggestions for improvements, please post them to our Discord channel.

License

This project is licensed under the Commercial License. See the LICENSE file for details.