Cursor CLI: fix path to transcripts#527
Conversation
Entire-Checkpoint: 8e09f535daa4
Entire-Checkpoint: 011f239b092d
PR SummaryMedium Risk Overview Lifecycle hook parsing now computes Written by Cursor Bugbot for commit 69b9d73. Configure here. |
There was a problem hiding this comment.
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
sessionInfoRawtype into hook-specific types (sessionStartRaw,stopHookInputRaw,sessionEndRaw) for better type safety and clearer documentation - Added
resolveTranscriptReffunction that uses provided paths when available (IDE) or computes them dynamically (CLI) - Fixed
sanitizePathForCursorto trim leading dashes from sanitized paths - Corrected
GetSessionDirto include theagent-transcriptssubdirectory
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
|
@cursor review |
Entire-Checkpoint: e4c9c0475571
No description provided.