Skip to content

zhipengzuo/openCursor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openCursor / openCursor

English | 中文


English

An open-source implementation of the Cursor Agent core workflow, making it easy for everyone to learn and use. This project demonstrates the fundamental processes behind Cursor Agent functionality.

🎯 Special Note: This entire project, including this README.md, was automatically generated by Cursor. The programmer only used the chat panel without writing a single line of code in the editor. This showcases the power of AI-driven development, similar to how CLI tools like Claude Code are setting new standards for developer productivity.

🔧 Technical Details: The prompts and tools used in this codebase are replicated from Cursor's official native tools, providing an authentic reproduction of the original Cursor Agent workflow.

Features

  • 🚀 Open Source: Complete implementation of Cursor Agent core workflow
  • 🤖 AI Integration: Default integration with DeepSeek AI model
  • 🔧 Easy Configuration: Simple environment variable setup
  • 🌐 API Compatibility: Support for OpenAI API compatible models
  • 📦 Portable: Single binary executable
  • 💡 Educational: Perfect for learning AI agent workflows

🎮 Usage Example

See openCursor in action! Here's how you can create a complete Snake game with a single command:

openCursor "Write a Snake game in HTML with JavaScript. Include proper game controls, scoring system, and game over functionality. Make it responsive and visually appealing."

This command will generate a complete, playable Snake game including:

  • ✅ HTML structure with canvas
  • ✅ JavaScript game logic
  • ✅ Keyboard controls (WASD or Arrow keys)
  • ✅ Score tracking
  • ✅ Game over detection
  • ✅ Responsive design
  • ✅ Modern styling

The AI agent will create all necessary files and provide you with a fully functional game that you can run immediately in your browser!

Quick Start

1. Download and Install

Download the openCursor binary and place it in your system's bin directory:

# Download the binary (replace with actual download URL)
wget https://github.com/your-username/openCursor/releases/latest/download/openCursor

# Make it executable
chmod +x openCursor

# Move to system bin directory
sudo cp openCursor /usr/local/bin/

# Now you can use it from anywhere
openCursor --help

2. Configuration

Method 1: Environment Variables

If you're using zsh, add to ~/.zshrc:

export OPENAI_API_KEY="your-deepseek-api-key"

If you're using bash, add to ~/.bashrc:

export OPENAI_API_KEY="your-deepseek-api-key"

Method 2: Custom Model Configuration

You can also configure other OpenAI API compatible models:

export OPENAI_API_KEY="your-api-key"
export MODEL="deepseek-chat"
export BASE_URL="https://api.deepseek.com/v1"

3. Usage

# Basic usage
openCursor "Hello, please introduce yourself"

# Programming assistance
openCursor "Write a Python function to calculate Fibonacci sequence"

# Code review
openCursor "Review this code for potential improvements"

Getting DeepSeek API Key

  1. Visit DeepSeek Open Platform
  2. Sign up and log in to your account
  3. Navigate to API Keys management page
  4. Create a new API key
  5. Copy the key and configure it in your environment

📖 For detailed API documentation and usage examples, visit: DeepSeek API Documentation

Building from Source

Prerequisites

  • Go 1.19+: Make sure you have Go 1.19 or higher installed
  • Git: For cloning the repository
  • Make: For using the Makefile (optional)

Check your Go version:

go version

Clone and Build

# Clone the repository
git clone https://github.com/your-username/openCursor.git
cd openCursor

# Download dependencies
go mod download

# Build the project
go build -o openCursor

# Or use Make
make build

Build Options

Standard Build:

go build -o openCursor

Optimized Build (smaller binary):

go build -ldflags="-s -w" -o openCursor

Debug Build:

go build -gcflags="all=-N -l" -o openCursor-debug

Cross-Platform Compilation

Build for different operating systems and architectures:

# Windows 64-bit
GOOS=windows GOARCH=amd64 go build -o openCursor.exe

# macOS 64-bit (Intel)
GOOS=darwin GOARCH=amd64 go build -o openCursor-macos-intel

# macOS 64-bit (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o openCursor-macos-arm

# Linux 64-bit
GOOS=linux GOARCH=amd64 go build -o openCursor-linux

# Linux ARM64
GOOS=linux GOARCH=arm64 go build -o openCursor-linux-arm64

Using Makefile

The project includes a Makefile for common tasks:

# Build the project
make build

# Build for all platforms
make build-all

# Clean build artifacts
make clean

# Run tests
make test

# Install to local bin
make install

Verify the Build

After building, verify the binary works correctly:

# Check version and help
./openCursor --help

# Test with a simple query (requires API key)
export OPENAI_API_KEY="your-api-key"
./openCursor "Hello, test message"

Development Setup

For development work:

# Install development dependencies
go mod download

# Run with go run (for testing)
go run main.go "test query"

# Run tests
go test ./...

# Format code
go fmt ./...

# Check for issues
go vet ./...

Project Structure

openCursor/
├── cmd/                 # Command line interface
├── internal/            # Internal packages
│   ├── client/         # AI client implementation
│   └── tools/          # Tool management
├── main.go             # Application entry point
├── go.mod              # Go module definition
├── go.sum              # Go module checksums
├── Makefile            # Build automation
└── README.md           # Project documentation

Contributing

We welcome contributions! Please feel free to submit issues and pull requests.

License

MIT License


中文

一个开源的 openCursor 项目,主要实现了 Cursor Agent 的核心流程,方便大家学习和使用。本项目展示了 Cursor Agent 功能背后的基础工作流程。

