Skip to content

feat(sdk): add test-generator example with TS/Python support#6

Open
Deepak-png981 wants to merge 10 commits into
cursor:mainfrom
Deepak-png981:feat/sdk-test-generator
Open

feat(sdk): add test-generator example with TS/Python support#6
Deepak-png981 wants to merge 10 commits into
cursor:mainfrom
Deepak-png981:feat/sdk-test-generator

Conversation

@Deepak-png981
Copy link
Copy Markdown

@Deepak-png981 Deepak-png981 commented Apr 29, 2026

Summary

  • add sdk/test-generator, a new Cursor SDK cookbook example for local test generation and repair loops
  • support TypeScript/JavaScript projects (Vitest/Jest) and Python projects (Pytest) with framework detection and overrides
  • include both plain CLI and Ink TUI flows with file selection, streaming progress, and per-file diff review (accept/reject)
  • add sample source files and docs, and link the example from the root README

Test plan

  • cd sdk/test-generator && pnpm install
  • cd sdk/test-generator && pnpm typecheck
  • cd sdk/test-generator && pnpm build
  • cd sdk/test-generator && pnpm dev -- --help
  • cd sdk/test-generator && pnpm dev -- examples/sample.ts --yes --overwrite --max-iters=1
  • cd sdk/test-generator && pnpm dev -- --lang python examples/sample.py --yes --overwrite --max-iters=1
image

Note

Low Risk
New standalone SDK example and documentation; no changes to auth, production services, or existing app behavior beyond the README link swap.

Overview
Adds a new sdk/test-generator Cursor SDK cookbook example and updates the root README to feature it instead of the DAG task runner link.

The tool is a test-gen CLI (Node 22+, @cursor/sdk, Ink TUI) that detects Vitest/Jest or Pytest projects, uses a local agent to write tests, then runs the test runner outside the agent and loops on failures (with optional --allow-source-edits, --overwrite, and accept/reject review). Entry points include a non-interactive path for file/glob targets and an interactive TUI when no files are passed.

Also ships sample TS/Python sources, README usage docs, .gitignore, package.json, lockfile, and TypeScript sources (detector, workflow, session, prompts, runner, TUI components).

Reviewed by Cursor Bugbot for commit 8d107ce. Bugbot is set up for automated code reviews on this repo. Configure here.

@Deepak-png981 Deepak-png981 force-pushed the feat/sdk-test-generator branch from bf2ed43 to c6e29d0 Compare April 29, 2026 17:28
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.
@Deepak-png981 Deepak-png981 force-pushed the feat/sdk-test-generator branch from c6e29d0 to 68aa4b8 Compare April 29, 2026 17:28
Comment thread sdk/test-generator/src/workflow.ts Outdated
Comment thread sdk/test-generator/src/index.ts
Comment thread sdk/test-generator/src/index.ts
Comment thread sdk/test-generator/src/workflow.ts
Comment thread sdk/test-generator/src/workflow.ts
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.
Comment thread sdk/test-generator/src/session.ts Outdated
Comment thread sdk/test-generator/src/tui/AppView.tsx
Comment thread sdk/test-generator/src/workflow.ts
Comment thread sdk/test-generator/src/prompts.ts
Comment thread sdk/test-generator/src/detector.ts Outdated
Comment thread sdk/test-generator/src/index.ts
Comment thread sdk/test-generator/src/workflow.ts
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.
@Deepak-png981 Deepak-png981 force-pushed the feat/sdk-test-generator branch from 99f1b0d to fb1bddd Compare April 29, 2026 18:15
Comment thread sdk/test-generator/src/detector.ts
Preserve source subdirectories under the generated tests directory so same-named Python files in different folders do not overwrite each other's tests.
Comment thread sdk/test-generator/src/workflow.ts Outdated
Comment thread sdk/test-generator/src/workflow.ts
Use named arguments for diff helpers and restore source content when rejecting an agent run that was allowed to edit source files.
Comment thread sdk/test-generator/src/tui/AppView.tsx Outdated
Comment thread sdk/test-generator/src/tui/AppView.tsx
Comment thread sdk/test-generator/src/workflow.ts Outdated
Clamp empty picker navigation, stop multi-file generation on cancel, and remove the unused iterations field from generated file results.
Comment thread sdk/test-generator/src/tui/AppView.tsx
Comment thread sdk/test-generator/src/workflow.ts
Comment thread sdk/test-generator/src/index.ts
Comment thread sdk/test-generator/src/detector.ts
Comment thread sdk/test-generator/src/tui/AppView.tsx
Comment thread sdk/test-generator/src/tui/AppView.tsx
Comment thread sdk/test-generator/src/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant