1.0.1 โ€ข Published 1 year ago

gptdd v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

gptdd ๐Ÿงช

A single-file, test-driven-development feedback loop with GPT ๐ŸŒ€

How it Works

Given command which runs a test and a file to edit , gptdd feeds the test results to GPT4, requests a fix, and offers the user the option to apply the fix.

๐Ÿ’ญ It would be amazing to build this in at the test runner/IDE-level, but in the interest of it being language and test-runner agnostic, it's a standalone script. If you're interested in building an IDE plugin, please reach out!

gptdd demo fast

Usage

npx gptdd \
  --fileToFix lib/myFunc.ts \
  --testToRun "pnpm vitest run lib/myFunc.test.ts" \
  --apiKey "sk-..."

CLI Options

OptionDescription
--fileToFix, -fThe file to edit.
--testToRun, -tThe command to run once to get the initial test results.
--apiKey, -aYour OpenAI API key.

Specific Examples

The following examples specific to your language/test-runner. If you don't see what you're looking for, please contribute!

Javascript - Vitest

npx gptdd \
  --f lib/myFunc.ts \
  --t "pnpm vitest run lib/myFunc.test.ts" \
  --a "sk-..."

Javascript - Jest

npx gptdd \
  --f lib/myFunc.ts \
  --t "pnpm jest examples/myFunc.test.ts" \
  --a "sk-..."

Development

We recommend using pnpm. Clone the repository, run pnpm install. Then run pnpm link --global to make the gptdd command available globally. From there, you can make tweaks and test them out by running gptdd in a directory with a test and file to fix.

Contributing

We strongly welcome contributions of any kind- simply open a PR explaining what you've changed and why and we'll go from there.