Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/dirty-cycles-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'cursor-tool': minor
'cursor-api': minor
---

chore: rename cursor-cli to cursor-tool
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This repository contains TypeScript libraries and tools for working with the Cur
This monorepo contains the following packages:

- [`cursor-api`](./packages/cursor-api/README.md): TypeScript library for interacting with the Cursor API
- [`cursor-cli`](./packages/cursor-cli/README.md): CLI tools for Cursor IDE
- [`cursor-tool`](./packages/cursor-tool/README.md): CLI tools for Cursor IDE

## Getting Started

Expand Down Expand Up @@ -55,7 +55,7 @@ pnpm get-token
cursor-api/
├── packages/
│ ├── cursor-api/ # Main API library
│ └── cursor-cli/ # CLI tools
│ └── cursor-tool/ # CLI tools
├── e2e/ # End-to-end tests
└── .github/ # GitHub workflows
```
Expand Down Expand Up @@ -87,7 +87,7 @@ To manually publish packages:
pnpm run release

# Publish a specific package
cd packages/cursor-cli
cd packages/cursor-tool
pnpm publish
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"type-check": "pnpm -r type-check",
"ci": "pnpm run lint && pnpm run type-check && pnpm run test:coverage && pnpm run build:verify",
"prepare": "husky || true",
"get-token": "pnpm --filter=cursor-cli start -- token"
"get-token": "pnpm --filter=cursor-tool start -- token"
},
"devDependencies": {
"@bufbuild/protobuf": "^2.5.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/cursor-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ main()

## Authentication

To use the Cursor API, you need an authentication token and checksum. You can obtain these using the `cursor-cli` tool:
To use the Cursor API, you need an authentication token and checksum. You can obtain these using the `cursor-tool` tool:

```bash
# Install the CLI tool
npm install -g cursor-cli
npm install -g cursor-tool

# Extract your token and checksum
cursor-cli token
cursor-tool token
```

For more details, see the [Authentication Guide](./docs/AUTHENTICATION.md).
Expand Down
10 changes: 5 additions & 5 deletions packages/cursor-api/docs/AUTHENTICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ The Cursor API requires two authentication parameters:
1. **API Key** (Token): A JWT token that authenticates your requests
2. **Checksum**: A validation string that includes your machine identifiers

## Using cursor-cli (Recommended)
## Using cursor-tool (Recommended)

The easiest way to get your authentication credentials is using the `cursor-cli` tool:
The easiest way to get your authentication credentials is using the `cursor-tool` tool:

```bash
# Install the CLI tool
npm install -g cursor-cli
npm install -g cursor-tool

# Extract your token and checksum
cursor-cli token
cursor-tool token
```

This will output your token and checksum, which you can use to initialize the API client.
Expand Down Expand Up @@ -105,7 +105,7 @@ const completion = await cursor.chat.completions.create({

If you encounter authentication issues:

1. **Token Expired**: Cursor tokens can expire. Extract a new token using `cursor-cli`.
1. **Token Expired**: Cursor tokens can expire. Extract a new token using `cursor-tool`.
2. **Invalid Checksum**: Make sure you're using the correct checksum that matches your machine IDs.
3. **Network Issues**: Ensure your network allows connections to Cursor API endpoints.

Expand Down
6 changes: 3 additions & 3 deletions packages/cursor-api/docs/QUICK_START.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ pnpm add cursor-api

## Authentication

To use the Cursor API, you need an authentication token and checksum. You can obtain these using the `cursor-cli` tool:
To use the Cursor API, you need an authentication token and checksum. You can obtain these using the `cursor-tool` tool:

```bash
# Install the CLI tool
npm install -g cursor-cli
npm install -g cursor-tool

# Extract your token and checksum
cursor-cli token
cursor-tool token
```

This will output your token and checksum, which you'll need to initialize the client.
Expand Down
28 changes: 15 additions & 13 deletions packages/cursor-api/scripts/debug-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ interface DebugConfig {
}

/**
* Get authentication credentials using cursor-cli
* Get authentication credentials using cursor-tool
*/
function getCredentialsFromCli(): { apiKey: string; checksum: string } | null {
try {
console.log('🔑 Trying to get credentials from cursor-cli...')
// Get the path to the cursor-cli package
const cliPath = join(__dirname, '../../../packages/cursor-cli')
console.log('🔑 Trying to get credentials from cursor-tool...')
// Get the path to the cursor-tool package
const cliPath = join(__dirname, '../../../packages/cursor-tool')

// Run the cursor-cli token command
// Run the cursor-tool token command
const output = execSync('pnpm start -- token', {
cwd: cliPath,
stdio: ['ignore', 'pipe', 'pipe'],
Expand All @@ -37,13 +37,13 @@ function getCredentialsFromCli(): { apiKey: string; checksum: string } | null {
if (tokenMatch && checksumMatch) {
const apiKey = tokenMatch[1]?.trim() ?? ''
const checksum = checksumMatch[1]?.trim() ?? ''
console.log('✅ Successfully retrieved credentials from cursor-cli')
console.log('✅ Successfully retrieved credentials from cursor-tool')
return { apiKey, checksum }
}

return null
} catch (error) {
console.error('❌ Failed to get credentials from cursor-cli:', error)
console.error('❌ Failed to get credentials from cursor-tool:', error)
return null
}
}
Expand All @@ -54,9 +54,9 @@ async function debugAuth(): Promise<void> {
let apiKey = process.env['CURSOR_API_KEY']
let checksum = process.env['CURSOR_CHECKSUM']

// If environment variables are not set, try to get credentials from cursor-cli
// If environment variables are not set, try to get credentials from cursor-tool
if (!apiKey || !checksum) {
console.log('⚠️ Missing environment variables, trying cursor-cli...')
console.log('⚠️ Missing environment variables, trying cursor-tool...')
const credentials = getCredentialsFromCli()
if (credentials) {
apiKey = credentials.apiKey
Expand Down Expand Up @@ -84,9 +84,11 @@ async function debugAuth(): Promise<void> {
console.log(' - CURSOR_CHECKSUM environment variable not set')
}
console.log()
console.log('Please set these environment variables or install cursor-cli:')
console.log('1. Install cursor-cli: npm install -g cursor-cli')
console.log('2. Run: cursor-cli token')
console.log(
'Please set these environment variables or install cursor-tool:'
)
console.log('1. Install cursor-tool: npm install -g cursor-tool')
console.log('2. Run: cursor-tool token')
console.log('3. Set environment variables:')
console.log(' export CURSOR_API_KEY="<token>"')
console.log(' export CURSOR_CHECKSUM="<checksum>"')
Expand Down Expand Up @@ -168,7 +170,7 @@ async function debugAuth(): Promise<void> {

console.log('\n🎯 Debug Summary:')
console.log(' - If authentication failed, double-check your credentials')
console.log(' - Try using cursor-cli to extract fresh credentials')
console.log(' - Try using cursor-tool to extract fresh credentials')
console.log(
' - For further help, create an issue with the debug output above'
)
Expand Down
20 changes: 10 additions & 10 deletions packages/cursor-api/scripts/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ interface VerificationResult {
}

/**
* Get authentication credentials using cursor-cli
* Get authentication credentials using cursor-tool
*/
function getCredentialsFromCli(): { apiKey: string; checksum: string } | null {
try {
console.log('🔑 Trying to get credentials from cursor-cli...')
// Get the path to the cursor-cli package
const cliPath = join(__dirname, '../../../packages/cursor-cli')
console.log('🔑 Trying to get credentials from cursor-tool...')
// Get the path to the cursor-tool package
const cliPath = join(__dirname, '../../../packages/cursor-tool')

// Run the cursor-cli token command
// Run the cursor-tool token command
const output = execSync('pnpm start -- token', {
cwd: cliPath,
stdio: ['ignore', 'pipe', 'pipe'],
Expand All @@ -34,13 +34,13 @@ function getCredentialsFromCli(): { apiKey: string; checksum: string } | null {
if (tokenMatch && checksumMatch) {
const apiKey = tokenMatch[1]?.trim() ?? ''
const checksum = checksumMatch[1]?.trim() ?? ''
console.log('✅ Successfully retrieved credentials from cursor-cli')
console.log('✅ Successfully retrieved credentials from cursor-tool')
return { apiKey, checksum }
}

return null
} catch (error) {
console.error('❌ Failed to get credentials from cursor-cli:', error)
console.error('❌ Failed to get credentials from cursor-tool:', error)
return null
}
}
Expand All @@ -52,7 +52,7 @@ async function verify(): Promise<void> {
let apiKey = process.env['CURSOR_API_KEY']
let checksum = process.env['CURSOR_CHECKSUM']

// If environment variables are not set, try to get credentials from cursor-cli
// If environment variables are not set, try to get credentials from cursor-tool
if (!apiKey || !checksum) {
const credentials = getCredentialsFromCli()
if (credentials) {
Expand All @@ -64,8 +64,8 @@ async function verify(): Promise<void> {
if (!apiKey) {
console.error('❌ CURSOR_API_KEY environment variable not set')
console.log('\n📋 To get your API key:')
console.log('1. Install cursor-cli: npm install -g cursor-cli')
console.log('2. Run: cursor-cli token')
console.log('1. Install cursor-tool: npm install -g cursor-tool')
console.log('2. Run: cursor-tool token')
console.log('3. Set environment variables:')
console.log(' export CURSOR_API_KEY="<token>"')
console.log(' export CURSOR_CHECKSUM="<checksum>"')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cursor-cli
# cursor-tool

## 2.0.0

Expand Down
12 changes: 6 additions & 6 deletions packages/cursor-cli/README.md → packages/cursor-tool/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cursor CLI
# Cursor Tool

Command-line tools for Cursor IDE.

Expand All @@ -11,13 +11,13 @@ Command-line tools for Cursor IDE.
### Global Installation

```bash
npm install -g cursor-cli
npm install -g cursor-tool
```

### Local Installation

```bash
npm install cursor-cli
npm install cursor-tool
```

## Usage
Expand All @@ -26,16 +26,16 @@ npm install cursor-cli

```bash
# If installed globally
cursor-cli token
cursor-tool token

