feat(sdk): add test-generator example with TS/Python support#6
Open
Deepak-png981 wants to merge 9 commits intocursor:mainfrom
Open
feat(sdk): add test-generator example with TS/Python support#6Deepak-png981 wants to merge 9 commits intocursor:mainfrom
Deepak-png981 wants to merge 9 commits intocursor:mainfrom
Conversation
bf2ed43 to
c6e29d0
Compare
Add a new SDK example that generates tests, runs framework-native test commands, and iterates on failures so users can see a practical agent + deterministic verification loop in both CLI and TUI flows.
c6e29d0 to
68aa4b8
Compare
Moved compactText and formatDuration functions from index.ts, session.ts, and AppView.tsx to a new format.ts module for better organization and reusability. Updated imports accordingly.
Improve TUI error handling, make string-heavy helpers use named parameters, and render review diffs with line sequence matching so overwrite reviews are less misleading.
Make max-iteration parsing use named arguments and apply shared ignore globs when resolving explicit glob and directory targets.
99f1b0d to
fb1bddd
Compare
Preserve source subdirectories under the generated tests directory so same-named Python files in different folders do not overwrite each other's tests.
Use named arguments for diff helpers and restore source content when rejecting an agent run that was allowed to edit source files.
Clamp empty picker navigation, stop multi-file generation on cancel, and remove the unused iterations field from generated file results.
Made-with: Cursor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high mode and found 3 potential issues.
Reviewed by Cursor Bugbot for commit 14481b8. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
sdk/test-generator, a new Cursor SDK cookbook example for local test generation and repair loopsTest plan
cd sdk/test-generator && pnpm installcd sdk/test-generator && pnpm typecheckcd sdk/test-generator && pnpm buildcd sdk/test-generator && pnpm dev -- --helpcd sdk/test-generator && pnpm dev -- examples/sample.ts --yes --overwrite --max-iters=1cd sdk/test-generator && pnpm dev -- --lang python examples/sample.py --yes --overwrite --max-iters=1Note
Medium Risk
Mostly additive example code, but it introduces a new CLI that can execute local test commands and optionally rewrite source files, so reviewers should validate guardrails like overwrite behavior, target file resolution, and cancellation/cleanup.
Overview
Adds a new SDK cookbook example,
sdk/test-generator, that uses@cursor/sdkto generate unit tests for selected source files, run them locally, and iteratively prompt the agent to repair failures (optionally allowing source edits).Includes project detection for TypeScript/JavaScript (Vitest/Jest) and Python (Pytest), a plain CLI mode plus an Ink TUI for file selection/model selection/progress/cancel/diff review, and supporting packaging/docs (new
package.json, lockfile, tsconfig, sample files, and root README link).Reviewed by Cursor Bugbot for commit 14481b8. Bugbot is set up for automated code reviews on this repo. Configure here.