Skip to main content

Native CLI client for DurusAI - AI-powered development assistant

Project description

DurusAI Native CLI

🤖 Native CLI client for DurusAI - AI-powered development assistant

Python 3.8+ License: MIT PyPI version

Features

  • 🔐 Secure authentication with JWT tokens and keyring storage
  • 💬 Interactive chat mode with AI models (Claude, GPT-4, Gemini)
  • 🚀 Single command queries for quick AI assistance
  • 📊 Usage statistics and token tracking
  • 🔧 Multiple AI models support
  • 🎨 Rich terminal UI with markdown rendering
  • ⚙️ Configurable profiles for different environments
  • 🌐 Cross-platform (Linux, macOS, Windows)

Installation

From PyPI (Recommended)

pip install durusai

From source

git clone https://github.com/durusai/cli.git
cd cli/durusai_native_cli
pip install -e .

Development installation

pip install -e ".[dev]"

Quick Start

1. Login to DurusAI

durusai login

2. Ask a question

durusai query "Explain Python decorators"

3. Start interactive chat

durusai chat

Usage

Authentication

# Login with username/password
durusai login

# Login with specific profile
durusai login --profile work

# Check current user
durusai whoami

# Logout
durusai logout

Queries

# Single query
durusai query "How to implement binary search in Python?"

# Query with specific model
durusai query "Explain async/await" --model gpt-4

# Query with custom parameters  
durusai query "Write a FastAPI endpoint" --max-tokens 2000 --temperature 0.7

Interactive Mode

# Start interactive chat
durusai chat

# Chat with specific model
durusai chat --model claude-3-sonnet

Interactive commands:

  • /help - Show help
  • /model <name> - Switch AI model
  • /clear - Clear conversation history
  • /history - Show conversation history
  • /stats - Show session statistics
  • /quit - Exit chat mode

Models and Statistics

# List available models
durusai models

# Show usage statistics
durusai stats

# Check API health
durusai health

Configuration

# Show all settings
durusai config --list

# Set API endpoint
durusai config api_endpoint "https://api.durusai.com"

# Set default model
durusai config settings.default_model "claude-3-sonnet"

# Enable streaming responses
durusai config settings.stream_responses true

Configuration

DurusAI CLI stores configuration in ~/.durusai/:

~/.durusai/
├── config.json         # Main configuration
├── profiles/           # User profiles  
│   ├── default.json
│   └── work.json
├── cache/             # Response cache
├── history/           # Command history
└── logs/             # Application logs

Configuration Options

{
  "api_endpoint": "https://api.durusai.com",
  "default_profile": "default",
  "settings": {
    "timeout": 30,
    "retry_count": 3,
    "stream_responses": true,
    "cache_ttl": 3600,
    "auto_update": true,
    "show_token_usage": true,
    "default_model": "claude-3-sonnet-20240229",
    "max_history_size": 1000
  },
  "display": {
    "use_colors": true,
    "show_timestamps": false,
    "markdown_rendering": true,
    "pager_enabled": true
  }
}

API Models

DurusAI supports multiple AI providers:

Model Provider Context Length Status
claude-3-sonnet-20240229 Anthropic 200K
claude-3-haiku-20240307 Anthropic 200K
gpt-4 OpenAI 8K
gpt-4-turbo OpenAI 128K
gemini-pro Google 32K

Examples

Code Generation

durusai query "Create a REST API endpoint for user registration with FastAPI"

Code Explanation

durusai query "Explain this Python code" < my_script.py

Interactive Debugging

durusai chat
# Then in chat:
# User: I'm getting a TypeError in my Python code
# AI: I'd be happy to help! Please share the error and the relevant code...

Batch Processing

# Process multiple files
for file in *.py; do
  durusai query "Review this code for bugs: $(cat $file)" > "${file%.py}_review.md"
done

Environment Variables

  • DURUSAI_API_ENDPOINT - API endpoint URL
  • DURUSAI_API_TOKEN - API authentication token
  • DURUSAI_CONFIG_DIR - Configuration directory (default: ~/.durusai)
  • DURUSAI_PROFILE - Default profile name

Security

  • Tokens are stored securely using system keyring (macOS Keychain, Windows Credential Manager, Linux Secret Service)
  • Fallback encryption using Fernet for systems without keyring
  • No plaintext passwords stored locally
  • JWT tokens with automatic refresh
  • TLS/SSL for all API communications

Development

Setup

git clone https://github.com/durusai/cli.git
cd cli/durusai_native_cli
pip install -e ".[dev]"

Testing

pytest

Code formatting

black durusai/
flake8 durusai/
mypy durusai/

Building

python -m build

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Run the test suite
  6. Create a pull request

License

MIT License - see LICENSE file.

Support

Changelog

See CHANGELOG.md for release history.


Made with ❤️ by the DurusAI team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

durusai_cli-1.2.0.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

durusai_cli-1.2.0-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file durusai_cli-1.2.0.tar.gz.

File metadata

  • Download URL: durusai_cli-1.2.0.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for durusai_cli-1.2.0.tar.gz
Algorithm Hash digest
SHA256 76d2ea1f0a7095de48a5855b1e3e0c40680c7fe096d2b9fd1ab3107b4bb96a8d
MD5 11f4baede9786672776debd4f2cd9307
BLAKE2b-256 8c993e8b9b363dc4db103579a578863e565a74f0f5976f0588647ced89c8c016

See more details on using hashes here.

File details

Details for the file durusai_cli-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: durusai_cli-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for durusai_cli-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db6c0c9f3d854fb3e031cf7ccc181282a928eca590a313e228597f4999645287
MD5 fc785da79278b02e878d978b64e63fea
BLAKE2b-256 45d2e72f8937d083038af6f1b60a9d35ae43c011407d354e6beb18831c9f0e01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page