Skip to content

Cursor CLI: fix path to transcripts#527

Merged
gtrrz-victor merged 4 commits intomainfrom
rwr/fix-cursor-cli
Feb 27, 2026
Merged

Cursor CLI: fix path to transcripts#527
gtrrz-victor merged 4 commits intomainfrom
rwr/fix-cursor-cli

Conversation

@squishykid
Copy link
Member

No description provided.

Entire-Checkpoint: 8e09f535daa4
@squishykid squishykid requested a review from a team as a code owner February 26, 2026 16:16
Copilot AI review requested due to automatic review settings February 26, 2026 16:16
@cursor
Copy link

cursor bot commented Feb 26, 2026

PR Summary

Medium Risk
Moderate risk because it changes how Cursor transcript locations are derived during lifecycle events; incorrect resolution could break session initialization or transcript capture for Cursor users.

Overview
Fixes Cursor transcript path handling across Cursor CLI vs IDE. Session directory resolution now points to .cursor/projects/<project>/agent-transcripts, and ResolveSessionFile supports both nested (<id>/<id>.jsonl) and flat (<id>.jsonl) layouts (preferring nested when present).

Lifecycle hook parsing now computes SessionRef when transcript_path is missing (Cursor CLI behavior) by deriving the worktree root and resolving the expected transcript file, with warning logs on failures. Hook input types were split/updated (sessionStartRaw, stopHookInputRaw, sessionEndRaw) and tests were expanded to cover all new path/layout and CLI-null-transcript cases.

Written by Cursor Bugbot for commit 69b9d73. Configure here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the transcript path resolution for Cursor CLI hooks. Cursor IDE and Cursor CLI handle transcript paths differently: the IDE provides the full path in hook payloads, while the CLI sends null and requires dynamic path computation. The PR refactors hook input types and adds path resolution logic to handle both cases correctly.

Changes:

  • Split generic sessionInfoRaw type into hook-specific types (sessionStartRaw, stopHookInputRaw, sessionEndRaw) for better type safety and clearer documentation
  • Added resolveTranscriptRef function that uses provided paths when available (IDE) or computes them dynamically (CLI)
  • Fixed sanitizePathForCursor to trim leading dashes from sanitized paths
  • Corrected GetSessionDir to include the agent-transcripts subdirectory

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
cmd/entire/cli/agent/cursor/types.go Refactored from generic sessionInfoRaw to hook-specific types with better documentation of IDE vs CLI behavior
cmd/entire/cli/agent/cursor/lifecycle.go Added resolveTranscriptRef helper and updated parseTurnEnd/parseSessionEnd to use it; added logging for path resolution
cmd/entire/cli/agent/cursor/cursor.go Fixed sanitizePathForCursor to trim leading dashes; fixed GetSessionDir to include agent-transcripts subdirectory; updated ResolveSessionFile to check both nested and flat layouts
cmd/entire/cli/agent/cursor/cursor_test.go Expanded tests for ResolveSessionFile to cover flat, nested, and missing file scenarios; updated sanitizePathForCursor test expectations; added assertion for agent-transcripts suffix in GetSessionDir
cmd/entire/cli/agent/cursor/lifecycle_test.go Added comprehensive tests for CLI (no transcript_path) and IDE (with transcript_path) scenarios for both Stop and SessionEnd hooks

Entire-Checkpoint: 639921302354
@Soph
Copy link
Collaborator

Soph commented Feb 26, 2026

@cursor review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Entire-Checkpoint: e4c9c0475571
@gtrrz-victor gtrrz-victor merged commit acfa2b4 into main Feb 27, 2026
3 checks passed
@gtrrz-victor gtrrz-victor deleted the rwr/fix-cursor-cli branch February 27, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants