Skip to content

Repository files navigation

StarCode CLI

starcode.help

version rust edition license platform

A powerful conversational AI CLI tool with text editor capabilities, built in Rust

FeaturesInstallationQuick StartConfigurationCommandsContributingLicense


Features

  • TPS is fast
  • Rust is fast
  • copy by claude code
  • 100% rust code
  • Multi-Provider AI Support - Connect to OpenAI, Anthropic, and other OpenAI-compatible APIs
  • Interactive TUI - Beautiful terminal user interface with real-time streaming
  • Tool Integration - Execute commands, edit files, and interact with your codebase
  • MCP Protocol - Model Context Protocol support for extensible toolchains
  • Git Integration - AI-assisted git operations with intelligent suggestions
  • Smart Search - Fast code search using ripgrep with AST-aware chunking
  • Syntax Highlighting - Beautiful code highlighting with multiple themes
  • Session Management - Save, resume, and manage conversation sessions
  • Internationalization - Multi-language support (English, Chinese)
  • Permission System - Fine-grained control over tool execution permissions
  • Headless Mode - Process prompts without interactive UI for scripting
  • Cross-Platform - Works on Linux, macOS, and Windows

What Can It Do?

StarCode CLI is your AI-powered coding assistant that can:

  • Read and understand your entire codebase
  • Edit files with intelligent suggestions and diff previews
  • Execute commands in a sandboxed environment
  • Search code using regex, glob patterns, or AST-aware search
  • Manage Git operations with AI assistance
  • Work with MCP servers for extensible functionality
  • Resume sessions to continue where you left off
  • Process prompts in headless mode for automation

Installation

From Source (Recommended)

# Clone the repository
git clone https://github.com/xyz1o2/starcode-cli.git
cd starcode-cli

# Build and install into ~/.cargo/bin
./install.sh          # Windows: .\install.ps1

install.sh installs one binary and adds two command aliases, so any of these starts the same program:

sc              # short form
starcode
starcode-cli

To build by hand instead — note this only gives you the starcode-cli name:

cargo build --release
cp target/release/starcode-cli /usr/local/bin/

Using Cargo

# Install directly from the repository
cargo install --git https://github.com/xyz1o2/starcode-cli.git starcode-cli

Pre-built Binaries

Download the latest release for your platform from the Releases page.

Quick Start

1. Set up your API key

# Option 1: Environment variable
export STAR_API_KEY="your-api-key"

# Option 2: Create a .env file
echo "STAR_API_KEY=your-api-key" > .env

2. Start the interactive session

# Start interactive mode
sc

# Or with an initial message
sc "Explain the structure of this project"

3. Use headless mode for scripting

# Process a single prompt
sc -p "What files are in the current directory?"

# With specific output format
sc -p "List all Rust files" --output-format text

Configuration

Environment Variables

# API Configuration
STAR_API_KEY=your-api-key          # Required: Your API key
STAR_BASE_URL=https://api.openai.com/v1  # Optional: Custom API base URL

# Model Configuration
STAR_MODEL=gpt-4                   # Optional: Default model to use

Configuration File

Create ~/.star/user-settings.json:

{
  "apiKey": "your-api-key",
  "model": "gpt-4",
  "baseUrl": "https://api.openai.com/v1",
  "temperature": 0.2,
  "maxTokens": 8192
}

Project Configuration

StarCode looks for STAR.md in your project root for project-specific instructions:

# Project: My Awesome Project

## Build Commands
- `cargo build` - Build the project
- `cargo test` - Run tests

## Code Style
- Use snake_case for variables
- Add doc comments for public functions

## Architecture
- Main entry point: src/main.rs
- Core logic: src/core/

Commands

Interactive Mode

# Start interactive session
starcode

# With working directory
starcode -d /path/to/project

# Resume a session
starcode --resume
starcode --resume <session-id>

# Skip permission prompts (use with caution!)
starcode --dangerously-skip-permissions

