Metadata-Version: 2.5
Name: navari-cli
Version: 0.22.4
Summary: Command-line interface for Navari AI Agent
Author: Navari Contributors
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Requires-Dist: ag-ui-protocol>=0.1.0
Requires-Dist: attrs>=23.0.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: msal>=1.29.0
Requires-Dist: python-dateutil>=2.8.0
Requires-Dist: rich>=13.0.0
Requires-Dist: truststore>=0.9.0
Requires-Dist: typer>=0.12.0
Description-Content-Type: text/markdown

# Navari CLI

Command-line interface for Navari AI Agent - an enterprise-grade AI agent framework for pharmaceutical research.

## Installation

```bash
uv tool install navari-cli
# or
pip install navari-cli

# Upgrade to latest version
uv tool upgrade navari-cli
# or
pip install --upgrade navari-cli
```

## Quick Start

```bash
# Login to Navari
navari login https://navari.example.com

# List conversations
navari conversations list

# Start interactive chat
navari chat --new --title "My Analysis"

# Get help
navari --help
```

## Features

- **Interactive Chat**: Real-time streaming chat with Navari agent
- **Conversation Management**: Create, list, get, update, delete conversations
- **Project Management**: List, inspect, create, update, delete, share, and manage files in projects
- **Project Associations**: Attach and detach projects from conversations, including when creating a conversation
- **File Operations**: Upload, download, and manage files
- **Multiple Servers**: Switch between servers with `navari config <url>`
- **Azure AD SSO**: Browser-based, device code, and password authentication flows
- **Beautiful Output**: Rich terminal output with colors and tables

## Commands

### Authentication

```bash
navari login <url>                         # Browser-based OAuth flow
navari login <url> --device-code           # Device code flow for headless
navari login <url> --token <jwt>           # Login with a pre-obtained JWT token
navari login <url> -u user@co.com -p pass  # Password login (CI/automation)
navari login <url> --no-verify             # Skip SSL verification (remembered)
navari login                               # Re-login to last used server
navari logout                              # Logout from all servers
navari logout <url>                        # Logout from specific server
navari whoami                              # Show current user and server
```

### Conversations

```bash
navari conversations list                   # List all conversations
navari conversations create --title "Title" # Create new conversation
navari conversations create --title "Title" --project <slug> # Create and attach a project
navari conversations attach-project <conversation-id> <project-slug>
                                             # Attach a project to a conversation
navari conversations detach-project <conversation-id> <project-slug>
                                             # Detach a project without confirmation
navari conversations get <id>               # Get conversation details
navari conversations messages <id>          # Show conversation messages
navari conversations delete <id>            # Delete conversation
```

The `conv` alias provides the same commands, for example
`navari conv attach-project <conversation-id> <project-slug>`. A project slug is
returned by `projects create` and is used by the project association commands.

### Projects

Projects can be managed through their complete lifecycle. Use `--format
plain|table|json` with commands that return data; JSON output is suitable for
automation.

```bash
# Discover accessible projects and inspect one by its slug
navari projects list
navari projects list --format table
navari projects get <project-slug>
navari projects get <project-slug> --format json

# Create and update a project
navari projects create "Research project" --description "Project description"
navari projects update <project-slug> --description "Updated description"
navari projects update <project-slug> --wiki-enabled
navari projects update <project-slug> --no-wiki-enabled
navari projects update <project-slug> --allowed-source pubmed --allowed-source clinicaltrials

# List files stored in a project
navari projects files <project-slug>
navari projects files <project-slug> --format json

# Share and revoke access for another user
navari projects share <project-slug> <user-id> --permission read_only
navari projects share <project-slug> <user-id> --permission read_write
navari projects unshare <project-slug> <user-id>
navari projects unshare <project-slug> <user-id> --yes

# Delete a project (prompts for confirmation unless --yes is supplied)
navari projects delete <project-slug>
navari projects delete <project-slug> --yes
```

`projects create` prints the server-assigned slug. Save that slug for later
`get`, `update`, `files`, `share`, `unshare`, `delete`, `attach-project`, and
`detach-project` commands. Project list and detail tables include the available
owner, ownership, permission, description, and conversation metadata. Project
file output renders the file-entry fields returned by the workspace-tree API;
JSON output preserves the API response unchanged.

### Interactive Chat

```bash
navari chat <conversation-id>               # Start chat session
navari chat --new --title "Title"           # Create new and start chat
navari chat -m "message"                    # Send single message (non-interactive)
navari chat --new -f data.csv -m "analyze"  # Attach file and send message
```

### Files

```bash
navari files upload --conversation <id> <path>  # Upload file
navari files list --conversation <id>           # List files
navari files download <file-id>                 # Download file
navari files delete <file-id>                   # Delete file
navari files workspace <conversation-id>        # Download workspace zip
```

### Configuration

```bash
navari config                               # Show current configuration
navari config <url>                         # Switch active server
```

### Global Options

```bash
--server <url>               # Override active server for this command
--format {json|table|plain}  # Output format
--debug                      # Enable debug logging
--no-color                   # Disable color output
```

## Configuration

The CLI stores credentials and configuration in `~/.navari/`:
- `credentials.json` - JWT tokens per server
- `config.json` - User preferences (last used server, output format)
- `msal_cache.json` - MSAL token cache for silent token refresh

## Development

The CLI integration suite includes a real-server project lifecycle test that
creates, updates, associates, lists files for, detaches, and cleans up a
project and conversation.

### Generated API client

The CLI uses the already-generated Python API client checked into
`navari_cli/generated/`. CLI-only changes, including project lifecycle and
conversation project-association commands, do not require API client
generation. The generated client is regenerated only when the Navari API
contract itself changes; see [Generated Client](navari_cli/generated/README.md)
for details.
