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
- Analyzing AI Statistics - Analyze AI code generation metrics
- Terminal Usage Analysis - Analyze terminal command patterns
- AI Code Tracking - Track AI-generated code
Data Management
- Searching Sessions - Search and filter sessions
- Using Cache - Improve performance with caching
- MCP Server Query - Query MCP server information
Advanced Features
- Watching Data Changes - Real-time data monitoring
- Using KVReader - Access low-level key-value data
- Development Report - Generate comprehensive reports
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
🔍 Data Access & Search
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:
- Copy the example code
- Save it to a
.gofile - Run with
go run
bash
go run example.goContributing Examples
Have a useful example? We'd love to include it! Please:
- Fork the repository
- Add your example to the
example/directory - Update this documentation
- Submit a pull request
Need Help?
- Check the API Reference
- Read the Guide
- Ask in GitHub Discussions