Headless Mode

# Process a prompt and exit
starcode -p "Your prompt here"

# With specific output format
starcode -p "Your prompt" --output-format jsonl
starcode -p "Your prompt" --output-format text

Subcommands

# Initialize a new project with STAR.md
starcode init

# MCP server management
starcode mcp add <server-name> <command>
starcode mcp remove <server-name>
starcode mcp list

# Git operations with AI assistance
starcode git commit
starcode git diff
starcode git status

Permission Modes

# Default mode - asks for permission
starcode --permission-mode default

# Plan mode - read-only operations only
starcode --permission-mode plan

# YOLO mode - bypass all permissions (dangerous!)
starcode --permission-mode yolo

Available Tools

StarCode CLI comes with a comprehensive set of built-in tools:

  • Read - Read file contents with line numbers
  • Write - Create or overwrite files
  • Edit - Make precise file edits
  • Bash - Execute shell commands
  • Grep - Search files using ripgrep
  • Glob - Find files by pattern
  • Agent - Spawn sub-agents for complex tasks
  • WebFetch - Fetch and analyze web pages

MCP Support

StarCode supports the Model Context Protocol (Model Context Protocol) for extending its capabilities:

# Add an MCP server
starcode mcp add filesystem "npx -y @modelcontextprotocol/server-filesystem /path/to/directory"

# List configured servers
starcode mcp list

# Remove a server
starcode mcp remove filesystem

Development

Building from Source

# Clone the repository
git clone https://github.com/xyz1o2/starcode-cli.git
cd starcode-cli

# Debug build
cargo build

# Release build
cargo build --release

# Run tests
cargo test

# Run with logging
RUST_LOG=debug cargo run

Project Structure

starcode/
├── starcode-cli/
│   ├── src/
│   │   ├── main.rs          # Entry point
│   │   ├── agent/           # AI agent logic
│   │   ├── commands/        # CLI commands
│   │   ├── core/            # Core functionality
│   │   ├── llm/             # LLM integration
│   │   ├── runtime/         # Runtime environment
│   │   ├── tools/           # Built-in tools
│   │   ├── types/           # Type definitions
│   │   ├── ui/              # Terminal UI
│   │   └── utils/           # Utilities
│   ├── eval/                # Evaluation harness
│   ├── i18n/                # Internationalization
│   └── Cargo.toml           # Rust dependencies
├── README.md
└── LICENSE

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Evaluation

StarCode includes a built-in evaluation harness for testing AI capabilities:

# Run the evaluation suite
starcode eval --tasks eval/tasks.json

# Run with multiple trials
starcode eval --tasks eval/tasks.json --trials 3

# Generate markdown report
starcode eval --tasks eval/tasks.json --report-md eval-report.md

# Compare against baseline
starcode eval --baseline .star/eval-baseline.json

Troubleshooting

Common Issues

API Key not found

# Check if environment variable is set
echo $STAR_API_KEY

# Or verify the config file exists
cat ~/.star/user-settings.json

Build fails

# Make sure you have Rust installed
rustc --version

# Update Rust toolchain
rustup update

# Clean and rebuild
cargo clean && cargo build --release

Permission denied

# Make sure the binary is executable
chmod +x target/release/starcode-cli

# Or install to a directory in your PATH
sudo cp target/release/starcode-cli /usr/local/bin/

Changelog

v0.3.0 (Latest)

  • Added MCP (Model Context Protocol) support
  • Improved session management
  • Added Git integration commands
  • Performance optimizations
  • Bug fixes and stability improvements

v0.2.0

  • Added headless mode
  • Multi-provider support
  • Internationalization (i18n)
  • Permission system

v0.1.0

  • Initial release
  • Interactive TUI
  • Basic tool integration
  • File operations

Support

Acknowledgments


Made by xyz1o2

Stars Forks

About

Blazing-fast AI coding assistant in your terminal, built with Rust

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages