Documentation
¶
Index ¶
- Constants
- type Provider
- func (p *Provider) CaptureFileSnapshot(_ *state.Store, _ *trace.HookInput) error
- func (p *Provider) CleanupAfterEdit(_ *state.Store, _ *trace.HookInput)
- func (p *Provider) CopySessionData(store *state.Store, repoRoot, sessionID string) error
- func (p *Provider) DiscoverSession(repoRoot string) (*trace.DiscoveredSession, error)
- func (p *Provider) InstallHooks(repoRoot string) error
- func (p *Provider) InstallHooksForTraceRun(repoRoot string) error
- func (p *Provider) IsCommandTool(_ string) bool
- func (p *Provider) IsFileWritingTool(toolName string) bool
- func (p *Provider) Name() string
- func (p *Provider) ParseSession(_ context.Context, opts *trace.ParseOpts) (*aicodingsession.Evidence, error)
- func (p *Provider) ReadHookInput(r io.Reader) (*trace.HookInput, error)
- func (p *Provider) ResolveBeforeContent(_ *state.Store, input *trace.HookInput, after []byte) []byte
- func (p *Provider) SessionDirForRepo(repoRoot string) string
- func (p *Provider) SettingsFile(repoRoot string) string
- func (p *Provider) SystemMessage(_ string) error
- func (p *Provider) UninstallHooks(repoRoot string) error
Constants ¶
const Name = "cursor"
Name is the provider identifier emitted to evidence and used as the key in SessionRecord.Provider. Kept as an exported constant so CLI wiring can refer to it without instantiating the provider.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct{}
Provider implements trace.Provider for Cursor agent sessions.
func (*Provider) CaptureFileSnapshot ¶
CaptureFileSnapshot is a no-op for Cursor: the afterFileEdit hook delivers old/new strings directly, so no pre-edit snapshot is needed.
func (*Provider) CleanupAfterEdit ¶
CleanupAfterEdit is a no-op for Cursor: there's no per-edit state to release because no snapshot was taken.
func (*Provider) CopySessionData ¶
CopySessionData copies the Cursor transcript for sessionID into the store's raw/<sessionID>.jsonl. Handles both flat and nested source layouts; the destination is always flat so downstream consumers (parse, pre-push) don't need to re-resolve.
func (*Provider) DiscoverSession ¶
func (p *Provider) DiscoverSession(repoRoot string) (*trace.DiscoveredSession, error)
DiscoverSession finds the most recent Cursor session for the given repo root.
func (*Provider) InstallHooks ¶
InstallHooks adds Chainloop hooks to .cursor/hooks.json.
func (*Provider) InstallHooksForTraceRun ¶
InstallHooksForTraceRun installs every hook except SessionEnd; trace run drives end-of-session itself.
func (*Provider) IsCommandTool ¶
IsCommandTool always returns false for Cursor: shell-execution hooks are not yet wired (Cursor installs only sessionStart/sessionEnd/afterFileEdit), so shell-driven file changes are not captured for this provider.
func (*Provider) IsFileWritingTool ¶
IsFileWritingTool returns true for the synthetic "edit" tool name we set on afterFileEdit hook inputs. Cursor has no tool-name concept for generic preToolUse/postToolUse events in our flow, so "edit" is the sole signal.
func (*Provider) ParseSession ¶
func (p *Provider) ParseSession(_ context.Context, opts *trace.ParseOpts) (*aicodingsession.Evidence, error)
ParseSession reads the copied transcript JSONL for sessionID and returns a best-effort Evidence. Cursor's transcript format does not include token usage, so Usage stays empty and the result carries a warning.
func (*Provider) ReadHookInput ¶
ReadHookInput parses a Cursor hook JSON payload from the given reader. ConversationID is preferred as the session identifier; session_id is used as a fallback for forward-compatibility.
func (*Provider) ResolveBeforeContent ¶
func (p *Provider) ResolveBeforeContent(_ *state.Store, input *trace.HookInput, after []byte) []byte
ResolveBeforeContent reverses the edits reported by Cursor's afterFileEdit hook against the file's current content to reconstruct the pre-edit state. Returns nil when no edits were reported.
func (*Provider) SessionDirForRepo ¶
SessionDirForRepo returns the Cursor agent-transcripts directory for the repo.
func (*Provider) SettingsFile ¶
SettingsFile returns the absolute path to .cursor/hooks.json for the given repo.
func (*Provider) SystemMessage ¶
SystemMessage is a no-op for Cursor: the documented hook response channel does not include a "systemMessage"-style announcement path comparable to Claude Code's SessionStart output. We log nothing to stdout to avoid confusing Cursor's JSON response parser.
func (*Provider) UninstallHooks ¶
UninstallHooks removes Chainloop hooks from .cursor/hooks.json. Leaves user-authored hooks intact.