Skip to content

Commit 985de14

Browse files
Update cli-usage.md
1 parent 0c8cb15 commit 985de14

1 file changed

Lines changed: 85 additions & 38 deletions

File tree

docs/cli-usage.md

Lines changed: 85 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,124 @@
1-
# 💻 CLI Usage Guide
1+
# ⚙️ CLI Usage — PromptStream.AI
22

3-
The **PromptStream.AI CLI** allows you to quickly build, validate, and generate prompts directly from the terminal.
3+
The **PromptStream.AI CLI** lets you build, validate, and analyze prompt templates directly from your terminal.
4+
It provides a clean developer workflow for experimenting with the Flow.AI ecosystem (Flow.AI.Core, TokenFlow.AI, and PromptStream.AI).
45

56
---
67

7-
## 🧱 Build
8+
## 🚀 Installation
89

9-
Render a prompt template with variables.
10+
Install the global tool via NuGet:
1011

1112
```bash
12-
promptstream build --template "./examples/welcome.txt" --var name=Andrew
13+
dotnet tool install --global promptstream.ai.cli
1314
```
1415

15-
Outputs:
16-
```
17-
✅ Prompt built successfully:
18-
Hello Andrew, welcome to PromptStream.AI!
19-
```
16+
Once installed, you can call it using the `promptstream` command from anywhere.
2017

2118
---
2219

23-
## ✅ Validate
20+
## 🧱 Basic Commands
21+
22+
### 🧩 Build
2423

25-
Validate a prompt for completeness and token safety.
24+
Render and substitute variables in a template.
2625

2726
```bash
28-
promptstream validate --template "./examples/summary.txt" --var topic=AI
27+
promptstream build --template "Hello {{name}}" --var name=Andrew
2928
```
3029

31-
---
30+
### 🔍 Validate
3231

33-
Outputs:
34-
```
35-
✅ Valid prompt (37 tokens)
36-
```
32+
Check structure, token limits, and syntax.
3733

38-
---
34+
```bash
35+
promptstream validate --template "Summarize {{text}}" --var text="PromptStream.AI is awesome"
36+
```
3937

40-
## 🤖 Generate
38+
### 📊 Analyze
4139

42-
Build, validate, and generate a model reply.
40+
Estimate token counts and cost for a given prompt.
4341

4442
```bash
45-
promptstream generate --template "./examples/summary.txt" --var topic=AI
43+
promptstream analyze --template "Explain quantum computing simply."
4644
```
4745

48-
Outputs:
49-
```
50-
✅ Generation complete:
51-
[TokenFlow gpt-4o-mini] processed 32 tokens.
52-
```
46+
### 💬 Generate
5347

54-
---
48+
Build, validate, and request a response from the model provider.
49+
50+
```bash
51+
promptstream generate --template "Write a haiku about AI" --save context.json
52+
```
5553

56-
## 💬 Context
54+
### 🧠 Context
5755

58-
Inspect or manage conversation history.
56+
Inspect, summarize, or clear conversation history.
5957

6058
```bash
6159
promptstream context --load context.json --summarize
62-
promptstream context --clear --save context.json
6360
```
6461

65-
Outputs:
62+
---
63+
64+
## 🧩 Command Reference
65+
66+
| Command | Description |
67+
|----------|--------------|
68+
| `build` | Renders and substitutes variables in a template. |
69+
| `validate` | Validates prompt structure and token usage. |
70+
| `analyze` | Estimates token usage and cost metrics. |
71+
| `generate` | Generates model output for a prompt. |
72+
| `context` | Loads, saves, summarizes, or clears context data. |
73+
74+
---
75+
76+
## 💡 Options
77+
78+
| Option | Description |
79+
|---------|-------------|
80+
| `--template <value>` | Path to a `.json` file or inline text content. |
81+
| `--var <key=value>` | Variables to substitute (multiple allowed). |
82+
| `--context <path>` | Path to an existing context JSON file. |
83+
| `--save <path>` | Destination path to save context or output. |
84+
| `--model <id>` | Optional model ID (e.g. `gpt-4o-mini`). |
85+
| `--output <format>` | Output format (table or json). |
86+
87+
---
88+
89+
## 📸 Example Output
90+
6691
```
67-
📂 Loaded 4 messages from context.json
68-
Summary: 4 messages (user, assistant)
92+
📊 Prompt Analysis
93+
────────────────────────────────────────
94+
Model: gpt-4o-mini
95+
Prompt Tokens: 128
96+
Completion Tokens: 142
97+
Total Tokens: 270
98+
Estimated Cost: $0.00052
99+
────────────────────────────────────────
100+
✅ Analysis complete — total tokens: 270
69101
```
70102

71103
---
72104

73-
### 🌈 Tips
105+
## 🧠 Integration Notes
106+
107+
- The CLI uses **PromptStream.AI** services under the hood, leveraging Flow.AI.Core’s shared models.
108+
- Variable substitution is handled via the same builder logic used by the library itself.
109+
- Each command mirrors a service call: *Build → Validate → Analyze → Generate.*
110+
111+
---
112+
113+
## 🗺️ Links
114+
115+
- [PromptStream.AI on GitHub](https://github.com/AndrewClements84/PromptStream.AI)
116+
- [NuGet Package](https://www.nuget.org/packages/PromptStream.AI.CLI)
117+
- [PromptStream.AI Docs](https://andrewclements84.github.io/PromptStream.AI)
118+
119+
---
120+
121+
**Author:** [AndrewClements84](https://github.com/AndrewClements84)
122+
**License:** MIT
123+
**Version:** 0.8.3
74124

75-
- Use `--template` for inline text or a file path.
76-
- Chain variables with multiple `--var` arguments.
77-
- Combine `--context` and `--save` to preserve conversation state.

0 commit comments

Comments
 (0)