[PR #4] [MERGED] feat: add Cursor AI support with smart slug-to-path resolution #15

Closed
opened 2026-03-04 01:39:15 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/yigitkonur/cli-continues/pull/4
Author: @Evrim267
Created: 2/20/2026
Status: Merged
Merged: 2/20/2026
Merged by: @yigitkonur

Base: mainHead: feat/cursor-support


📝 Commits (1)

  • 3ef8e7f fix: resolve Cursor slug paths with dot-separated directory names

📊 Changes

1 file changed (+34 additions, -21 deletions)

View changed files

📝 src/parsers/cursor.ts (+34 -21)

📄 Description

Summary

Adds full Cursor AI support as the 7th platform in continues, enabling session handoffs to/from Cursor IDE agent sessions.

What's included

  • New parser (src/parsers/cursor.ts): Discovers and parses Cursor agent-transcript JSONL files from ~/.cursor/projects/
  • Smart slug-to-path resolution: Cursor replaces both / and . with - in project directory slugs (e.g. dzcm.testdzcm-test). Uses recursive backtracking to correctly resolve ambiguous paths by trying all three interpretations (/, ., -) at each dash position
  • Full tool extraction: Parses Anthropic-style tool_use/tool_result content blocks for file edits, shell commands, grep, glob, web fetch, MCP tools, and subagents
  • Thinking block extraction: Captures AI reasoning from thinking content blocks as session notes
  • User query cleaning: Strips Cursor's <user_query> wrapper tags from user messages
  • Resume support: Native resume opens project in Cursor; cross-tool handoff generates structured markdown
  • 42 test cases: All 7×6 cross-tool conversion paths tested and passing (was 30 for 6 tools)

Files changed (12 files)

File Change
src/parsers/cursor.ts New parser with parseCursorSessions() and extractCursorContext()
src/parsers/index.ts Barrel export
src/types/index.ts Added 'cursor' to SessionSource union
src/utils/index.ts Wired into buildIndex() and extractContext()
src/utils/markdown.ts Added 'Cursor AI' label
src/utils/resume.ts Added native + cross-tool resume commands
src/cli.ts Added color, quick-resume subcommand, updated help text
src/__tests__/fixtures/index.ts Added createCursorFixture()
src/__tests__/unit-conversions.test.ts Expanded to 42 conversion paths (7 tools)
src/__tests__/conversions.test.ts Added cursor entries
src/__tests__/e2e-conversions.test.ts Added cursor entries
src/__tests__/extract-handoffs.ts Added cursor entries

Slug resolution examples

Users-evolution-Sites-localhost-dzcm-test      → /Users/evolution/Sites/localhost/dzcm.test ✓
Users-evolution-Sites-localhost-readybyte-test  → /Users/evolution/Sites/localhost/readybyte.test ✓
Users-evolution-Desktop-Workspace-laravel-contentai → /Users/evolution/Desktop/Workspace/laravel/contentai ✓

Test plan

  • npx tsc compiles clean
  • All 111 unit tests pass (npx vitest run)
  • continues list --source cursor shows correct CWD paths
  • continues resume <id> --in claude generates valid handoff markdown
  • Tested with real Cursor agent-transcript data on macOS

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced path resolution to more reliably identify project directories, particularly those with complex naming patterns. Improved fallback handling ensures better accuracy across various naming conventions and edge cases.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/yigitkonur/cli-continues/pull/4 **Author:** [@Evrim267](https://github.com/Evrim267) **Created:** 2/20/2026 **Status:** ✅ Merged **Merged:** 2/20/2026 **Merged by:** [@yigitkonur](https://github.com/yigitkonur) **Base:** `main` ← **Head:** `feat/cursor-support` --- ### 📝 Commits (1) - [`3ef8e7f`](https://github.com/yigitkonur/cli-continues/commit/3ef8e7fd6d7db2ee1819e643c84abda301562112) fix: resolve Cursor slug paths with dot-separated directory names ### 📊 Changes **1 file changed** (+34 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `src/parsers/cursor.ts` (+34 -21) </details> ### 📄 Description ## Summary Adds full **Cursor AI** support as the 7th platform in `continues`, enabling session handoffs to/from Cursor IDE agent sessions. ### What's included - **New parser** (`src/parsers/cursor.ts`): Discovers and parses Cursor agent-transcript JSONL files from `~/.cursor/projects/` - **Smart slug-to-path resolution**: Cursor replaces both `/` and `.` with `-` in project directory slugs (e.g. `dzcm.test` → `dzcm-test`). Uses recursive backtracking to correctly resolve ambiguous paths by trying all three interpretations (`/`, `.`, `-`) at each dash position - **Full tool extraction**: Parses Anthropic-style `tool_use`/`tool_result` content blocks for file edits, shell commands, grep, glob, web fetch, MCP tools, and subagents - **Thinking block extraction**: Captures AI reasoning from `thinking` content blocks as session notes - **User query cleaning**: Strips Cursor's `<user_query>` wrapper tags from user messages - **Resume support**: Native resume opens project in Cursor; cross-tool handoff generates structured markdown - **42 test cases**: All 7×6 cross-tool conversion paths tested and passing (was 30 for 6 tools) ### Files changed (12 files) | File | Change | |------|--------| | `src/parsers/cursor.ts` | New parser with `parseCursorSessions()` and `extractCursorContext()` | | `src/parsers/index.ts` | Barrel export | | `src/types/index.ts` | Added `'cursor'` to `SessionSource` union | | `src/utils/index.ts` | Wired into `buildIndex()` and `extractContext()` | | `src/utils/markdown.ts` | Added `'Cursor AI'` label | | `src/utils/resume.ts` | Added native + cross-tool resume commands | | `src/cli.ts` | Added color, quick-resume subcommand, updated help text | | `src/__tests__/fixtures/index.ts` | Added `createCursorFixture()` | | `src/__tests__/unit-conversions.test.ts` | Expanded to 42 conversion paths (7 tools) | | `src/__tests__/conversions.test.ts` | Added cursor entries | | `src/__tests__/e2e-conversions.test.ts` | Added cursor entries | | `src/__tests__/extract-handoffs.ts` | Added cursor entries | ### Slug resolution examples ``` Users-evolution-Sites-localhost-dzcm-test → /Users/evolution/Sites/localhost/dzcm.test ✓ Users-evolution-Sites-localhost-readybyte-test → /Users/evolution/Sites/localhost/readybyte.test ✓ Users-evolution-Desktop-Workspace-laravel-contentai → /Users/evolution/Desktop/Workspace/laravel/contentai ✓ ``` ### Test plan - [x] `npx tsc` compiles clean - [x] All 111 unit tests pass (`npx vitest run`) - [x] `continues list --source cursor` shows correct CWD paths - [x] `continues resume <id> --in claude` generates valid handoff markdown - [x] Tested with real Cursor agent-transcript data on macOS <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Enhanced path resolution to more reliably identify project directories, particularly those with complex naming patterns. Improved fallback handling ensures better accuracy across various naming conventions and edge cases. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 01:39:15 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cli-continues#15
No description provided.