Metadata-Version: 2.4
Name: tripai_cli
Version: 0.1.2
Summary: CLI for the TripAI skill endpoint.
Project-URL: Homepage, https://github.com/trips-ai/tripai
Project-URL: Repository, https://github.com/your-org/tripai
Project-URL: Issues, https://github.com/your-org/tripai/issues
Author-email: shibolin <shibolin@trip.com>
License: Apache-2.0
License-File: LICENSE
Keywords: cli,ctrip,travel,tripai
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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
Requires-Python: >=3.8
Description-Content-Type: text/markdown

<p align="center">
  <h1 align="center">tripai_cli</h1>
  <p align="center">
    <strong>A lightweight command-line client for the TripAI (携程问道) travel assistant.</strong>
  </p>
  <p align="center">
    Ask Ctrip's travel AI anything from your terminal — flights, hotels, trains, attractions — no browser, no app.
  </p>
  <p align="center">
    <a href="https://pypi.org/project/tripai_cli/"><img src="https://img.shields.io/pypi/v/tripai_cli?labelColor=1a1a1a" alt="PyPI"></a>
    <a href="https://pypi.org/project/tripai_cli/"><img src="https://img.shields.io/pypi/pyversions/tripai_cli?labelColor=1a1a1a" alt="Python versions"></a>
    <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green" alt="Apache-2.0 License"></a>
  </p>
  <p align="center">
    <a href="#overview">Overview</a> ·
    <a href="#features">Features</a> ·
    <a href="#install">Install</a> ·
    <a href="#usage">Usage</a> ·
    <a href="#security--privacy">Security</a> ·
    <a href="#license">License</a>
  </p>
</p>

---

## Overview

`tripai_cli` is a thin wrapper around the TripAI skill powered by
[Ctrip (携程)](https://www.ctrip.com/). It sends your natural-language query
to the TripAI service and prints the raw JSON response to stdout — ideal for
shell pipelines, scripting, or wiring into other agents.

## Features

- **Natural Language Interface** — Ask in plain English or Chinese.
- **Zero Dependencies** — Pure Python standard library (`urllib` + `json`).
- **Comprehensive Travel Search** — Hotels, flights, trains, attractions,
  trip planning, LBS-based recommendations.
- **Pipeline Friendly** — Prints raw JSON to stdout; pipe into `jq`,
  downstream scripts, or other CLIs.
- **No API Key Required** — Works out of the box (may be rate-limited).

## Install

```bash
pip install tripai_cli
```

Requires Python 3.8+.

## Usage

```bash
tripai --query "帮我推荐几个三亚的景点"
```

The command prints the raw JSON body returned by the server. Pipe it into
`jq` to pretty-print or extract fields:

```bash
tripai --query "三亚攻略" | jq .
```

### Options

```
tripai --query QUERY [--token TOKEN] [--timeout SECONDS]
```

- `--query` — query text (required).
- `--token` — API token (optional). Obtain one at
  [www.ctrip.com/wendao/openclaw](https://www.ctrip.com/wendao/openclaw).
  If omitted or empty, the request is sent without authentication.
- `--timeout` — request timeout in seconds (default: `60`).

### As a module

```bash
python -m tripai_cli --query "你好"
```

### As a library

```python
from tripai_cli import cli

body = cli.query("三亚有什么好玩的")
print(body)
```

## Usage Examples

```bash
# 酒店预订
tripai --query "预订北京三里屯附近的酒店"

# 交通查询
tripai --query "查一下明天北京到上海的高铁票"

# 附近推荐
tripai --query "下午去故宫,附近有什么高分的老字号餐厅?"

# 亲子出行
tripai --query "想带孩子去三亚,推荐几个带水上乐园的亲子度假村"

# 机票比价
tripai --query "五一去哈尔滨,有便宜的机票吗?"
```

## Security & Privacy

- **No credentials required** — This CLI does not send an API token.
- **Third-Party Content** — All responses are generated by Ctrip's service.
  Do not assume the content is always accurate or safe; use discretion.
- **Rate Limits** — Anonymous requests may be rate-limited.

## License

[Apache-2.0](LICENSE)
