Skip to content

alchemy-labs-co/riptide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Riptide

A powerful AI coding assistant powered by DeepSeek's reasoning models, featuring a beautiful terminal UI built with Bubble Tea.

Go Version License

Features

  • πŸš€ Chain-of-Thought Reasoning - Watch the AI think through problems step-by-step
  • πŸ“ File Operations - Read, create, and edit files directly through function calls
  • 🎨 Beautiful TUI - Built with Charm's Bubble Tea framework
  • πŸ“ Smart Context Management - Add files and directories to conversation context
  • πŸ”„ Streaming Responses - Real-time streaming of AI responses
  • πŸ›‘οΈ Security Features - Path validation and file size limits
  • πŸ’° Token Usage Tracking - Real-time cost estimation based on DeepSeek pricing
  • 🎯 Extensible Architecture - Well-structured codebase for easy modifications

Installation

Prerequisites

From Source

git clone https://github.com/alchemy-labs-co/riptide.git
cd riptide
make build

Using Go Install

go install github.com/alchemy-labs-co/riptide@latest

Configuration

Environment Variables

Set your DeepSeek API key:

export DEEPSEEK_API_KEY=your_api_key_here

Configuration File

Create a config.json file (optional):

{
  "api": {
    "base_url": "https://api.deepseek.com/v1",
    "model": "deepseek-reasoner",
    "max_completion_tokens": 8192,
    "timeout_seconds": 300
  },
  "ui": {
    "enable_emoji": true,
    "theme": "default",
    "max_history_messages": 15
  },
  "file_operations": {
    "max_file_size": 1048576,
    "allowed_extensions": [".go", ".py", ".js", ".ts", ".json", ".md", ".txt"]
  },
  "scanner": {
    "exclude_patterns": [
      "node_modules",
      ".git",
      "__pycache__",
      "*.pyc",
      ".env"
    ]
  }
}

Usage

Basic Usage

./riptide

Commands

  • /add <path> - Add a file or directory to the conversation context
  • /clear - Clear the conversation history
  • /config - Open configuration menu to adjust settings
  • /help - Show help information
  • quit - Exit the application
  • Ctrl+C - Cancel streaming or force quit
  • PgUp/PgDown - Scroll conversation history
  • ↑/↓ - Navigate autocomplete suggestions (when typing commands)

Example Workflow

  1. Start the application:

    ./riptide
  2. Add files to context:

    /add main.go
    /add src/
    
  3. Ask questions or request changes:

    Can you help me optimize the database queries in this code?
    
  4. The AI can directly read and modify files:

    Please add error handling to the fetchUser function
    

Function Capabilities

Riptide can perform the following file operations:

  • read_file - Read a single file's content
  • read_multiple_files - Read multiple files at once
  • create_file - Create new files or overwrite existing ones
  • create_multiple_files - Create multiple files in one operation
  • edit_file - Make precise edits using find-and-replace

Architecture

riptide/
β”œβ”€β”€ main.go                 # Entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ api/               # DeepSeek API client
β”‚   β”‚   β”œβ”€β”€ client.go      # API client implementation
β”‚   β”‚   └── types.go       # API type definitions
β”‚   β”œβ”€β”€ config/            # Configuration management
β”‚   β”‚   └── config.go      # Config loading and validation
β”‚   β”œβ”€β”€ conversation/      # Conversation history
β”‚   β”‚   └── history.go     # Token tracking and history management
β”‚   β”œβ”€β”€ functions/         # File operations
β”‚   β”‚   β”œβ”€β”€ file_ops.go    # File read/write operations
β”‚   β”‚   β”œβ”€β”€ scanner.go     # Directory scanning utilities
β”‚   β”‚   └── security.go    # Path validation and security
β”‚   └── ui/                # Terminal UI components
β”‚       β”œβ”€β”€ model.go       # Core state management (MVC pattern)
β”‚       β”œβ”€β”€ render.go      # UI rendering logic
β”‚       β”œβ”€β”€ styles.go      # Centralized styling definitions
β”‚       β”œβ”€β”€ stream.go      # Stream handling and updates
β”‚       β”œβ”€β”€ commands.go    # Command definitions and autocomplete
β”‚       └── config_menu.go # Configuration menu implementation
β”œβ”€β”€ docs/                   # Documentation
β”‚   β”œβ”€β”€ DEVELOPMENT_NOTES.md # Architectural decisions and lessons
β”‚   └── TASKS.md           # Feature and bug tracking
β”œβ”€β”€ .riptide/             # Riptide specific settings
β”‚   β”œβ”€β”€ settings.json      # Project settings
β”‚   β”œβ”€β”€ AGENTS.md          # Agent definitions
β”‚   └── projects/          # Sub-project configurations
β”œβ”€β”€ config.json            # Configuration file (optional)
β”œβ”€β”€ go.mod                 # Go module definition
β”œβ”€β”€ go.sum                 # Go dependencies lock file
└── Makefile              # Build automation

Performance

  • Streaming responses for real-time interaction
  • Efficient file scanning with pattern matching
  • Concurrent file operations
  • Minimal memory footprint
  • Real-time token usage and cost tracking

Security

  • Path traversal protection
  • File size limits
  • Configurable file extension filtering
  • No execution of arbitrary commands
  • Binary file detection and exclusion

Feature Parity with Python Version

This Go implementation maintains complete feature parity with the original Python version:

βœ… Core Features

  • DeepSeek API integration with streaming
  • Chain-of-thought reasoning display
  • All 5 file operation functions
  • /add command for context management
  • /clear command
  • /help command
  • Conversation history management
  • File security and validation

βœ… UI Features

  • Real-time streaming display
  • Colored output and formatting
  • Emoji support (configurable)
  • Scrollable conversation view
  • Status indicators (Ready/Seeking/Processing)
  • Token and cost tracking

βœ… Additional Features in Go Version

  • Single binary distribution - No Python/dependencies needed
  • Better performance - Compiled language advantages
  • Type safety - Compile-time error checking
  • Concurrent operations - Leverages Go's goroutines
  • Modern TUI - Reactive UI with Bubble Tea
  • Command Autocomplete - Smart command suggestions with dropdown
  • Configuration Menu - Interactive settings adjustment via /config
  • Off-Peak Pricing - Automatic cost calculation with 75% discount during off-peak hours

Building

# Build for current platform
make build

# Build for all platforms
make build-all

# Run tests
make test

# Clean build artifacts
make clean

Troubleshooting

Common Issues

  1. API Key Not Found

    export DEEPSEEK_API_KEY=your_api_key_here
  2. Connection Errors

    • Check your internet connection
    • Verify API endpoint in config.json
    • Ensure your API key is valid
  3. UI Display Issues

    • Ensure terminal supports Unicode
    • Try resizing terminal window
    • Disable emoji in config if needed

License

MIT License - see LICENSE file for details.

β€œβ€

Acknowledgments

About

The Open Source Claude Code Alternative

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published