{"_id":"@allen_minus/comments-tests","_rev":"2-d77123a549496402f7a14307d6719a60","name":"@allen_minus/comments-tests","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@allen_minus/comments-tests","version":"0.1.0","keywords":["testing","ai","codegen","jest","vitest","automation","test-generation"],"author":"","license":"MIT","_id":"@allen_minus/comments-tests@0.1.0","maintainers":[{"name":"allen_minus","email":"nickvanzo437@gmail.com"}],"bin":{"ai-test":"dist/cli.js"},"dist":{"shasum":"c79c62616cb4641a7d82a080175cd75170a0f26c","tarball":"https://registry.npmjs.org/@allen_minus/comments-tests/-/comments-tests-0.1.0.tgz","fileCount":33,"integrity":"sha512-ANhpYVaRa8xfOFw9Ek7yEE3XMKkDC6Q0gkJIXqGRtwTX2DRxzkNj9iEqvFg7RTQLIq9CVPqcQLqKP4f9m/pqTw==","signatures":[{"sig":"MEUCIQCDch/tTDTNA/p0goQREBOCaqe5alqxKOh0CwP7KJL37QIgaDzgukrwjKDuHBT/EUfNrpPCeKLjV2Oof2RFqczCUWE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43368},"main":"dist/cli.js","types":"dist/cli.d.ts","engines":{"node":">=18"},"gitHead":"53c5f8d3a823a588d4a278d375019fc87aed5f03","scripts":{"dev":"tsc --watch","test":"jest","build":"tsc","start":"node dist/cli.js","watch":"node dist/cli.js watch","generate":"node dist/cli.js generate","prepublishOnly":"npm run build"},"_npmUser":{"name":"allen_minus","email":"nickvanzo437@gmail.com"},"repository":{"url":"","type":"git"},"_npmVersion":"11.9.0","description":"AI agent that writes and maintains tests from in-code comments","directories":{},"_nodeVersion":"25.6.1","dependencies":{"dotenv":"^17.3.1","chokidar":"^5.0.0","@babel/parser":"^7.29.0","@babel/traverse":"^7.29.0","@babel/generator":"^7.29.1","@anthropic-ai/sdk":"^0.78.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","typescript":"^5.7.0","@types/node":"^22.0.0","@types/babel__traverse":"^7.20.6","@types/babel__generator":"^7.6.8"},"_npmOperationalInternal":{"tmp":"tmp/comments-tests_0.1.0_1772476871115_0.08595015278124762","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@allen_minus/comments-tests","version":"0.1.1","description":"AI agent that writes and maintains tests from in-code comments","main":"dist/cli.js","types":"dist/cli.d.ts","bin":{"ai-test":"dist/cli.js"},"scripts":{"build":"tsc","dev":"tsc --watch","start":"node dist/cli.js","watch":"node dist/cli.js watch","generate":"node dist/cli.js generate","test":"jest","prepublishOnly":"npm run build"},"keywords":["testing","ai","codegen","jest","vitest","automation","test-generation"],"author":"","license":"MIT","repository":{"type":"git","url":""},"engines":{"node":">=18"},"dependencies":{"@anthropic-ai/sdk":"^0.78.0","@babel/generator":"^7.29.1","@babel/parser":"^7.29.0","@babel/traverse":"^7.29.0","chokidar":"^5.0.0","dotenv":"^17.3.1"},"devDependencies":{"@types/babel__generator":"^7.6.8","@types/babel__traverse":"^7.20.6","@types/node":"^22.0.0","jest":"^30.2.0","typescript":"^5.7.0"},"gitHead":"53c5f8d3a823a588d4a278d375019fc87aed5f03","_id":"@allen_minus/comments-tests@0.1.1","_nodeVersion":"25.6.1","_npmVersion":"11.9.0","dist":{"integrity":"sha512-4kRlWydNk3XqW4e+/jK7iQ1aVPwcgXQJez+KApyc0Y5IRua0BlrKiMFIR4I5mKBkySXNWAnu+49oFU/fgNd3vQ==","shasum":"ee02b3ed9f954614bc231dcda71a220b7bdc0744","tarball":"https://registry.npmjs.org/@allen_minus/comments-tests/-/comments-tests-0.1.1.tgz","fileCount":34,"unpackedSize":47359,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCFfwl2dtqY6cDI3QekuLVMlXRfKC+9rP75uWLgWhN3GAIgC8Uj65UfjFrryAF3iC1tWx0XxDFM1xxSNvtGtLICjQ8="}]},"_npmUser":{"name":"allen_minus","email":"nickvanzo437@gmail.com"},"directories":{},"maintainers":[{"name":"allen_minus","email":"nickvanzo437@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/comments-tests_0.1.1_1772476984556_0.8263488436537563"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-02T18:41:10.987Z","modified":"2026-03-02T18:43:04.820Z","0.1.0":"2026-03-02T18:41:11.333Z","0.1.1":"2026-03-02T18:43:04.693Z"},"license":"MIT","keywords":["testing","ai","codegen","jest","vitest","automation","test-generation"],"repository":{"type":"git","url":""},"description":"AI agent that writes and maintains tests from in-code comments","maintainers":[{"name":"allen_minus","email":"nickvanzo437@gmail.com"}],"readme":"# @allen_minus/comments-tests\n\nAn AI agent that writes and maintains tests for your code. Annotate functions with `@ai-test` comments describing what to test, and the agent generates a full test suite.\n\n```js\n// @ai-test: handle negative numbers and zero\n// @ai-test: handle null inputs\nfunction multiply(a, b) {\n    return a * b;\n}\n```\n\nRun `ai-test generate` and get a complete test file with cases for negatives, zero, nulls, and more — no boilerplate writing required.\n\n## Install\n\n```bash\nnpm install -g @allen_minus/comments-tests\n```\n\nYou'll need an [Anthropic API key](https://console.anthropic.com/). Add it to a `.env` file in your project root:\n\n```\nANTHROPIC_API_KEY=sk-ant-...\n```\n\n## Usage\n\n### Generate tests\n\nScan your source files and generate tests for every `@ai-test` annotated function:\n\n```bash\nai-test generate            # scan all configured source directories\nai-test generate src/math.js  # scan a specific file\n```\n\n### Watch mode\n\nAutomatically regenerate tests when source files change:\n\n```bash\nai-test watch\n```\n\n### Help\n\n```bash\nai-test help\n```\n\n## Annotations\n\nAdd `@ai-test` comments directly above any function. Each comment becomes a directive — the agent will generate test cases for each one.\n\n### Free-form directives\n\nDescribe what you want tested in plain English:\n\n```js\n// @ai-test: handle negative numbers and zero\n// @ai-test: ensure the output is always uppercase\n// @ai-test: throw an error when input is not a string\nfunction greet(name) {\n    return name.toUpperCase() + \"!\";\n}\n```\n\n### Structured directives\n\nUse `key:value` syntax for more precise control:\n\n```js\n// @ai-test: type:fuzz range:[-1000,1000] iterations:50\n// @ai-test: type:invariant assert:result >= 0\n// @ai-test: type:edge-case inputs:[null,undefined,NaN,Infinity,\"\"]\n// @ai-test: type:property assert:multiply(a,b) === multiply(b,a)\nfunction multiply(a, b) {\n    return a * b;\n}\n```\n\n| Type | What it does |\n|------|-------------|\n| `fuzz` | Generates randomized input tests with edge cases |\n| `invariant` | Property-based assertions that must always hold |\n| `edge-case` | Boundary values, nulls, empty inputs, type coercion |\n| `property` | Mathematical/logical properties of the function |\n\nYou can mix free-form and structured directives on the same function.\n\n## Configuration\n\nCreate an `ai-test.config.json` in your project root to customize behavior:\n\n```json\n{\n  \"sourceGlobs\": [\"./src\"],\n  \"testDir\": \"./__tests__\",\n  \"testFramework\": \"jest\",\n  \"model\": \"claude-sonnet-4-20250514\",\n  \"extensions\": [\".js\", \".ts\", \".jsx\", \".tsx\"]\n}\n```\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `sourceGlobs` | `[\"./src\"]` | Directories to scan for source files |\n| `testDir` | `./__tests__` | Where generated tests are written |\n| `testFramework` | `jest` | Test framework (`jest`, `vitest`, or `mocha`) |\n| `model` | `claude-sonnet-4-20250514` | Anthropic model to use |\n| `extensions` | `[\".js\", \".ts\", \".jsx\", \".tsx\"]` | File extensions to scan |\n| `envFile` | `.env` | Path to your `.env` file |\n\nAlso supports `.aitestrc` and `.aitestrc.json` as config filenames.\n\n## How it works\n\n1. **Scan** — Parses your source files using Babel, walks the AST, and finds functions with `@ai-test` comments\n2. **Cache** — Hashes each function's code + directives. If nothing changed since last run, the function is skipped\n3. **Generate** — Sends the function source and directives to Claude, which produces a test file\n4. **Write** — Saves the test to `__tests__/{filename}_{functionName}.test.js`\n\nThe cache (`.ai-test-cache.json`) avoids unnecessary API calls. Only functions whose code or directives changed get regenerated.\n\n## Supported languages\n\nJavaScript and TypeScript (including JSX/TSX). Both function declarations and arrow functions are supported:\n\n```js\n// @ai-test: works on declarations\nfunction add(a, b) { return a + b; }\n\n// @ai-test: works on arrow functions too\nconst subtract = (a, b) => a - b;\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}