RoriCode

command module
v0.0.0-...-a489972 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

README ΒΆ

RoriCode - Another Terminal Coding Agent

RoriCode is a powerful terminal-based coding assistant that brings the power of AI directly to your command line. Built with Go, it provides a streamlined console interface with advanced features for developers who prefer working in terminal environments.

πŸš€ Overview

RoriCode is designed for developers who want a lightweight, efficient coding assistant that lives directly in their terminal. It combines the power of OpenAI's API with a suite of built-in tools to help you code, explore files, and execute commands - all without leaving your terminal.

✨ Key Features

πŸ’¬ AI-Powered Chat Interface
  • Direct integration with OpenAI's GPT models
  • Markdown rendering for rich text responses
  • Real-time conversation flow with streaming responses
πŸ› οΈ Built-in Tools System

RoriCode comes with several built-in tools that extend the AI's capabilities:

  • Shell Commands, File Operations, Time Utilities, Directory Browsing
  • See Built-in Tools section for detailed information
🎨 Enhanced Terminal Experience
  • Color-coded Messages: Different message types with distinct styling
  • Smart Status Management: Dynamic status bar with automatic clearing/restoring
  • Terminal Integration: Full support for scrolling and terminal history
  • Real-time Tool Display: Immediate visualization of tool calls and results
βš™οΈ Profile-based Configuration
  • Multiple API profiles for different providers (OpenAI, local models, etc.)
  • JSON-based configuration management
  • Easy profile switching and management via CLI commands
πŸ—οΈ Technical Architecture
  • Event-driven Design: Clean separation between UI, business logic, and AI service
  • Resource Optimized: Incremental message transmission to reduce bandwidth
  • Extensible Tool System: Easy registration of custom tools
  • Error Resilience: Circuit breaker pattern and graceful error handling

πŸ“¦ Installation

Prerequisites
  • Go 1.24.4 or later: RoriCode is built with Go. Download from golang.org
  • Git: For cloning the repository
  • OpenAI API Key: Sign up at OpenAI to get your API key
# Clone the repository
git clone https://github.com/Rorical/RoriCode.git
cd RoriCode

# Download dependencies
go mod tidy

# Build for your platform
go build -o roricode main.go
Method 2: Direct Installation with Go

If you have Go installed, you can install directly:

go install github.com/Rorical/RoriCode@latest
Method 3: Cross-Platform Builds

Build for different platforms:

# Windows
GOOS=windows GOARCH=amd64 go build -o roricode.exe main.go

# macOS (Intel)
GOOS=darwin GOARCH=amd64 go build -o roricode-mac-intel main.go

# macOS (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o roricode-mac-arm main.go

# Linux
GOOS=linux GOARCH=amd64 go build -o roricode-linux main.go
Installing to System PATH

To use roricode from anywhere:

On Windows:

# Copy to a directory in your PATH, or add current directory to PATH
copy roricode.exe C:\Windows\System32\

On macOS/Linux:

# Copy to /usr/local/bin (requires sudo)
sudo cp roricode /usr/local/bin/

# Or copy to ~/bin and add to PATH
cp roricode ~/bin/
echo 'export PATH=$PATH:~/bin' >> ~/.bashrc  # or ~/.zshrc
Development Installation

For development purposes:

# Or run directly
go run main.go

πŸš€ Quick Start

Verify Installation

After installation, verify RoriCode is working:

# Check if the binary is accessible
roricode --help

# Test the application (will prompt for profile setup on first run)
roricode

If you encounter any issues, see the Troubleshooting section below.

  1. Configure your API key:

    # Add a new profile
    roricode profile add default
    
    # The tool will prompt for your OpenAI API key and other settings
    
  2. List and manage profiles:

    # List all profiles
    roricode profile list
    
    # Show specific profile details
    roricode profile show default
    
  3. Start chatting:

    # Run the application
    roricode
    

🎯 Message Types

  • Program Messages (Purple): Welcome messages and system information
  • User Messages (Blue): Your input with a left border
  • Assistant Messages (Orange): AI responses with markdown rendering
  • Tool Calls (Red): Tool invocation requests with name and arguments
  • Tool Results (Green): Results from executed tools

πŸ› οΈ Built-in Tools

Shell Tool (shell)

Execute shell commands with safety features:

  • User confirmation for potentially dangerous commands
  • Timeout control for command execution
  • Error handling and exit code reporting
File Read Tool (read_file)

Read file contents with advanced filtering:

  • Read specific line ranges
  • Search with regex patterns and context lines
  • Directory listing with file information
  • Security protection against directory traversal
File Edit Tool (edit_file)

Modify existing files using git diff format:

  • Apply unified diff patches to files
  • Context-aware editing for accuracy
File Creation Tool (create_file)

Create new files with content:

  • Write content to new files
  • Overwrite protection
Current Time Tool (current_time)

Get current date and time information:

  • Various time format options

⌨️ Key Bindings

  • Enter: Send message to AI
  • Ctrl+C / q / quit / exit: Quit the application
  • Any text: Direct console input

πŸ“ Configuration

Configuration is stored in ~/.roricode/config.json:

{
  "active_profile": "default",
  "profiles": {
    "default": {
      "api_key": "your-api-key",
      "base_url": "https://api.openai.com/v1",
      "model": "gpt-4o-mini"
    }
  }
}

πŸ§ͺ Development

# Run tests
go test ./...

# Update dependencies (also used in installation)
# See Installation section for build and run instructions

πŸ—οΈ Architecture Overview

RoriCode/
β”œβ”€β”€ main.go                 # Application entry point
β”œβ”€β”€ cmd/                    # CLI commands
β”‚   β”œβ”€β”€ root.go            # Main command
β”‚   β”œβ”€β”€ profile.go         # Profile management
β”‚   └── use.go             # Profile switching
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ app/               # Application lifecycle and UI
β”‚   β”œβ”€β”€ config/            # Configuration management
β”‚   β”œβ”€β”€ core/              # Core service and state management
β”‚   β”œβ”€β”€ dispatcher/        # Event dispatching
β”‚   β”œβ”€β”€ eventbus/          # Event bus system
β”‚   β”œβ”€β”€ models/            # Data models
β”‚   β”œβ”€β”€ tools/             # Built-in tools and registry
β”‚   └── utils/             # Utility functions

🌟 Benefits

  • Terminal Native: Works seamlessly with your existing terminal workflow
  • Lightweight: No heavy GUI frameworks, minimal resource usage
  • Extensible: Easy to add new tools and capabilities
  • Secure: Built-in protections against dangerous operations
  • Customizable: Multiple profiles for different use cases
  • Real-time: Immediate feedback for tool operations

🀝 Contributing

πŸ”§ Troubleshooting

Common Issues

"roricode: command not found"

  • Make sure the binary is in your system PATH
  • Try running with full path to the executable
  • Verify the build was successful

"API key not configured"

  • Run roricode profile add default to set up your first profile
  • Ensure your OpenAI API key is valid and has sufficient credits
  • Check your internet connection

"Permission denied" on macOS/Linux

  • Make the binary executable: chmod +x roricode
  • On macOS, you may need to allow the app in Security & Privacy settings

Build errors

  • Ensure you have Go 1.24.4 or later: go version
  • Run go mod tidy to download dependencies
  • Clear Go module cache: go clean -modcache

"Tool execution failed"

  • Check file permissions for file operations
  • Ensure you have necessary system permissions for shell commands
  • Some operations may require confirmation prompts

For other issues, please check the GitHub Issues or create a new issue.

Contributions are welcome! Feel free to submit issues, feature requests, or pull requests to help improve RoriCode.

πŸ“„ License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
internal
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL