cursor

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cursor provides the Cursor IDE agent source for agentwatch.

Root resolution

This source does NOT read any environment variable. Callers must supply the base directory explicitly via WithRoot. If no WithRoot is provided the source returns no sessions. A caller that wants environment fallback can implement it itself:

home, _ := os.UserHomeDir()
src := cursor.New(cursor.WithRoot(filepath.Join(home, ".cursor")))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r *source.Registry, opts ...Option) error

Register registers this source with a source.Registry using a factory that calls New(opts...).

Types

type Option

type Option func(*Source)

Option configures a Source.

func WithDiscoverWindow

func WithDiscoverWindow(d time.Duration) Option

WithDiscoverWindow limits discovery to transcript files whose modification time is within d of the current time. Zero disables age filtering.

func WithRoot

func WithRoot(path string) Option

WithRoot sets the Cursor data directory (the directory containing "projects/"). Without this option the source discovers no sessions.

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source implements source.Source for Cursor IDE agent sessions.

Cursor stores agent transcripts at:

<root>/projects/<encoded-name>/agent-transcripts/<id>.jsonl       (flat)
<root>/projects/<encoded-name>/agent-transcripts/<id>/<id>.jsonl  (nested)

The project directory name is a dash-encoded representation of the project folder path (path separators replaced by dashes).

func New

func New(opts ...Option) *Source

New creates a new Cursor source with the given options.

func (*Source) Discover

func (s *Source) Discover(ctx context.Context) ([]source.SessionHandle, error)

Discover implements source.Source. It walks <root>/projects for agent transcript JSONL files in both flat and nested layouts, and returns a handle for each.

func (*Source) Name

func (s *Source) Name() string

Name implements source.Source.

func (*Source) Parse

Parse implements source.Source. The cursor is the byte offset into the transcript file as a decimal string. An empty cursor means start from zero.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL