# Trace.Ai CLI

A powerful AI-powered command-line tool powered by mixkey for analyzing files, folders, images, and system information. Trace.AI CLI leverages artificial intelligence to provide code analysis, project structure insights, text extraction from images, and detailed system information, making it an essential tool for developers and analysts.

## Features

- **File Analysis**: Analyze code files (e.g., JavaScript, Python, Java) for structure, quality, and potential improvements.
- **Folder Structure Analysis**: Get insights into project architecture, technology stack, and file organization, including a simple file tree.
- **Image Text Extraction**: Extract text from images (e.g., PNG, JPEG) using AI-powered OCR.
- **System Information**: Get detailed information about your system's hardware, software, and configuration.
- **Context Management**: Add text or file-based context to enhance AI responses.
- **Interactive CLI**: Easy-to-use interface with commands like `/file`, `/folder`, `/image`, `/system`, and more.
- **Extensible**: Supports a wide range of file types and languages, with customizable queries.

## Installation

### Prerequisites

- **Node.js**: Version 14.0.0 or higher.
- **npm**: Included with Node.js.

### Install via npm

Install Trace.AI CLI globally:

```bash
npm install -g trace.ai-cli
```

If you encounter permission issues, try one of the following:

- **With sudo**:

  ```bash
  sudo npm install -g trace.ai-cli
  ```

- **With a user-owned directory**:

  ```bash
  mkdir -p ~/.npm-global
  npm config set prefix '~/.npm-global'
  echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc  # or ~/.bashrc
  source ~/.zshrc
  npm install -g trace.ai-cli
  ```

Verify the installation:

```bash
trace-ai --version
```

## Usage

### Interactive Mode

Start Trace.AI CLI in interactive mode:

```bash
trace-ai
```

This launches the interactive CLI interface where you can enter commands and queries.

### Commands

- **File Analysis**:
  ```
  /file <file_path> [query]
  ```
  Example: `/file src/app.js explain the main function`

- **Folder Analysis**:
  ```
  /folder <folder_path> [query]
  ```
  Example: `/folder src/ what is the architecture?`

- **Image Analysis**:
  ```
  /image <image_path> [query]
  ```
  Example: `/image diagram.png explain this flowchart`

- **System Information**:
  ```
  /system [query]
  ```
  The system information feature supports natural language queries that automatically determine which information to return.
  
  Example: `/system How much RAM do I have available?`

- **Add Context**:
  ```
  /context <text>
  ```
  Example: `/context This is a React project using TypeScript`

- **Add File as Context**:
  ```
  /context-file <file_path>
  ```
  Example: `/context-file README.md`

- **View Context**:
  ```
  /view-context
  ```

- **Clear Context or Screen**:
  ```
  /clear [type]
  ```
  Example: `/clear context` or `/clear screen`

- **Help**:
  ```
  /help
  ```

- **Statistics**:
  ```
  /stats
  ```

- **Exit**:
  ```
  /exit
  ```

### Direct Queries

You can also ask questions directly without using commands:

```
What is the difference between let and const in JavaScript?
```

```
How do I implement a binary search tree in Python?
```

```
What's the current CPU usage on my system?
```


## License

MIT