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.
-
TypeScript Node Projects Only:
celp-cli
supports backend projects written in TypeScript and running on Node.js. Frontend support is coming soon. - Node 20+
To install celp-cli
, run:
npm install -g @celp/celp-cli
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.
-
Reflection (
--reflection
): Automatically run and fix generated tests. -
Feedback (
celp-cli feedback:add <text>
): Provide feedback to improve future test generations.
celp-cli generate:tests --reflection --reflection-attempts 3
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
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"
celp-cli generate:tests --file src/example.ts --context tests/context.test.ts --output tests/output.test.ts
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).
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.
-
celp-cli generate:tests <options>
: Generates new unit tests for your project. -
celp-cli configure:path <path>
: Configure a custom directory path for storingcelp-cli
files (default: .celp-ai). -
celp-cli configure:reset
: Reset the configuredcelp-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 ofcelp-cli
.
-
Permission Denied: Ensure you have the necessary permissions to install to
/usr/local/bin
. You may need to run the install script withsudo
. -
Unsupported OS/Architecture: Currently,
celp-cli
supports Linux x86_64 and macOS. Ensure your system meets these requirements.
If you encounter any issues or have suggestions for improvements, please post them to our Discord channel.
This project is licensed under the Commercial License. See the LICENSE file for details.