# BroCode CLI

An AI-powered coding companion that helps you create projects, write code, and manage files.

## Installation

```bash
# Install dependencies
npm install

# Build the project
npm run build

# Link globally (optional)
npm link
```

## Usage

### Running the CLI

```bash
# If linked globally
brocode

# Or run directly
npm start
```

### Configuration

BroCode uses environment variables and a config file for configuration.

#### Environment Variables

Create a `.env` file in the project root (see `.env.example`):

```env
NVIDIA_API_KEY=your_api_key_here
LLM_MODEL=meta/llama-3.1-70b-instruct
LLM_TEMP=0.3
```

Get your free NVIDIA API key at: https://build.nvidia.com/meta/llama-3_1-70b-instruct

#### Config File

You can also create `~/.brocode/config.json`:

```json
{
  "apiKey": "your_api_key_here",
  "model": "meta/llama-3.1-70b-instruct",
  "temperature": 0.3,
  "verbose": false,
  "debug": false
}
```

### Features

**BroCode can:**

- 🚀 Create complete projects in 11+ frameworks:
  - FastAPI (Python)
  - Express (Node.js)
  - Flask (Python)
  - Django (Python)
  - React (JavaScript)
  - Vue (JavaScript)
  - Next.js (React)
  - Go
  - Rust
  - TypeScript
  - Spring Boot (Java)

- 📝 Write and edit code files
- 📂 Manage directories and files
- 🔍 Search and read files
- 💬 Interactive chat interface

### Example Commands

Once in the CLI:

```
You: create a FastAPI project called my-api

You: create a Python script to fetch data from an API

You: read the package.json file

You: list files in the current directory

You: exit
```

## Development

```bash
# Watch mode (auto-rebuild on changes)
npm run dev

# Run tests
npm test

# Type checking
npm run typecheck
```

## Troubleshooting

### "NVIDIA API key not configured"

Make sure you have set `NVIDIA_API_KEY` in your `.env` file or `~/.brocode/config.json`.

### CLI not responding

Check logs at `~/.brocode/logs/` for error messages.

### Permission errors on Windows

Run PowerShell as Administrator when linking globally with `npm link`.

## Architecture

BroCode is built as a monorepo with TypeScript:

```
packages/
├── core/        # Core AI agent, services, and utilities
├── cli/         # Interactive CLI interface (this package)
└── test-utils/  # Testing utilities
```

## License

MIT
