Skip to main content

XandAI - Multi-Provider AI Terminal Assistant with Interactive Code Execution

Project description

XandAI CLI

Tests PyPI version License: MIT

Terminal assistant that combines AI chat with command execution. Supports Ollama and LM Studio.

Installation

pip install xandai-cli
xandai --auto-detect

Usage

# Terminal commands
xandai> ls -la
xandai> git status

# AI questions  
xandai> How do I optimize this code?

# Natural conversation for any task
xandai> create a REST API with authentication

Providers

  • Ollama - Local models
  • LM Studio - GUI-based model management
xandai --provider ollama
xandai --provider lm_studio --endpoint http://localhost:1234

Commands

/agent <instruction>  # Multi-step LLM orchestrator for complex tasks
/set-agent-limit <n>  # Set max LLM calls (default: 20, max: 100)
/review               # AI-powered code review
/web on               # Enable web content integration
/help                 # Show all commands
/clear                # Clear history
/status               # System status

Agent Mode 🤖

The /agent command is a powerful multi-step LLM orchestrator that chains multiple AI calls to handle complex tasks:

# Fix code with systematic analysis
/agent fix the bug in main.py where the loop never terminates

# Complex refactoring
/agent refactor this monolithic code into modular components

# Detailed explanations
/agent explain how the authentication system works

Pipeline stages:

  1. Intent Analysis - Classifies the task type
  2. Context Gathering - Identifies needed information
  3. Task Execution - Performs the main work
  4. Validation - Verifies output quality
  5. Refinement - Improves based on validation (if needed)

When to use /agent:

  • Complex multi-step tasks
  • Code requiring analysis and validation
  • Tasks needing structured reasoning
  • When quality matters more than speed

See example/agent_demo.md for detailed examples.

Note: The /task command has been deprecated. Use natural conversation instead for better results.

File Operations

XandAI can intelligently create and edit files with AI assistance:

Creating Files

Simply ask to create a file with a specific name:

xandai> create tokens.py with authentication functions
# AI generates complete code
# System detects filename automatically
This looks like a complete python file. Save it? (y/N): y
Filename: tokens.py
File 'tokens.py' created successfully!

Editing Files

Edit existing files by name:

xandai> edit index.py adding a health endpoint
# AI reads current file content
# Generates complete updated version
Edit file 'index.py'? (y/N): y
File 'index.py' updated successfully!

Smart Detection

The AI automatically:

  • Reads files when editing (preserves existing code)
  • Extracts filenames from your request
  • Provides complete file content (never placeholders)
  • Only prompts when you explicitly request file operations

Supported Formats

Works with any programming language:

xandai> create app.js with Express server
xandai> edit styles.css adding dark mode
xandai> create config.json with API settings

Code Execution

XandAI can detect and execute code in various languages:

xandai> create a math.py that will receive two args and sum them
# AI generates complete Python script with argument handling
This looks like a complete python file. Save it? (y/N): y
Filename: math.py
File 'math.py' created successfully!

xandai> python math.py 2 2
$ python math.py 2 2
2.0 + 2.0 = 4.0
Command completed successfully

Features:

  • Automatic code detection for Python, JavaScript, Bash, and more
  • Interactive execution mode for scripts requiring input
  • Non-interactive capture mode for automation
  • Smart prompts for user choice between modes

Code Review

AI-powered code review with Git integration. Analyzes your code changes and provides detailed feedback on security, quality, and best practices.

xandai> /review
# Automatically detects Git changes and provides comprehensive analysis

Code Review Example

Web Integration

Automatically fetches and analyzes web content when you paste links:

xandai> /web on
xandai> How does this work? https://docs.python.org/tutorial
# Content is automatically fetched and analyzed

Development

git clone https://github.com/XandAI-project/Xandai-CLI.git
cd Xandai-CLI
pip install -e .
xandai

License

MIT

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

xandai_cli-2.1.10.tar.gz (6.1 MB view details)

Uploaded Source

Built Distribution

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

xandai_cli-2.1.10-py3-none-any.whl (244.0 kB view details)

Uploaded Python 3

File details

Details for the file xandai_cli-2.1.10.tar.gz.

File metadata

  • Download URL: xandai_cli-2.1.10.tar.gz
  • Upload date:
  • Size: 6.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for xandai_cli-2.1.10.tar.gz
Algorithm Hash digest
SHA256 3738ab1d6e5e948f75625a1656d89a0b97858f99288dc9ce0a3b597f18613c2b
MD5 95b5982770076d92611cf5e933bd9498
BLAKE2b-256 5a62c4de736f803c6dc82975dd2314928bce734a2371ce02b97c20ac59d6254d

See more details on using hashes here.

File details

Details for the file xandai_cli-2.1.10-py3-none-any.whl.

File metadata

  • Download URL: xandai_cli-2.1.10-py3-none-any.whl
  • Upload date:
  • Size: 244.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for xandai_cli-2.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 039c75e9cfc1cfcaa39e9818c5e30030e6f21cbc16f2912b48af084376275113
MD5 4db8523f4c38542f4954e2a02282d371
BLAKE2b-256 acd610e43bc6f725e4f6c3ac91bb9c6a79fcbdef05749d0ffa5e7331dec1a9da

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