Skip to content

Examples

This section provides practical examples of using Go Cursor SDK in real-world scenarios.

Getting Started Examples

Basic Usage

go
package main

import (
    "fmt"
    "log"
    
    cursor "github.com/vibe-coding-labs/go-cursor-sdk"
)

func main() {
    client, err := cursor.NewCursorClient(nil)
    if err != nil {
        log.Fatal(err)
    }
    defer client.Close()
    
    sessions, err := client.Sessions().ListSessions()
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Printf("Found %d sessions\n", len(sessions))
}

Available Examples

Data Analysis

Data Management

Advanced Features

Example Categories

📊 Analytics & Reporting

Learn how to analyze and report on your Cursor IDE usage:

  • Daily/weekly/monthly statistics
  • Acceptance rate analysis
  • Productivity metrics
  • Code generation patterns

Examples of accessing and searching different types of data:

  • Session search and filtering
  • Composer data access
  • Terminal history queries
  • Configuration reading

⚡ Performance & Optimization

Optimize your applications with these examples:

  • Caching strategies
  • Concurrent data access
  • Batch operations
  • Resource management

🔄 Real-time Monitoring

Monitor Cursor IDE data in real-time:

  • Watch for new sessions
  • Track Composer changes
  • Monitor statistics updates
  • Custom event handlers

Running Examples

All examples are self-contained and can be run directly:

  1. Copy the example code
  2. Save it to a .go file
  3. Run with go run
bash
go run example.go

Contributing Examples

Have a useful example? We'd love to include it! Please:

  1. Fork the repository
  2. Add your example to the example/ directory
  3. Update this documentation
  4. Submit a pull request

Need Help?

Released under the MIT License.