trace.ai-cli
Version:
A powerful AI-powered CLI tool
140 lines (95 loc) • 3.87 kB
Markdown
# Trace.Ai CLI
A powerful AI-powered command-line tool powered by mixkey for analyzing files, folders, and images. Trace.AI CLI leverages artificial intelligence to provide code analysis, project structure insights, and text extraction from images, 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.
- **Context Management**: Add text or file-based context to enhance AI responses.
- **Interactive CLI**: Easy-to-use interface with commands like `/file`, `/folder`, `/image`, 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
Run the CLI in interactive mode:
```bash
trace-ai
```
This starts the interactive interface, where you can enter commands. Available commands:
- `/file "<path>" [question]`: Analyze a file with an optional question.
- `/folder "<path>" [question]`: Analyze a folder's structure with an optional question.
- `/image "<path>" [question]`: Extract text from an image with an optional question.
- `/context <text>`: Set text context for AI queries.
- `/context-file "<path>"`: Add a file as context.
- `/view-context`: View current contexts.
- `/clear [text|file "<path>"]`: Clear text or file context.
- `/exit`: Exit the CLI.
- Direct questions: Type a question to query the AI with current context.
### Examples
1. **Analyze a JavaScript file**:
```bash
/file "/path/to/app.js"
```
Output: Code overview, key functions, issues, and optimization suggestions.
2. **Analyze a file with a specific question**:
```bash
/file "/path/to/app.js" "find security vulnerabilities"
```
3. **Analyze a project folder**:
```bash
/folder "/path/to/project"
```
Output: Project overview, technology stack, and file tree.
4. **Extract text from an image**:
```bash
/image "/path/to/screenshot.png"
```
5. **Ask about a folder's structure**:
```bash
/folder "/path/to/project" "describe the project structure"
```
6. **Direct AI query**:
```bash
Explain quantum computing
```
### Non-Interactive Usage
Run commands directly from the terminal:
```bash
trace-ai file "/path/to/app.js" "explain this code"
trace-ai folder "/path/to/project" "what is the architecture?"
trace-ai image "/path/to/image.png"
trace-ai ask "What is the purpose of a manifest.json file?"
```
## Configuration
- **Node.js Version**: Ensure Node.js >= 14.0.0 is installed.
- **File Size Limit**: File analysis is limited to 1MB for safety.
- **Folder Depth**: Folder analysis is limited to a depth of 2 by default to avoid excessive recursion.
## Supported File Types
- **Code**: JavaScript, Python, Java, C++, TypeScript, HTML, CSS, and more.
- **Images**: JPG, PNG, GIF, WebP, BMP, SVG.
- **Other**: JSON, YAML, Markdown, SQL, Shell scripts, and more.
Powered by Mixkey\
Built with ❤️ by Dukeindustries7.