# If installed locally
npx cursor-cli token
npx cursor-tool token
```

### Programmatic Usage

```typescript
import { getCursorTokenInfo } from 'cursor-cli'
import { getCursorTokenInfo } from 'cursor-tool'

const tokenInfo = getCursorTokenInfo()
console.log(tokenInfo.token)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "cursor-cli",
"name": "cursor-tool",
"version": "2.0.0",
"description": "CLI tools for Cursor IDE",
"author": "xwartz",
"license": "MIT",
"bin": {
"cursor-cli": "./bin/index.js"
"cursor-tool": "./bin/index.js"
},
"scripts": {
"start": "tsx src/index.ts",
Expand Down Expand Up @@ -34,7 +34,7 @@
"repository": {
"type": "git",
"url": "https://github.com/xwartz/cursor-api",
"directory": "packages/cursor-cli"
"directory": "packages/cursor-tool"
},
"engines": {
"node": ">=18.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ function tokenCommand() {
function showHelp() {
console.log('Cursor CLI - Command-line tools collection\n')
console.log('Usage:')
console.log(' cursor-cli [command]')
console.log(' cursor-tool [command]')
console.log('\nCommands:')
console.log(' token Extract Cursor Token information')
console.log(' help Show help information')
console.log('\nExamples:')
console.log(' cursor-cli token')
console.log(' cursor-cli help')
console.log(' cursor-tool token')
console.log(' cursor-tool help')
}

/**
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.