🎯 特别说明: 本项目包括此 README.md 文件在内,完全由 Cursor 自动生成。程序员仅使用了对话面板,没有在编辑器中编写一行代码。这展示了AI驱动开发的强大能力,类似于 Claude Code 等标杆性CLI工具可能成为一种新的轻量级AI Coding交互方式。

🔧 技术细节: 本代码库使用的提示词和工具都是复刻自 Cursor 官方原生工具,提供了对原始 Cursor Agent 工作流程的真实还原。

功能特性

  • 🚀 开源实现: 完整实现 Cursor Agent 核心工作流程
  • 🤖 AI 集成: 默认集成 DeepSeek AI 模型
  • 🔧 简单配置: 简单的环境变量设置
  • 🌐 API 兼容: 支持 OpenAI API 兼容的模型
  • 📦 便携性: 单一二进制可执行文件
  • 💡 教育性: 非常适合学习 AI 代理工作流程

🎮 使用示例

看看 openCursor 的实际效果!以下展示如何用一条命令创建完整的贪吃蛇游戏:

openCursor "写一个贪吃蛇游戏,使用HTML和JavaScript。包含完整的游戏控制、计分系统和游戏结束功能。让它具有响应式设计且视觉效果良好。"

这个命令将生成一个完整的、可玩的贪吃蛇游戏,包括:

  • ✅ 带画布的HTML结构
  • ✅ JavaScript游戏逻辑
  • ✅ 键盘控制(WASD或方向键)
  • ✅ 分数追踪
  • ✅ 游戏结束检测
  • ✅ 响应式设计
  • ✅ 现代化样式

AI代理将创建所有必要的文件,为你提供一个可以立即在浏览器中运行的完全功能的游戏!

快速开始

1. 下载和安装

下载 openCursor 二进制文件并放到系统的 bin 目录:

# 下载二进制文件(请替换为实际下载地址)
wget https://github.com/your-username/openCursor/releases/latest/download/openCursor

# 添加执行权限
chmod +x openCursor

# 移动到系统 bin 目录
sudo cp openCursor /usr/local/bin/

# 现在可以在任意目录使用
openCursor --help

2. 配置

方式1:环境变量配置

如果你使用 zsh,添加到 ~/.zshrc 文件:

export OPENAI_API_KEY="你的-deepseek-api-密钥"

如果你使用 bash,添加到 ~/.bashrc 文件:

export OPENAI_API_KEY="你的-deepseek-api-密钥"

方式2:自定义模型配置

你也可以配置其他 OpenAI API 兼容格式的模型:

export OPENAI_API_KEY="你的-api-密钥"
export MODEL="deepseek-chat"
export BASE_URL="https://api.deepseek.com/v1"

3. 使用方法

# 基本用法
openCursor "你好,请介绍一下你自己"

# 编程助手
openCursor "写一个计算斐波那契数列的Python函数"

# 代码审查
openCursor "帮我审查这段代码,看看有什么改进建议"

获取 DeepSeek API 密钥

  1. 访问 DeepSeek 开放平台
  2. 注册并登录账户
  3. 前往 API 密钥管理页面
  4. 创建新的 API 密钥
  5. 复制密钥并配置到环境变量中

📖 详细的API文档和使用示例,请访问: DeepSeek API 文档

从源码构建

环境要求

  • Go 1.19+: 确保安装了 Go 1.19 或更高版本
  • Git: 用于克隆代码库
  • Make: 用于使用 Makefile(可选)

检查你的 Go 版本:

go version

克隆和构建

# 克隆代码库
git clone https://github.com/your-username/openCursor.git
cd openCursor

# 下载依赖
go mod download

# 构建项目
go build -o openCursor

# 或者使用 Make
make build

构建选项

标准构建:

go build -o openCursor

优化构建(更小的二进制文件):

go build -ldflags="-s -w" -o openCursor

调试构建:

go build -gcflags="all=-N -l" -o openCursor-debug

跨平台编译

为不同的操作系统和架构构建:

# Windows 64位
GOOS=windows GOARCH=amd64 go build -o openCursor.exe

# macOS 64位 (Intel)
GOOS=darwin GOARCH=amd64 go build -o openCursor-macos-intel

# macOS 64位 (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o openCursor-macos-arm

# Linux 64位
GOOS=linux GOARCH=amd64 go build -o openCursor-linux

# Linux ARM64
GOOS=linux GOARCH=arm64 go build -o openCursor-linux-arm64

使用 Makefile

项目包含一个 Makefile 用于常见任务:

# 构建项目
make build

# 为所有平台构建
make build-all

# 清理构建产物
make clean

# 运行测试
make test

# 安装到本地 bin 目录
make install

验证构建

构建完成后,验证二进制文件是否正常工作:

# 检查版本和帮助信息
./openCursor --help

# 使用简单查询测试(需要 API 密钥)
export OPENAI_API_KEY="你的-api-密钥"
./openCursor "你好,测试消息"

开发环境设置

开发工作的环境设置:

# 安装开发依赖
go mod download

# 使用 go run 运行(用于测试)
go run main.go "测试查询"

# 运行测试
go test ./...

# 格式化代码
go fmt ./...

# 检查问题
go vet ./...

项目结构

openCursor/
├── cmd/                 # 命令行界面
├── internal/            # 内部包
│   ├── client/         # AI 客户端实现
│   └── tools/          # 工具管理
├── main.go             # 应用程序入口
├── go.mod              # Go 模块定义
├── go.sum              # Go 模块校验和
├── Makefile            # 构建自动化
└── README.md           # 项目文档

贡献

欢迎贡献代码!请随时提交 issue 和 pull request。

许可证

MIT 许可证

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published