Skip to content

dllen/mac-aid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Mac Aid: Homebrew Command Assistant

A Rust-based TUI application that helps you discover and understand your Homebrew-installed tools. It indexes local man/help pages into a vector store and uses a local Ollama model to recommend tools and usage examples based on your query.

Features

  • πŸ“¦ Package Discovery: Automatically lists all Homebrew-installed packages
  • πŸ€– AI-Powered Recommendations: Uses local Ollama to suggest tools based on your needs
  • πŸ’‘ Usage Examples: Provides practical command-line examples for recommended tools
  • ⌨️ Interactive TUI: Clean, intuitive terminal interface built with Ratatui

Prerequisites

Before running this application, ensure you have:

  1. Rust (1.70 or later)

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Homebrew (macOS package manager)

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Ollama (local LLM runtime)

    brew install ollama
  4. Ollama Models

    ollama pull all-minilm
    ollama pull qwen3-coder:480b-cloud

Installation

  1. Clone the repository and enter the directory:

    git clone <repo_url>
    cd mac-aid
  2. Build the project:

    cargo build --release
  3. Run the application:

    cargo run --release

Usage

Controls

  • Enter: Submit your query
  • Esc: Clear input
  • q: Quit
  • Ctrl + r: Rebuild knowledge base
  • Shift + R: Reload index data
  • ↑/↓: Scroll response

CLI Usage

Run a one-shot query directly from the terminal (no TUI, no RAG retrieval):

mac-aid how to compress file
mac-aid "convert image format"

This uses local Ollama with the configured generation model and prints the answer to stdout.

Example Queries

Try asking questions like:

  • "I need to process JSON files"
  • "How can I convert images to different formats?"
  • "Show me tools for monitoring network traffic"
  • "I want to edit videos from the command line"
  • "What tools can help me work with Docker?"

Interface Layout

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Enter your need                           β”‚
β”‚ [type your query here]                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Status: Ready / Indexing progress messages   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ’‘ Recommendation                            β”‚
β”‚ AI suggestions and usage examples appear hereβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Configuration

Changing the Ollama Model

The interactive query model is set in src/main.rs and defaults to qwen3-coder:480b-cloud:

let ollama = OllamaClient::new("qwen3-coder:480b-cloud".to_string());

Pull and set any model you prefer by updating this line.

Config File

Models are configured in ~/.mac-aid/config.json and auto-created on first run:

{
  "ollama_model": "qwen3-coder:480b-cloud",
  "embedding_model": "all-minilm"
}

Custom Ollama URL

If your Ollama instance is running on a different host/port, edit src/ollama.rs:

impl OllamaClient {
    pub fn new(model: String) -> Self {
        Self {
            client: Client::new(),
            base_url: "http://your-host:port".to_string(),
            model,
        }
    }
}

Troubleshooting

"Failed to execute brew list command"

Make sure Homebrew is installed and accessible in your PATH:

which brew
brew --version

"Ollama API request failed"

  1. Ensure Ollama is running:

    ollama serve
  2. Verify the model is available:

    ollama list
  3. Test the API manually:

curl http://localhost:11434/api/generate -d '{ "model": "qwen3-coder:480b-cloud", "prompt": "Hello", "stream": false }'


### Non-blocking rebuild/reload

- Rebuild and reload run in the background; the TUI stays responsive.
- Queries made during rebuild/reload skip RAG retrieval and directly use Ollama.

## Development

### Project Structure

src/ β”œβ”€β”€ main.rs β”œβ”€β”€ app.rs β”œβ”€β”€ ui.rs β”œβ”€β”€ brew.rs β”œβ”€β”€ indexer.rs β”œβ”€β”€ vector_store.rs β”œβ”€β”€ rag.rs β”œβ”€β”€ langchain_integration.rs β”œβ”€β”€ kb_builder.rs └── log.rs

Additional docs:

  • Chinese README: README.zh-CN.md

### Building for Development

```bash
cargo build
cargo run

Running Tests

cargo test

Data Location

  • Database: ~/.mac-aid/commands.db
  • Logs: ~/.mac-aid/error.log, ~/.mac-aid/info.log

License

MIT

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages