kob-cli 1.0.0
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/AGENTS.md +351 -0
- package/INSTALL.md +84 -0
- package/LICENSE +34 -0
- package/MANUAL.md +526 -0
- package/QUICKSTART.md +147 -0
- package/README.md +359 -0
- package/SPECTS.md +581 -0
- package/bin/cli.js +21 -0
- package/package.json +76 -0
- package/src/commands/ask.ts +55 -0
- package/src/commands/auth.ts +72 -0
- package/src/commands/chat.ts +146 -0
- package/src/commands/code.ts +78 -0
- package/src/commands/models.ts +66 -0
- package/src/commands/skills.ts +36 -0
- package/src/commands/stream.ts +53 -0
- package/src/index.ts +84 -0
- package/src/types/index.ts +95 -0
- package/src/ui/code-tui.tsx +440 -0
- package/src/utils/api.ts +208 -0
- package/src/utils/config.ts +45 -0
- package/src/utils/errors.ts +43 -0
- package/src/utils/format.ts +27 -0
package/SPECTS.md
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
# SPECTS.md - KOB CLI Technical Specifications
|
|
2
|
+
|
|
3
|
+
## API Integration Specifications
|
|
4
|
+
|
|
5
|
+
### Base Configuration
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Base URL: https://www.kob-ai.dev
|
|
9
|
+
Authentication: API Key + API Token in request body
|
|
10
|
+
Content-Type: application/json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Environment Variables
|
|
14
|
+
|
|
15
|
+
| Variable | Required | Default | Description |
|
|
16
|
+
|----------|----------|---------|-------------|
|
|
17
|
+
| `KOB_API_BASE_URL` | No | `https://www.kob-ai.dev` | API base URL |
|
|
18
|
+
| `KOB_API_KEY` | Yes | - | API key (starts with `kob_`) |
|
|
19
|
+
|
|
20
|
+
## API Endpoints
|
|
21
|
+
|
|
22
|
+
### 1. Token Verification
|
|
23
|
+
|
|
24
|
+
**Endpoint:** `POST /tokens/verify`
|
|
25
|
+
|
|
26
|
+
**Request Body:**
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"api_key": "kob_xxx"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
**Response (200):**
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"success": true,
|
|
36
|
+
"message": "Token verified successfully",
|
|
37
|
+
"user_email": "user@example.com",
|
|
38
|
+
"user_name": "John Doe",
|
|
39
|
+
"key_name": "My Key",
|
|
40
|
+
"credit_balance": 250,
|
|
41
|
+
"package_name": "Premium Monthly",
|
|
42
|
+
"package_started_at": "2025-01-10T00:00:00.000Z",
|
|
43
|
+
"package_expires_at": "2025-02-09T00:00:00.000Z",
|
|
44
|
+
"ip": "203.0.113.42",
|
|
45
|
+
"timestamp": "2025-01-15T10:30:00.000Z"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Error Responses:**
|
|
50
|
+
- `400` - Missing fields
|
|
51
|
+
- `401` - Invalid credentials
|
|
52
|
+
- `500` - Server error
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### 2. AI Chat
|
|
57
|
+
|
|
58
|
+
**Endpoint:** `POST /ai/chat`
|
|
59
|
+
|
|
60
|
+
**Request Body:**
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"api_key": "kob_xxx",
|
|
64
|
+
"provider": "DeepSeek",
|
|
65
|
+
"model": "deepseek-chat",
|
|
66
|
+
"messages": [
|
|
67
|
+
{ "role": "user", "content": "Hello" }
|
|
68
|
+
],
|
|
69
|
+
"project_id": "optional-uuid",
|
|
70
|
+
"system_prompt": "optional",
|
|
71
|
+
"max_tokens": 4096,
|
|
72
|
+
"temperature": 0.7
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Response (200):**
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"success": true,
|
|
80
|
+
"message": "AI response generated successfully",
|
|
81
|
+
"content": "AI response text...",
|
|
82
|
+
"usage": {
|
|
83
|
+
"input_tokens": 85,
|
|
84
|
+
"output_tokens": 120,
|
|
85
|
+
"total_tokens": 205,
|
|
86
|
+
"cost_usd": 0.00004245,
|
|
87
|
+
"credits_used": 1,
|
|
88
|
+
"model": "deepseek-chat",
|
|
89
|
+
"input_price_per_1m": 0.27,
|
|
90
|
+
"output_price_per_1m": 1.10
|
|
91
|
+
},
|
|
92
|
+
"credit_balance": 249,
|
|
93
|
+
"timestamp": "2025-01-20T10:30:00.000Z"
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Error Responses:**
|
|
98
|
+
- `400` - Missing required fields
|
|
99
|
+
- `401` - Invalid credentials
|
|
100
|
+
- `402` - Insufficient credits
|
|
101
|
+
- `404` - Project not found
|
|
102
|
+
- `502` - AI provider error
|
|
103
|
+
- `500` - Server error
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### 3. AI Stream
|
|
108
|
+
|
|
109
|
+
**Endpoint:** `POST /ai/stream`
|
|
110
|
+
|
|
111
|
+
**Request Body:** Same as `/ai/chat`
|
|
112
|
+
|
|
113
|
+
**Response:** Server-Sent Events (SSE)
|
|
114
|
+
|
|
115
|
+
**Event Types:**
|
|
116
|
+
|
|
117
|
+
**chunk:**
|
|
118
|
+
```json
|
|
119
|
+
{ "type": "chunk", "content": "text fragment" }
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**done:**
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"type": "done",
|
|
126
|
+
"content": "full response",
|
|
127
|
+
"credits_charged": 9,
|
|
128
|
+
"credits_remaining": 991,
|
|
129
|
+
"usage": {
|
|
130
|
+
"input_tokens": 15,
|
|
131
|
+
"output_tokens": 8,
|
|
132
|
+
"total_tokens": 23,
|
|
133
|
+
"cost_usd": 0.000023,
|
|
134
|
+
"credits_used": 1,
|
|
135
|
+
"charged_credits": 9,
|
|
136
|
+
"charge_rate": 3.0
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**error:**
|
|
142
|
+
```json
|
|
143
|
+
{ "type": "error", "message": "Error description" }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### 4. Models
|
|
149
|
+
|
|
150
|
+
**Endpoint:** `POST /models`
|
|
151
|
+
|
|
152
|
+
**Request Body:**
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"api_key": "kob_xxx"
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Response (200):**
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"success": true,
|
|
163
|
+
"message": "Found 302 models across 2 providers",
|
|
164
|
+
"provider_count": 2,
|
|
165
|
+
"model_count": 302,
|
|
166
|
+
"providers": [
|
|
167
|
+
{
|
|
168
|
+
"provider": "DeepSeek",
|
|
169
|
+
"models": [
|
|
170
|
+
{
|
|
171
|
+
"modelId": "deepseek-chat",
|
|
172
|
+
"displayName": "DeepSeek V3",
|
|
173
|
+
"inputPricePer1M": 0.27,
|
|
174
|
+
"outputPricePer1M": 1.10
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### 5. Projects
|
|
185
|
+
|
|
186
|
+
#### 5.1 List Projects
|
|
187
|
+
|
|
188
|
+
**Endpoint:** `GET /projects?api_key=xxx`
|
|
189
|
+
|
|
190
|
+
**Response (200):**
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"success": true,
|
|
194
|
+
"projects": [
|
|
195
|
+
{
|
|
196
|
+
"id": "uuid",
|
|
197
|
+
"user_email": "user@example.com",
|
|
198
|
+
"project_name": "My Project",
|
|
199
|
+
"description": "Description",
|
|
200
|
+
"created_at": "2025-01-20T10:30:00.000Z",
|
|
201
|
+
"updated_at": "2025-01-20T10:30:00.000Z"
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### 5.2 Create Project
|
|
208
|
+
|
|
209
|
+
**Endpoint:** `POST /projects`
|
|
210
|
+
|
|
211
|
+
**Request Body:**
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"api_key": "kob_xxx",
|
|
215
|
+
"project_name": "My Project",
|
|
216
|
+
"description": "Optional description"
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Response (200):**
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"success": true,
|
|
224
|
+
"message": "Project created successfully",
|
|
225
|
+
"project": {
|
|
226
|
+
"id": "uuid",
|
|
227
|
+
"project_name": "My Project",
|
|
228
|
+
"description": "Description",
|
|
229
|
+
"created_at": "...",
|
|
230
|
+
"updated_at": "..."
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### 5.3 Update Project
|
|
236
|
+
|
|
237
|
+
**Endpoint:** `PATCH /projects`
|
|
238
|
+
|
|
239
|
+
**Request Body:**
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"api_key": "kob_xxx",
|
|
243
|
+
"project_id": "uuid",
|
|
244
|
+
"project_name": "New Name",
|
|
245
|
+
"description": "New description"
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
#### 5.4 Delete Project
|
|
250
|
+
|
|
251
|
+
**Endpoint:** `DELETE /projects`
|
|
252
|
+
|
|
253
|
+
**Request Body:**
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"api_key": "kob_xxx",
|
|
257
|
+
"project_id": "uuid"
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
### 6. Project Rules
|
|
264
|
+
|
|
265
|
+
#### 6.1 List Rules
|
|
266
|
+
|
|
267
|
+
**Endpoint:** `GET /projects/rules?api_key=xxx&project_id=xxx`
|
|
268
|
+
|
|
269
|
+
**Response (200):**
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"success": true,
|
|
273
|
+
"rules": [
|
|
274
|
+
{
|
|
275
|
+
"id": "uuid",
|
|
276
|
+
"project_id": "uuid",
|
|
277
|
+
"user_email": "user@example.com",
|
|
278
|
+
"rule_text": "Must respond in Thai",
|
|
279
|
+
"rule_type": "required",
|
|
280
|
+
"is_active": true,
|
|
281
|
+
"created_at": "...",
|
|
282
|
+
"updated_at": "..."
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
#### 6.2 Create Rule
|
|
289
|
+
|
|
290
|
+
**Endpoint:** `POST /projects/rules`
|
|
291
|
+
|
|
292
|
+
**Request Body:**
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"api_key": "kob_xxx",
|
|
296
|
+
"project_id": "uuid",
|
|
297
|
+
"rule_text": "Rule text",
|
|
298
|
+
"rule_type": "required"
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Rule Types:**
|
|
303
|
+
- `forbidden` - Things AI must not do
|
|
304
|
+
- `required` - Things AI must do
|
|
305
|
+
- `custom` - Custom rules
|
|
306
|
+
|
|
307
|
+
#### 6.3 Update Rule
|
|
308
|
+
|
|
309
|
+
**Endpoint:** `PATCH /projects/rules`
|
|
310
|
+
|
|
311
|
+
**Request Body:**
|
|
312
|
+
```json
|
|
313
|
+
{
|
|
314
|
+
"api_key": "kob_xxx",
|
|
315
|
+
"project_id": "uuid",
|
|
316
|
+
"rule_id": "uuid",
|
|
317
|
+
"rule_text": "New text",
|
|
318
|
+
"rule_type": "required",
|
|
319
|
+
"is_active": true
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### 6.4 Delete Rule
|
|
324
|
+
|
|
325
|
+
**Endpoint:** `DELETE /projects/rules`
|
|
326
|
+
|
|
327
|
+
**Request Body:**
|
|
328
|
+
```json
|
|
329
|
+
{
|
|
330
|
+
"api_key": "kob_xxx",
|
|
331
|
+
"project_id": "uuid",
|
|
332
|
+
"rule_id": "uuid"
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
### 7. Credit History
|
|
339
|
+
|
|
340
|
+
**Endpoint:** `POST /credits/history`
|
|
341
|
+
|
|
342
|
+
**Request Body:**
|
|
343
|
+
```json
|
|
344
|
+
{
|
|
345
|
+
"api_key": "kob_xxx",
|
|
346
|
+
"limit": 20,
|
|
347
|
+
"offset": 0
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
**Response (200):**
|
|
352
|
+
```json
|
|
353
|
+
{
|
|
354
|
+
"success": true,
|
|
355
|
+
"message": "Credit history retrieved successfully",
|
|
356
|
+
"data": {
|
|
357
|
+
"total_items": 25,
|
|
358
|
+
"total_credits_added": 1500,
|
|
359
|
+
"limit": 20,
|
|
360
|
+
"offset": 0,
|
|
361
|
+
"items": [
|
|
362
|
+
{
|
|
363
|
+
"id": 101,
|
|
364
|
+
"amount": 500,
|
|
365
|
+
"payment_method": "promptpay",
|
|
366
|
+
"payment_channel": "QR PromptPay",
|
|
367
|
+
"status": "completed",
|
|
368
|
+
"note": "Top up 500 credits",
|
|
369
|
+
"created_at": "2025-01-14T14:22:00.000Z"
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Credit Status:**
|
|
377
|
+
- `completed` - Successfully added
|
|
378
|
+
- `pending` - Awaiting confirmation
|
|
379
|
+
- `failed` - Failed transaction
|
|
380
|
+
- `refunded` - Refunded
|
|
381
|
+
|
|
382
|
+
## Error Handling Specifications
|
|
383
|
+
|
|
384
|
+
### HTTP Status Codes
|
|
385
|
+
|
|
386
|
+
| Code | Meaning | CLI Action |
|
|
387
|
+
|------|---------|------------|
|
|
388
|
+
| 200 | Success | Display data |
|
|
389
|
+
| 400 | Bad Request | Show validation error |
|
|
390
|
+
| 401 | Unauthorized | Show auth error with help |
|
|
391
|
+
| 402 | Payment Required | Show credit top-up message |
|
|
392
|
+
| 404 | Not Found | Show resource not found |
|
|
393
|
+
| 500 | Server Error | Show server error message |
|
|
394
|
+
| 502 | Bad Gateway | Show provider error |
|
|
395
|
+
|
|
396
|
+
### Error Response Format
|
|
397
|
+
|
|
398
|
+
```json
|
|
399
|
+
{
|
|
400
|
+
"success": false,
|
|
401
|
+
"message": "Error description"
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### CLI Error Messages
|
|
406
|
+
|
|
407
|
+
**Authentication Error:**
|
|
408
|
+
```
|
|
409
|
+
❌ API Error: Invalid API key
|
|
410
|
+
|
|
411
|
+
Authentication failed. Please check your API credentials.
|
|
412
|
+
Make sure KOB_API_KEY is correct.
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**Insufficient Credits:**
|
|
416
|
+
```
|
|
417
|
+
❌ API Error: Insufficient credits. Please top up your account.
|
|
418
|
+
|
|
419
|
+
Insufficient credits. Please top up your account.
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Resource Not Found:**
|
|
423
|
+
```
|
|
424
|
+
❌ API Error: Project not found
|
|
425
|
+
|
|
426
|
+
Resource not found.
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
## Data Type Specifications
|
|
430
|
+
|
|
431
|
+
### Provider Names
|
|
432
|
+
|
|
433
|
+
Valid provider names (case-sensitive):
|
|
434
|
+
- `DeepSeek`
|
|
435
|
+
- `OpenRouter` (or `OpenRouter (Kob AI Pro)`)
|
|
436
|
+
- `DeepInfra` (or `DeepInfra (Kob AI)`)
|
|
437
|
+
|
|
438
|
+
### Model IDs
|
|
439
|
+
|
|
440
|
+
Common model IDs:
|
|
441
|
+
|
|
442
|
+
**DeepSeek:**
|
|
443
|
+
- `deepseek-chat`
|
|
444
|
+
- `deepseek-reasoner`
|
|
445
|
+
- `deepseek-v4-pro`
|
|
446
|
+
- `deepseek-v4-flash`
|
|
447
|
+
|
|
448
|
+
**OpenRouter:**
|
|
449
|
+
- `openai/gpt-4o`
|
|
450
|
+
- `openai/gpt-4o-mini`
|
|
451
|
+
- `openai/gpt-4-turbo`
|
|
452
|
+
- `anthropic/claude-3.5-sonnet`
|
|
453
|
+
- `anthropic/claude-3.5-haiku`
|
|
454
|
+
- `google/gemini-1.5-pro`
|
|
455
|
+
- `google/gemini-1.5-flash`
|
|
456
|
+
|
|
457
|
+
**DeepInfra:**
|
|
458
|
+
- `meta-llama/Meta-Llama-3.1-8B-Instruct`
|
|
459
|
+
- `meta-llama/Meta-Llama-3.1-70B-Instruct`
|
|
460
|
+
- `Qwen/Qwen2.5-72B-Instruct`
|
|
461
|
+
|
|
462
|
+
### Parameter Ranges
|
|
463
|
+
|
|
464
|
+
**Temperature:**
|
|
465
|
+
- Range: 0.0 - 2.0
|
|
466
|
+
- Default: 0.7
|
|
467
|
+
- Lower = more deterministic
|
|
468
|
+
- Higher = more creative
|
|
469
|
+
|
|
470
|
+
**Max Tokens:**
|
|
471
|
+
- Range: 1 - 8192 (varies by model)
|
|
472
|
+
- Default: 4096
|
|
473
|
+
|
|
474
|
+
**Pagination:**
|
|
475
|
+
- `limit`: 1 - 100 (default: 20)
|
|
476
|
+
- `offset`: 0 - n (default: 0)
|
|
477
|
+
|
|
478
|
+
## Security Specifications
|
|
479
|
+
|
|
480
|
+
### Credential Management
|
|
481
|
+
|
|
482
|
+
1. **Storage:** Environment variables only (KOB_API_KEY, supports combined format `api_key:api_token`)
|
|
483
|
+
2. **Transmission:** In request body (not URL)
|
|
484
|
+
3. **Logging:** Never log credentials
|
|
485
|
+
4. **Validation:** Check presence before API calls
|
|
486
|
+
|
|
487
|
+
### Input Validation
|
|
488
|
+
|
|
489
|
+
1. **Required Fields:** Validate before API call
|
|
490
|
+
2. **String Length:** No specific limits (API enforces)
|
|
491
|
+
3. **Special Characters:** Allow all UTF-8
|
|
492
|
+
4. **UUIDs:** Validate format for IDs
|
|
493
|
+
|
|
494
|
+
## Performance Specifications
|
|
495
|
+
|
|
496
|
+
### Timeouts
|
|
497
|
+
|
|
498
|
+
- **Regular API calls:** 30 seconds
|
|
499
|
+
- **Streaming:** 60 seconds
|
|
500
|
+
- **Interactive mode:** No timeout (user-controlled)
|
|
501
|
+
|
|
502
|
+
### Rate Limiting
|
|
503
|
+
|
|
504
|
+
- No client-side rate limiting
|
|
505
|
+
- Server enforces rate limits
|
|
506
|
+
- Display error if rate limited
|
|
507
|
+
|
|
508
|
+
### Streaming Performance
|
|
509
|
+
|
|
510
|
+
- Buffer size: Default (Node.js)
|
|
511
|
+
- Display latency: < 100ms per chunk
|
|
512
|
+
- Memory: Linear with response size
|
|
513
|
+
|
|
514
|
+
## Testing Specifications
|
|
515
|
+
|
|
516
|
+
### Unit Tests (Future)
|
|
517
|
+
|
|
518
|
+
```typescript
|
|
519
|
+
// API Client
|
|
520
|
+
- post() with valid data
|
|
521
|
+
- post() with invalid credentials
|
|
522
|
+
- get() with query params
|
|
523
|
+
- stream() event parsing
|
|
524
|
+
- Error handling
|
|
525
|
+
|
|
526
|
+
// Commands
|
|
527
|
+
- auth:verify output format
|
|
528
|
+
- chat message formatting
|
|
529
|
+
- models filtering
|
|
530
|
+
- projects CRUD operations
|
|
531
|
+
- rules CRUD operations
|
|
532
|
+
- credits pagination
|
|
533
|
+
|
|
534
|
+
// Utilities
|
|
535
|
+
- formatDate() accuracy
|
|
536
|
+
- formatProjects() layout
|
|
537
|
+
- formatRules() layout
|
|
538
|
+
- validateRequired() checks
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### Integration Tests
|
|
542
|
+
|
|
543
|
+
1. **Full workflow test:**
|
|
544
|
+
- auth:verify → models → projects:create → rules:create → chat → credits:history
|
|
545
|
+
|
|
546
|
+
2. **Error scenarios:**
|
|
547
|
+
- Invalid credentials
|
|
548
|
+
- Insufficient credits
|
|
549
|
+
- Invalid project ID
|
|
550
|
+
- Network timeout
|
|
551
|
+
|
|
552
|
+
## Compatibility
|
|
553
|
+
|
|
554
|
+
### Runtime Requirements
|
|
555
|
+
|
|
556
|
+
- **Bun:** v1.0.0 or higher
|
|
557
|
+
- **TypeScript:** v5.0.0 or higher
|
|
558
|
+
- **Node.js:** Not required (Bun only)
|
|
559
|
+
|
|
560
|
+
### Platform Support
|
|
561
|
+
|
|
562
|
+
- ✅ Windows (tested)
|
|
563
|
+
- ✅ macOS (compatible)
|
|
564
|
+
- ✅ Linux (compatible)
|
|
565
|
+
|
|
566
|
+
### Terminal Support
|
|
567
|
+
|
|
568
|
+
- ✅ Modern terminals (UTF-8, colors)
|
|
569
|
+
- ⚠️ Legacy terminals (may have color issues)
|
|
570
|
+
- ✅ CI/CD environments
|
|
571
|
+
|
|
572
|
+
## Version History
|
|
573
|
+
|
|
574
|
+
### v1.0.0 (Current)
|
|
575
|
+
|
|
576
|
+
- Initial release
|
|
577
|
+
- All core commands implemented
|
|
578
|
+
- Full API coverage
|
|
579
|
+
- Streaming support
|
|
580
|
+
- Interactive chat mode
|
|
581
|
+
- Comprehensive documentation
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require('child_process');
|
|
3
|
+
const { resolve } = require('path');
|
|
4
|
+
|
|
5
|
+
const entry = resolve(__dirname, '..', 'src', 'index.ts');
|
|
6
|
+
const bun = spawnSync('bun', [entry], { stdio: 'inherit', shell: true });
|
|
7
|
+
|
|
8
|
+
if (bun.error) {
|
|
9
|
+
console.error('');
|
|
10
|
+
console.error(' ╔═══════════════════════════════════════════════╗');
|
|
11
|
+
console.error(' ║ ║');
|
|
12
|
+
console.error(' ║ KOB CLI requires Bun to be installed! ║');
|
|
13
|
+
console.error(' ║ ║');
|
|
14
|
+
console.error(' ║ Install Bun: https://bun.sh ║');
|
|
15
|
+
console.error(' ║ ║');
|
|
16
|
+
console.error(' ╚═══════════════════════════════════════════════╝');
|
|
17
|
+
console.error('');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
process.exit(bun.status ?? 0);
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kob-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "KOB CLI — AI-powered code generation tool. Built by Kob AI, made in Thailand.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"kob": "bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"src/",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"README.md",
|
|
14
|
+
"AGENTS.md",
|
|
15
|
+
"INSTALL.md",
|
|
16
|
+
"MANUAL.md",
|
|
17
|
+
"QUICKSTART.md",
|
|
18
|
+
"SPECTS.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"dev": "bun run src/index.ts",
|
|
22
|
+
"start": "bun run src/index.ts",
|
|
23
|
+
"build": "bun build src/index.ts --compile --outfile kob-cli",
|
|
24
|
+
"prepublishOnly": "bun run build"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18.0.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependenciesMeta": {
|
|
30
|
+
"bun": {
|
|
31
|
+
"optional": true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"author": {
|
|
38
|
+
"name": "Kob AI",
|
|
39
|
+
"url": "https://www.kob-ai.dev"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/thekaroe-thailand/kobcli.git"
|
|
44
|
+
},
|
|
45
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
46
|
+
"homepage": "https://www.kob-ai.dev",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/thekaroe-thailand/kobcli/issues"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"kob",
|
|
52
|
+
"ai",
|
|
53
|
+
"cli",
|
|
54
|
+
"code-generation",
|
|
55
|
+
"chat",
|
|
56
|
+
"terminal",
|
|
57
|
+
"thailand"
|
|
58
|
+
],
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/bun": "^1.3.14",
|
|
61
|
+
"@types/inquirer": "^9.0.9",
|
|
62
|
+
"@types/react": "^19.2.16"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"typescript": "^5"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"chalk": "^5.6.2",
|
|
69
|
+
"commander": "^15.0.0",
|
|
70
|
+
"ink": "^7.0.5",
|
|
71
|
+
"inquirer": "^14.0.2",
|
|
72
|
+
"ora": "^9.4.0",
|
|
73
|
+
"react": "^19.2.7",
|
|
74
|
+
"react-devtools-core": "^7.0.1"
|
|
75
|
+
}
|
|
76
|
+
}
|