@toothfairyai/cli 1.0.3 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +173 -10
- package/bin/toothfairy.js +455 -197
- package/package.json +3 -2
- package/src/api.js +268 -33
- package/src/config.js +5 -1
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@ A Node.js command-line interface for interacting with ToothFairy AI agents.
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
### From NPM
|
|
7
|
+
### From NPM
|
|
8
8
|
```bash
|
|
9
|
-
npm install -g
|
|
9
|
+
npm install -g @toothfairyai/cli
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
### From Source
|
|
@@ -22,8 +22,6 @@ npm link # Makes 'toothfairy' command available globally
|
|
|
22
22
|
1. **Configure your credentials:**
|
|
23
23
|
```bash
|
|
24
24
|
toothfairy configure \
|
|
25
|
-
--base-url "https://api.toothfairyai.com" \
|
|
26
|
-
--ai-url "https://ai.toothfairyai.com" \
|
|
27
25
|
--api-key "your-api-key" \
|
|
28
26
|
--workspace-id "your-workspace-id"
|
|
29
27
|
```
|
|
@@ -31,18 +29,183 @@ toothfairy configure \
|
|
|
31
29
|
2. **Send a message to an agent:**
|
|
32
30
|
```bash
|
|
33
31
|
toothfairy send "Hello, I need help with my appointment" \
|
|
34
|
-
--agent-id "agent-123"
|
|
35
|
-
--phone-number "+1234567890" \
|
|
36
|
-
--customer-id "customer-456" \
|
|
37
|
-
--provider-id "sms-provider-789"
|
|
32
|
+
--agent-id "agent-123"
|
|
38
33
|
```
|
|
39
34
|
|
|
40
|
-
3. **
|
|
35
|
+
3. **Search the knowledge hub:**
|
|
36
|
+
```bash
|
|
37
|
+
toothfairy search "appointment scheduling help"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
4. **List your chats:**
|
|
41
41
|
```bash
|
|
42
42
|
toothfairy chats
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
## Available Commands
|
|
46
|
+
|
|
47
|
+
### Global Options
|
|
48
|
+
- `-c, --config <path>`: Path to configuration file
|
|
49
|
+
- `-v, --verbose`: Enable verbose logging
|
|
50
|
+
|
|
51
|
+
### Commands
|
|
52
|
+
|
|
53
|
+
#### `configure`
|
|
54
|
+
Configure ToothFairy CLI credentials and settings.
|
|
55
|
+
|
|
56
|
+
**Options:**
|
|
57
|
+
- `--api-key <key>`: API key (required)
|
|
58
|
+
- `--workspace-id <id>`: Workspace ID (required)
|
|
59
|
+
- `--base-url <url>`: ToothFairy API base URL (optional, defaults to production)
|
|
60
|
+
- `--ai-url <url>`: ToothFairy AI URL (optional, defaults to production)
|
|
61
|
+
- `--config-path <path>`: Custom path to save config file
|
|
62
|
+
|
|
63
|
+
**Example:**
|
|
64
|
+
```bash
|
|
65
|
+
toothfairy configure --api-key "your-key" --workspace-id "your-workspace"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### `send <message>`
|
|
69
|
+
Send a message to a ToothFairy AI agent.
|
|
70
|
+
|
|
71
|
+
**Arguments:**
|
|
72
|
+
- `message`: The message text to send
|
|
73
|
+
|
|
74
|
+
**Options:**
|
|
75
|
+
- `--agent-id <id>`: Agent ID to send message to (required)
|
|
76
|
+
- `--phone-number <number>`: Phone number for SMS channel (optional)
|
|
77
|
+
- `--customer-id <id>`: Customer ID (optional)
|
|
78
|
+
- `--provider-id <id>`: SMS provider ID (optional)
|
|
79
|
+
- `--customer-info <json>`: Customer info as JSON string (optional)
|
|
80
|
+
- `-o, --output <format>`: Output format (json|text, default: text)
|
|
81
|
+
- `-v, --verbose`: Show detailed response information
|
|
82
|
+
|
|
83
|
+
**Examples:**
|
|
84
|
+
```bash
|
|
85
|
+
# Simple message
|
|
86
|
+
toothfairy send "What are your hours?" --agent-id "info-agent"
|
|
87
|
+
|
|
88
|
+
# With customer information
|
|
89
|
+
toothfairy send "Schedule appointment" \
|
|
90
|
+
--agent-id "scheduler" \
|
|
91
|
+
--customer-info '{"name": "John", "phone": "+1234567890"}'
|
|
92
|
+
|
|
93
|
+
# With verbose output
|
|
94
|
+
toothfairy send "Hello" --agent-id "agent-123" --verbose
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### `search <query>`
|
|
98
|
+
Search for documents in the knowledge hub.
|
|
99
|
+
|
|
100
|
+
**Arguments:**
|
|
101
|
+
- `query`: The search query text
|
|
102
|
+
|
|
103
|
+
**Options:**
|
|
104
|
+
- `-k, --top-k <number>`: Number of documents to retrieve (1-50, default: 10)
|
|
105
|
+
- `--status <status>`: Filter by document status (published|suspended)
|
|
106
|
+
- `--document-id <id>`: Search within specific document ID
|
|
107
|
+
- `--topics <topics>`: Comma-separated topic IDs to filter by
|
|
108
|
+
- `-o, --output <format>`: Output format (json|text, default: text)
|
|
109
|
+
- `-v, --verbose`: Show detailed search information
|
|
110
|
+
|
|
111
|
+
**Examples:**
|
|
112
|
+
```bash
|
|
113
|
+
# Basic search
|
|
114
|
+
toothfairy search "AI agent configuration"
|
|
115
|
+
|
|
116
|
+
# Filter by status and limit results
|
|
117
|
+
toothfairy search "machine learning" --status published --top-k 5
|
|
118
|
+
|
|
119
|
+
# Search with topic filtering
|
|
120
|
+
toothfairy search "automation" --topics "topic_123,topic_456"
|
|
121
|
+
|
|
122
|
+
# Verbose search with JSON output
|
|
123
|
+
toothfairy search "deployment" --verbose --output json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### `chats`
|
|
127
|
+
List all chats in the workspace.
|
|
128
|
+
|
|
129
|
+
**Options:**
|
|
130
|
+
- `-o, --output <format>`: Output format (json|text, default: text)
|
|
131
|
+
|
|
132
|
+
**Example:**
|
|
133
|
+
```bash
|
|
134
|
+
toothfairy chats
|
|
135
|
+
toothfairy chats --output json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### `chat <chat-id>`
|
|
139
|
+
Get details of a specific chat.
|
|
140
|
+
|
|
141
|
+
**Arguments:**
|
|
142
|
+
- `chat-id`: The chat ID to retrieve
|
|
143
|
+
|
|
144
|
+
**Options:**
|
|
145
|
+
- `-o, --output <format>`: Output format (json|text, default: text)
|
|
146
|
+
|
|
147
|
+
**Example:**
|
|
148
|
+
```bash
|
|
149
|
+
toothfairy chat "chat-abc123"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### `config-show`
|
|
153
|
+
Display current configuration (with masked API key).
|
|
154
|
+
|
|
155
|
+
**Example:**
|
|
156
|
+
```bash
|
|
157
|
+
toothfairy config-show
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### `help-guide`
|
|
161
|
+
Show detailed help with examples, common issues, and pro tips.
|
|
162
|
+
|
|
163
|
+
**Example:**
|
|
164
|
+
```bash
|
|
165
|
+
toothfairy help-guide
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Configuration
|
|
169
|
+
|
|
170
|
+
The CLI supports multiple configuration methods (in order of priority):
|
|
171
|
+
|
|
172
|
+
1. **Environment variables:**
|
|
173
|
+
```bash
|
|
174
|
+
export TF_API_KEY="your-api-key"
|
|
175
|
+
export TF_WORKSPACE_ID="your-workspace-id"
|
|
176
|
+
export TF_BASE_URL="https://api.toothfairyai.com" # optional
|
|
177
|
+
export TF_AI_URL="https://ai.toothfairyai.com" # optional
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
2. **Config file at `~/.toothfairy/config.yml`:**
|
|
181
|
+
```yaml
|
|
182
|
+
api_key: "your-api-key"
|
|
183
|
+
workspace_id: "your-workspace-id"
|
|
184
|
+
base_url: "https://api.toothfairyai.com" # optional
|
|
185
|
+
ai_url: "https://ai.toothfairyai.com" # optional
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
3. **CLI arguments:**
|
|
189
|
+
```bash
|
|
190
|
+
toothfairy --config /path/to/config.yml send "Hello" --agent-id "agent-123"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Output Formats
|
|
194
|
+
|
|
195
|
+
Both `json` and `text` output formats are supported:
|
|
196
|
+
|
|
197
|
+
- **`text`** (default): Pretty formatted tables and panels
|
|
198
|
+
- **`json`**: Raw JSON output for scripting
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Get JSON output for scripting
|
|
202
|
+
toothfairy send "Hello" --agent-id "agent-123" --output json | jq '.agentResponse.contents.content'
|
|
203
|
+
|
|
204
|
+
# Search with JSON output
|
|
205
|
+
toothfairy search "documentation" --output json | jq '.[].title'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
For full documentation and cross-platform examples, see the main [README.md](../README.md) in the parent directory.
|
|
46
209
|
|
|
47
210
|
## Development
|
|
48
211
|
|