Metadata-Version: 2.4
Name: tripai_cli
Version: 0.1.0
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, trip planning — 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 endpoint powered by
[Ctrip (携程)](https://www.ctrip.com/). It sends your natural-language query
to `https://wendao-skill-prod.ctrip.com/skill/query` and prints the raw JSON
response to stdout — ideal for shell pipelines, scripting, or wiring into
other agents.

The underlying service is the same one that powers the
[TripAI skill](https://clawhub.ai/trips-ai/wendao-skill) in OpenClaw; this CLI
lets you use it without an agent host.

## 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

From PyPI:

```bash
pip install tripai_cli
```

From source:

```bash
git clone https://github.com/your-org/tripai_cli.git
cd tripai_cli
pip install .
```

Requires Python 3.8+.

## Usage

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

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

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

### Options

```
tripai [--source SOURCE] [--timeout SECONDS] QUERY...
```

- `--source` — overrides the `source` field in the request body
  (default: `xiaoyi`).
- `--timeout` — request timeout in seconds (default: `60`).

### As a module

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

### As a library

```python
from tripai_cli import cli

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

## Usage Examples

### Scenario 1: Pre-trip precise booking

**Core point:** Clear time, route, and transactional intent.

```bash
tripai "预订北京三里屯附近的酒店"
tripai "查一下明天北京到上海的高铁票"
```

### Scenario 2: In-destination exploration

**Core point:** Immediate services and local exploration based on
Location-Based Services (LBS).

```bash
tripai "下午去故宫,附近有什么高分的老字号餐厅?"
tripai "上海武康路附近哪里适合逛街?"
```

### Scenario 3: Audience-specific and thematic travel

**Core point:** Vague time or location intent with strong attribute tags
(e.g., family, business, budget).

```bash
tripai "想带孩子去三亚,推荐几个带水上乐园的亲子度假村"
tripai "五一去哈尔滨,有便宜的机票吗?"
```

### Equivalent raw HTTP

`tripai_cli` is equivalent to the following shell command, but without
requiring `jq` or `curl`:

```bash
jq -n --arg query "$USER_QUERY" '{query: $query, source: "xiaoyi"}' \
  | curl -s -X POST https://wendao-skill-prod.ctrip.com/skill/query \
      -H "Content-Type: application/json" -d @-
```

## Security & Privacy

- **No credentials required** — This CLI does not send an API token. If you
  need authenticated / higher-rate access, use the official TripAI skill and
  set `TRIPAI_API_KEY`.
- **Third-Party Content** — All responses are generated by Ctrip's service.
  Do not assume the content is always accurate or safe; use discretion.
- **Endpoint** — Hardcoded to the official production endpoint:
  `https://wendao-skill-prod.ctrip.com`.
- **Rate Limits** — Anonymous requests may be rate-limited.

## License

[Apache-2.0](LICENSE)
