> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Rewriter CLI

> CLI commands for query rewriting in PraisonAI TypeScript

# Query Rewriter CLI Commands

The `praisonai-ts` CLI provides the `query-rewrite` command for optimizing search queries.

## Basic Usage

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Rewrite a query (default strategy: auto)
praisonai-ts query-rewrite "how to code"

# Get JSON output
praisonai-ts query-rewrite "best programming language" --json
```

**Example Output:**

```json theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
{
  "success": true,
  "data": {
    "originalQuery": "best programming language",
    "rewrittenQueries": [
      "What is the top programming language?",
      "Which programming language is considered the best?",
      "What is the most highly regarded programming language?"
    ],
    "strategy": "rephrase",
    "confidence": 0.85
  }
}
```

## Rewrite Strategies

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Expand strategy - add more context
praisonai-ts query-rewrite "AI" --strategy expand

# Simplify strategy - make query simpler
praisonai-ts query-rewrite "complex multi-word query" --strategy simplify

# Decompose strategy - break into sub-queries
praisonai-ts query-rewrite "AI and ML and DL" --strategy decompose

# Rephrase strategy - alternative phrasings
praisonai-ts query-rewrite "learn programming" --strategy rephrase

# Auto strategy (default) - automatically detect best approach
praisonai-ts query-rewrite "test query" --strategy auto
```

## Available Strategies

| Strategy    | Description                              |
| ----------- | ---------------------------------------- |
| `expand`    | Add more context and detail to the query |
| `simplify`  | Make the query simpler and more focused  |
| `decompose` | Break complex queries into sub-queries   |
| `rephrase`  | Generate alternative phrasings           |
| `auto`      | Automatically detect the best strategy   |

## SDK Usage

For programmatic usage, see the [Query Rewriter SDK documentation](/docs/js/query-rewriter).
