fastclaw-cli 0.1.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/README.md +117 -0
- package/dist/index.js +1413 -0
- package/dist/sdk.d.ts +312 -0
- package/dist/sdk.js +409 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# fastclaw-cli
|
|
2
|
+
|
|
3
|
+
CLI and SDK for managing [FastClaw](https://claw.yesy.dev) bots.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Zero-install setup wizard
|
|
9
|
+
npx fastclaw-cli setup
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
12
|
+
npm install -g fastclaw-cli
|
|
13
|
+
fastclaw setup
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The setup wizard will walk you through:
|
|
17
|
+
1. Connecting to your FastClaw server
|
|
18
|
+
2. Creating an App
|
|
19
|
+
3. Creating a Bot
|
|
20
|
+
4. Configuring a Model Provider (Gemini/Claude/GPT)
|
|
21
|
+
5. Starting the Bot
|
|
22
|
+
6. Optionally adding an IM channel (Feishu/Telegram/Slack/Discord)
|
|
23
|
+
|
|
24
|
+
## Usage as SDK
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { FastClawClient } from "fastclaw-cli";
|
|
28
|
+
|
|
29
|
+
const client = new FastClawClient({
|
|
30
|
+
url: "https://claw.yesy.dev",
|
|
31
|
+
appToken: "ft_your_app_token",
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Create and start a bot
|
|
35
|
+
const bot = await client.createBot({ user_id: "default", name: "my-bot" });
|
|
36
|
+
await client.addProvider(bot.id, { name: "google", apiKey: "...", models: [...] });
|
|
37
|
+
await client.setDefaults(bot.id, { primary_model: "google/gemini-2.5-flash" });
|
|
38
|
+
await client.startBot(bot.id);
|
|
39
|
+
await client.waitForReady(bot.id);
|
|
40
|
+
|
|
41
|
+
const info = await client.getBotConnect(bot.id);
|
|
42
|
+
console.log("Webchat:", info.webchat_url);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
fastclaw setup # Interactive one-step bot creation
|
|
49
|
+
|
|
50
|
+
fastclaw config set|get|show # Manage local config (~/.fastclaw/config.json)
|
|
51
|
+
|
|
52
|
+
fastclaw admin apps create|list|delete|rotate-token
|
|
53
|
+
|
|
54
|
+
fastclaw bot create|list|get|update|delete
|
|
55
|
+
fastclaw bot start|stop|restart|status|connect|reset-token <id>
|
|
56
|
+
|
|
57
|
+
fastclaw model add|list|get|delete <bot-id> [provider]
|
|
58
|
+
fastclaw model defaults get|set <bot-id>
|
|
59
|
+
|
|
60
|
+
fastclaw channel add|list|remove <bot-id> [channel]
|
|
61
|
+
fastclaw channel pairing list|approve|revoke|users <bot-id> <channel>
|
|
62
|
+
|
|
63
|
+
fastclaw device list|approve|revoke <bot-id>
|
|
64
|
+
|
|
65
|
+
fastclaw skill list|set|delete <bot-id>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Global Options
|
|
69
|
+
|
|
70
|
+
| Flag | Env Variable | Description |
|
|
71
|
+
|------|-------------|-------------|
|
|
72
|
+
| `--url <url>` | `FASTCLAW_URL` | Server URL (default: `https://claw.yesy.dev`) |
|
|
73
|
+
| `--admin-token <token>` | `FASTCLAW_ADMIN_TOKEN` | Admin API token |
|
|
74
|
+
| `--app-token <token>` | `FASTCLAW_APP_TOKEN` | App API token |
|
|
75
|
+
| `--json` | — | Output as JSON |
|
|
76
|
+
|
|
77
|
+
### Config Priority
|
|
78
|
+
|
|
79
|
+
CLI flags > Environment variables > `~/.fastclaw/config.json` > Built-in defaults
|
|
80
|
+
|
|
81
|
+
## Model Provider Presets
|
|
82
|
+
|
|
83
|
+
| Provider | Models | Default |
|
|
84
|
+
|----------|--------|---------|
|
|
85
|
+
| google | gemini-2.5-flash, gemini-2.5-pro | google/gemini-2.5-flash |
|
|
86
|
+
| anthropic | claude-sonnet-4-20250514 | anthropic/claude-sonnet-4-20250514 |
|
|
87
|
+
| openai | gpt-5.1 | openai/gpt-5.1 |
|
|
88
|
+
|
|
89
|
+
## SDK API
|
|
90
|
+
|
|
91
|
+
The `FastClawClient` class exposes all FastClaw API operations:
|
|
92
|
+
|
|
93
|
+
### Admin
|
|
94
|
+
- `createApp(req)` / `listApps()` / `deleteApp(id)` / `rotateAppToken(id)`
|
|
95
|
+
|
|
96
|
+
### Bots
|
|
97
|
+
- `createBot(req)` / `listBots(userId)` / `getBot(id)` / `updateBot(id, req)` / `deleteBot(id)`
|
|
98
|
+
- `startBot(id)` / `stopBot(id)` / `restartBot(id)` / `getBotStatus(id)` / `getBotConnect(id)`
|
|
99
|
+
- `resetBotToken(id)` / `waitForReady(id, timeoutMs?, intervalMs?)`
|
|
100
|
+
|
|
101
|
+
### Model Providers
|
|
102
|
+
- `addProvider(botId, provider)` / `listProviders(botId)` / `getProvider(botId, name)` / `deleteProvider(botId, name)`
|
|
103
|
+
- `getDefaults(botId)` / `setDefaults(botId, defaults)`
|
|
104
|
+
|
|
105
|
+
### Channels
|
|
106
|
+
- `addChannel(botId, req)` / `listChannels(botId)` / `removeChannel(botId, channel, account?)`
|
|
107
|
+
- `listPairing(botId, channel)` / `approvePairing(botId, channel, req)` / `revokePairing(botId, channel, req)`
|
|
108
|
+
|
|
109
|
+
### Devices
|
|
110
|
+
- `listDevices(botId, opts?)` / `approveDevice(botId, requestId)` / `revokeDevice(botId, deviceId, role?)`
|
|
111
|
+
|
|
112
|
+
### Skills
|
|
113
|
+
- `listSkills(botId)` / `setSkill(botId, name, req)` / `deleteSkill(botId, name)`
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT
|