Metadata-Version: 2.4
Name: primethink-cli
Version: 1.0.0
Summary: PrimeThink CLI - A powerful tool for interacting with PrimeThink AI API
Home-page: https://github.com/primethink-ai/primethink-cli
Author: PrimeThink
Author-email: PrimeThink <support@primethink.ai>
License-Expression: MIT
Project-URL: Homepage, https://primethink.ai
Project-URL: Documentation, https://primethink.ai/cli/install
Project-URL: Repository, https://github.com/primethink-ai/primethink-cli
Project-URL: Issues, https://github.com/primethink-ai/primethink-cli/issues
Keywords: cli,ai,primethink,api,assistant
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0.0
Requires-Dist: requests>=2.25.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# PrimeThink CLI

Command Line Interface for interacting with the PrimeThink API.

## Installation

```bash
pip install -e .
```

Or install from requirements:

```bash
pip install -r requirements.txt
```

## Quick Start

1. Configure your API token:
```bash
primethink configure --token YOUR_API_TOKEN
```

2. Use the CLI commands:
```bash
primethink available-actions
primethink execute-action --action "action-name" --message "your message"
primethink send-message CHAT_ID --message "your message"
primethink send-message --agent AGENT_ID --message "your message"
```

## Configuration

### Token Management

The CLI supports multiple token profiles, allowing you to switch between different accounts or API endpoints.

#### Configure a new profile

```bash
primethink configure --token YOUR_API_TOKEN --profile default
```

Options:
- `--token, -t`: Your API token (required)
- `--profile, -p`: Profile name (default: "default")
- `--api-url, -u`: Custom API URL (optional, default: https://api.primethink.ai)

#### List all profiles

```bash
primethink list-profiles
```

#### Switch to a different profile

```bash
primethink use PROFILE_NAME
```

#### Remove a profile

```bash
primethink remove-profile PROFILE_NAME
```

## Commands

### Version

Display the CLI version:

```bash
primethink version
```

### Available Actions

Get a list of available task actions:

```bash
primethink available-actions
```

You can use a specific profile for a single request without switching the active profile:

```bash
primethink available-actions --profile production
```

You can also override the API URL for a single request:

```bash
primethink available-actions --api-url https://custom-api.example.com
```

### Execute Task Action

Execute a task action with a message and optional files:

```bash
primethink execute-action --action "action-name" --message "your message"
```

With files:

```bash
primethink execute-action --action "action-name" --message "your message" --files file1.txt --files file2.txt
```

Options:
- `--action, -a`: Task action name (required)
- `--message, -m`: Message input (required)
- `--files, -f`: Files to attach (can be specified multiple times)
- `--return-original`: Return original message (flag)
- `--profile, -p`: Profile to use for this request (optional)
- `--api-url, -u`: Override API URL for this request (optional)

### Send Message to Chat

Send a message to an existing chat by ID or mention name:

```bash
primethink send-message CHAT_ID_OR_MENTION --message "your message"
```

You can use either a chat ID or mention name:

```bash
# By chat ID
primethink send-message 123 --message "your message"

# By mention name
primethink send-message @my-assistant --message "your message"
```

With files:

```bash
primethink send-message 123 --message "your message" --files file1.txt --files file2.txt
```

Options:
- `CHAT_ID_OR_MENTION`: The chat ID or mention name (optional, positional argument)
- `--message, -m`: Message input (required)
- `--files, -f`: Files to attach (can be specified multiple times)
- `--async`: Asynchronous request (flag, default: false, applies only to chat messages)
- `--agent, -a`: Agent ID to send message to (optional, use instead of CHAT_ID_OR_MENTION)
- `--profile, -p`: Profile to use for this request (optional)
- `--api-url, -u`: Override API URL for this request (optional)

**Note:** You must provide either `CHAT_ID_OR_MENTION` or `--agent`, but not both.

### Send Message to Agent

Send a message directly to an agent using the `--agent` option:

```bash
primethink send-message --agent 1 --message "your message"
```

With files:

```bash
primethink send-message --agent 1 --message "Analyze this data" --files data.csv
```

## Configuration File

The CLI stores configuration in `~/.primethink/config.json`. This file contains:
- Active profile
- All configured profiles with their tokens and optional custom API URLs

Example structure:

```json
{
  "active_profile": "default",
  "profiles": {
    "default": {
      "token": "your-api-token"
    },
    "custom": {
      "token": "your-custom-token",
      "api_url": "https://custom-api.example.com"
    }
  }
}
```

## Development

### Install development dependencies

```bash
pip install -e ".[dev]"
```

### Run tests

```bash
pytest
```

### Run tests with coverage

```bash
pytest --cov=primethink --cov-report=html
```

## Examples

### Example 1: Configure and use the CLI

```bash
# Configure your token
primethink configure --token YOUR_API_TOKEN

# List available actions
primethink available-actions

# Execute an action
primethink execute-action --action "summarize" --message "Summarize this text"
```

### Example 2: Using multiple profiles

```bash
# Configure default profile
primethink configure --token YOUR_TOKEN --profile default

# Configure a custom API endpoint profile
primethink configure --token CUSTOM_TOKEN --profile production --api-url https://prod-api.example.com

# List profiles
primethink list-profiles

# Switch to production profile
primethink use production

# Or use a specific profile for a single command without switching
primethink available-actions --profile production
primethink send-message 123 --message "Hello" --profile default

# Switch back to default
primethink use default
```

### Example 3: Sending messages with files

```bash
# Send a message to a chat with multiple files
primethink send-message 123 --message "Here are the documents" --files report.pdf --files data.csv

# Send message by mention name
primethink send-message @my-assistant --message "Review this"

# Send to agent with a specific profile
primethink send-message --agent 1 --message "Help me with this task" --files data.csv --profile production

# Use a custom API URL for a single request
primethink send-message 123 --message "Hello" --api-url https://custom-api.example.com
```

## License

MIT License

## Support

For issues and questions, please visit: https://primethink.ai
