ChatX 1.0.0-alpha-20250421.1
dotnet tool install --global ChatX --version 1.0.0-alpha-20250421.1
dotnet new tool-manifest
dotnet tool install --local ChatX --version 1.0.0-alpha-20250421.1
#tool dotnet:?package=ChatX&version=1.0.0-alpha-20250421.1&prerelease
nuke :add-package ChatX --version 1.0.0-alpha-20250421.1
ChatX - AI-powered CLI
ChatX is a command-line interface (CLI) application that provides a chat-based interaction with AI assistants. Built in C#, it leverages AI chat models from multiple providers with function calling capabilities to create a powerful tool for AI-assisted command-line operations.
Features
- Interactive AI Chat: Have conversations with an AI assistant directly in your terminal
- Multiple AI Providers: Support for OpenAI, Azure OpenAI, and GitHub Copilot APIs
- Provider Selection: Easily switch between different AI providers or use profiles
- Function Calling: Allow the AI assistant to execute various operations:
- Run shell commands (Bash, CMD, PowerShell) with persistent sessions
- Manipulate files (view, create, edit, replace text)
- Access date and time information
- Comprehensive Configuration System:
- Multiple configuration scopes (global, user, local)
- Profile support for different configurations
- Full configuration CLI with get, set, list, clear, add, remove commands
- Customizable Experience: Configure the AI's behavior with system prompts and other options
- Chat History: Load and save chat histories for later reference
- Command Aliases: Create shortcuts for frequently used command configurations
- Token Management: Automatically manages token usage for long conversations
- Chat Commands: Special commands like
/clear
,/save
,/cost
during chat sessions- MDX integration commands:
/file
,/files
,/find
,/search
,/get
,/run
- MDX integration commands:
Installation
Prerequisites
- .NET 8.0 SDK or later
Installing as a .NET Tool
Once published to NuGet, ChatX can be installed globally:
dotnet tool install --global ChatX --prerelease
Or locally in your current directory:
dotnet tool install --local ChatX --prerelease
After installation, you can run ChatX directly from your terminal:
chatx --input "Hello, how can you help me?"
Building from Source
Clone this repository:
git clone https://github.com/robch/chatx.git cd chatx
Build the project:
dotnet build
Run the application:
dotnet run
Usage
Basic usage:
chatx [options]
Common Options
--system-prompt <prompt>
: Set a custom system prompt for the AI--input <text>
or--question <text>
: Provide input or questions to the AI--inputs <text...>
or--questions <text...>
: Provide multiple inputs to process sequentially--input-chat-history <file>
: Load previous chat history from a file--output-chat-history <file>
: Save chat history to a file--trim-token-target <n>
: Set a target for trimming chat history when it gets too large--interactive
: Control whether to enter interactive mode (default: true)--save-alias <name>
: Save the current command options as a named alias--foreach var <name> in <values>
: Define a loop variable with multiple values--foreach var <name> in <start>..<end>
: Define a loop variable with a numeric range--help
: Display help information
Examples
Start a chat session:
chatx
Ask a specific question:
chatx --input "How do I find the largest files in a directory using bash?"
Use a custom system prompt:
chatx --system-prompt "You are an expert Linux system administrator who gives concise answers."
Save and load chat history:
chatx --output-chat-history "linux-help-session.jsonl"
chatx --input-chat-history "linux-help-session.jsonl"
Environment Variables and Configuration
ChatX supports a flexible configuration system with multiple scopes (global, user, local) and formats (YAML, INI). You can:
- Use environment variables
- Use configuration files at:
- Global:
%ProgramData%\.chatx\config
(Windows) or/etc/.chatx/config
(Linux/macOS) - User:
%AppData%\.chatx\config
(Windows) or~/.chatx/config
(Linux/macOS) - Local:
.chatx\config
in the current directory
- Global:
Common Configuration Settings
OpenAI API
OPENAI_API_KEY
: Your OpenAI API keyOPENAI_CHAT_MODEL_NAME
: Model name to use (default: gpt-4o)
Azure OpenAI API
AZURE_OPENAI_API_KEY
: Your Azure OpenAI API keyAZURE_OPENAI_ENDPOINT
: Your Azure OpenAI endpointAZURE_OPENAI_CHAT_DEPLOYMENT
: Your Azure OpenAI deployment name
GitHub Copilot API
GITHUB_TOKEN
: Your GitHub personal access token for Copilot API (preferred method)COPILOT_API_ENDPOINT
: Copilot API endpoint (default: https://api.githubcopilot.com)COPILOT_MODEL_NAME
: Model name to use (default: claude-3.7-sonnet)COPILOT_INTEGRATION_ID
: Your Copilot integration ID (required for both auth methods)
Alternative HMAC authentication:
COPILOT_HMAC_KEY
: Your Copilot HMAC key
App Configuration
CHATX_PREFERRED_PROVIDER
: Set default AI provider (openai, azure-openai, copilot, copilot-hmac)
Configuration Profiles
You can create named profiles to store different provider configurations:
- Create YAML files at
.chatx/profiles/<name>.yaml
- Use
--profile <name>
to load that profile
Example profile at .chatx/profiles/work.yaml
:
app:
preferredProvider: "azure-openai"
azure:
openai:
endpoint: "https://my-work-endpoint.openai.azure.com"
chatDeployment: "gpt-4"
Configuration Management
Manage configurations from the command line:
chatx config list # List all settings in current scope
chatx config list --any # List all settings from all scopes
chatx config get KEY # Get a configuration value
chatx config set KEY VALUE # Set a configuration value
chatx config clear KEY # Clear a configuration value
Documentation
For more detailed documentation, see:
- Getting Started
- Command Line Options
- Function Calling
- Creating Aliases
- Chat History
- Slash Commands - Special commands during chat sessions
License
Copyright(c) 2025, Rob Chambers. All rights reserved.
Chat Commands
ChatX supports several slash commands that can be used during interactive chat sessions:
Basic Commands
/clear
- Clear the current chat history/save
- Save the current chat history to a file/cost
- Show token usage and estimated cost of the session
MDX Integration Commands
/file <pattern>
- Search files matching pattern/files <pattern>
- List files matching pattern/find <pattern>
- Find occurrences of pattern in files/search <query>
- Search the web for the given query/get <url>
- Get and display content from a URL/run <command>
- Run a command and display the result
These MDX integration commands require the MDX tool to be installed and available on your system.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last Updated |
---|---|---|
1.0.0-alpha-20250421.1 | 170 | 4/21/2025 |
1.0.0-alpha-20250414.1 | 194 | 4/14/2025 |
1.0.0-alpha-20250412.1 | 101 | 4/12/2025 |
1.0.0-alpha-20250411.2 | 72 | 4/11/2025 |
1.0.0-alpha-20250408.1 | 138 | 4/8/2025 |
1.0.0-alpha-20250403.1 | 130 | 4/3/2025 |
1.0.0-alpha-20250402.1 | 132 | 4/2/2025 |
1.0.0-alpha-20250401.2 | 128 | 4/2/2025 |
1.0.0-alpha-20250401.1 | 128 | 4/1/2025 |
1.0.0-alpha-20250330.2 | 136 | 3/31/2025 |