clawsql 0.2.6 → 0.2.8
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 +100 -301
- package/dist/cli/raw-input.d.ts +9 -1
- package/dist/cli/raw-input.d.ts.map +1 -1
- package/dist/cli/raw-input.js +146 -10
- package/dist/cli/raw-input.js.map +1 -1
- package/dist/cli/repl.d.ts.map +1 -1
- package/dist/cli/repl.js +94 -29
- package/dist/cli/repl.js.map +1 -1
- package/dist/cli/ui/components.d.ts.map +1 -1
- package/dist/cli/ui/components.js +21 -5
- package/dist/cli/ui/components.js.map +1 -1
- package/docker/Dockerfile.allinone +3 -6
- package/package.json +2 -4
- package/docker/Dockerfile +0 -61
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ MySQL High Availability Management Platform with automatic failover, read/write
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
+
- **Template-Based Provisioning**: Create clusters from predefined templates in one command
|
|
7
8
|
- **Automatic Failover**: Detect primary failures and promote replicas automatically
|
|
8
9
|
- **Read/Write Splitting**: ProxySQL integration for transparent traffic routing
|
|
9
10
|
- **Topology Management**: Orchestrator-powered MySQL cluster management
|
|
@@ -19,128 +20,90 @@ MySQL High Availability Management Platform with automatic failover, read/write
|
|
|
19
20
|
|
|
20
21
|
## Installation
|
|
21
22
|
|
|
22
|
-
### Via npm (Recommended)
|
|
23
|
-
|
|
24
23
|
```bash
|
|
25
24
|
npm install -g clawsql
|
|
26
25
|
```
|
|
27
26
|
|
|
28
|
-
### From Source
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
git clone https://github.com/clawsql/clawsql.git
|
|
32
|
-
cd clawsql
|
|
33
|
-
npm install
|
|
34
|
-
npm run build
|
|
35
|
-
```
|
|
36
|
-
|
|
37
27
|
## Quick Start
|
|
38
28
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### Option 1: Demo Mode (Recommended for Testing)
|
|
42
|
-
|
|
43
|
-
Start with a pre-configured demo MySQL cluster:
|
|
29
|
+
### 1. Install and Start Platform
|
|
44
30
|
|
|
45
31
|
```bash
|
|
46
32
|
# Install ClawSQL
|
|
47
33
|
npm install -g clawsql
|
|
48
34
|
|
|
49
|
-
# Pull
|
|
50
|
-
clawsql install
|
|
35
|
+
# Pull Docker images (one-time setup)
|
|
36
|
+
clawsql install
|
|
51
37
|
|
|
52
|
-
# Start
|
|
38
|
+
# Start platform services
|
|
53
39
|
clawsql
|
|
54
|
-
> /start
|
|
40
|
+
> /start
|
|
55
41
|
```
|
|
56
42
|
|
|
57
|
-
|
|
58
|
-
- ClawSQL platform (API, Orchestrator, ProxySQL, Prometheus, Grafana)
|
|
59
|
-
- Demo MySQL cluster (1 primary + 2 replicas) using host networking
|
|
43
|
+
### 2. Create MySQL Admin User
|
|
60
44
|
|
|
61
|
-
|
|
45
|
+
On each MySQL instance, create the admin user:
|
|
62
46
|
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
> /instances register <host-ip> 3308
|
|
68
|
-
|
|
69
|
-
# Set up replication (creates repl user automatically)
|
|
70
|
-
> /instances setup-replication --host <host-ip>:3307 --master <host-ip>:3306
|
|
71
|
-
> /instances setup-replication --host <host-ip>:3308 --master <host-ip>:3306
|
|
72
|
-
|
|
73
|
-
# Sync to ProxySQL
|
|
74
|
-
> /clusters sync
|
|
47
|
+
```sql
|
|
48
|
+
CREATE USER 'clawsql'@'%' IDENTIFIED WITH mysql_native_password BY 'clawsql_password';
|
|
49
|
+
GRANT ALL PRIVILEGES ON *.* TO 'clawsql'@'%' WITH GRANT OPTION;
|
|
50
|
+
FLUSH PRIVILEGES;
|
|
75
51
|
```
|
|
76
52
|
|
|
77
|
-
###
|
|
53
|
+
### 3. Provision a Cluster
|
|
78
54
|
|
|
79
|
-
|
|
55
|
+
Choose a template and provision your cluster:
|
|
80
56
|
|
|
81
57
|
```bash
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
# Pull required Docker images
|
|
86
|
-
clawsql install
|
|
87
|
-
|
|
88
|
-
# Start the interactive CLI
|
|
89
|
-
clawsql
|
|
58
|
+
# View available templates
|
|
59
|
+
> /clusters provision
|
|
90
60
|
|
|
91
|
-
#
|
|
92
|
-
> /
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
# mysql -e "CREATE USER 'clawsql'@'%' IDENTIFIED WITH mysql_native_password BY 'clawsql_password'; GRANT ALL ON *.* TO 'clawsql'@'%' WITH GRANT OPTION;"
|
|
96
|
-
|
|
97
|
-
# Discover MySQL instances on your network
|
|
98
|
-
> /instances discover 172.18.0.0/24 --auto-register
|
|
99
|
-
|
|
100
|
-
# Or register instances manually
|
|
101
|
-
> /instances register mysql-primary 3306
|
|
61
|
+
# Quick provision a 3-node production cluster
|
|
62
|
+
> /clusters quick standard mycluster mysql1:3306,mysql2:3306,mysql3:3306
|
|
63
|
+
Cluster "mycluster" ready at port 6033
|
|
64
|
+
```
|
|
102
65
|
|
|
103
|
-
|
|
104
|
-
|
|
66
|
+
That's it! ClawSQL automatically:
|
|
67
|
+
- Sets up GTID-based replication (first host = primary, others = replicas)
|
|
68
|
+
- Configures ProxySQL with a dedicated port (6033, 6034, etc.)
|
|
69
|
+
- Registers instances with Orchestrator for topology management
|
|
105
70
|
|
|
106
|
-
|
|
107
|
-
> /clusters sync
|
|
71
|
+
### Connect to Your Cluster
|
|
108
72
|
|
|
109
|
-
|
|
110
|
-
|
|
73
|
+
```bash
|
|
74
|
+
# Connect through ProxySQL (read/write split is automatic)
|
|
75
|
+
mysql -h 127.0.0.1 -P 6033 -u clawsql -pclawsql_password
|
|
111
76
|
```
|
|
112
77
|
|
|
113
|
-
##
|
|
78
|
+
## Predefined Templates
|
|
114
79
|
|
|
115
|
-
|
|
80
|
+
| Template | Nodes | Mode | Use Case |
|
|
81
|
+
|----------|-------|------|----------|
|
|
82
|
+
| `dev-single` | 1 | async | Development/testing, CI/CD |
|
|
83
|
+
| `dev-replica` | 2 | async | Development with backup |
|
|
84
|
+
| `standard` | 3 | async | General production workloads |
|
|
85
|
+
| `ha-semisync` | 3 | semi-sync | Critical production, zero data loss |
|
|
86
|
+
| `read-heavy` | 5 | async | Analytics, reporting, high read throughput |
|
|
87
|
+
| `production-ha` | 4 | semi-sync | Mission-critical, enterprise databases |
|
|
88
|
+
| `geo-distributed` | 6 | async | Multi-region, disaster recovery |
|
|
116
89
|
|
|
117
|
-
|
|
118
|
-
|---------|-----|-------------|
|
|
119
|
-
| ClawSQL API | http://localhost:8080 | REST API |
|
|
120
|
-
| API Docs | http://localhost:8080/docs | OpenAPI documentation |
|
|
121
|
-
| Orchestrator | http://localhost:3000 | MySQL topology manager |
|
|
122
|
-
| Prometheus | http://localhost:9090 | Metrics collection |
|
|
123
|
-
| Grafana | http://localhost:3001 | Dashboards (admin/admin) |
|
|
124
|
-
| ProxySQL | localhost:6033+ | MySQL traffic (per-cluster ports) |
|
|
125
|
-
| OpenClaw Gateway | ws://localhost:18789 | AI agent gateway |
|
|
126
|
-
| OpenClaw UI | http://localhost:18790 | AI control panel |
|
|
90
|
+
Templates are auto-initialized on startup. No manual creation needed.
|
|
127
91
|
|
|
128
|
-
|
|
92
|
+
## Demo Mode
|
|
129
93
|
|
|
130
|
-
|
|
94
|
+
Test ClawSQL with a pre-configured demo cluster:
|
|
131
95
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
| Replica 1 | 3307 | clawsql/clawsql_password |
|
|
136
|
-
| Replica 2 | 3308 | clawsql/clawsql_password |
|
|
96
|
+
```bash
|
|
97
|
+
# Pull demo images
|
|
98
|
+
clawsql install --demo
|
|
137
99
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
>
|
|
100
|
+
# Start with demo MySQL cluster
|
|
101
|
+
clawsql
|
|
102
|
+
> /start --demo
|
|
103
|
+
|
|
104
|
+
# Provision the demo instances into a cluster
|
|
105
|
+
> /clusters quick standard demo <host-ip>:3306,<host-ip>:3307,<host-ip>:3308
|
|
106
|
+
```
|
|
144
107
|
|
|
145
108
|
## CLI Commands
|
|
146
109
|
|
|
@@ -148,119 +111,54 @@ When started with `--demo`, MySQL containers use host networking to simulate rea
|
|
|
148
111
|
|
|
149
112
|
```bash
|
|
150
113
|
/install [--demo] # Pull Docker images (required before first start)
|
|
151
|
-
# --demo: Include MySQL demo cluster images
|
|
152
|
-
# --detail: Show verbose output
|
|
153
|
-
|
|
154
114
|
/start [--demo] # Start ClawSQL platform
|
|
155
|
-
# --demo: Start with demo MySQL cluster
|
|
156
|
-
# --pull: Force pull missing images
|
|
157
|
-
|
|
158
115
|
/stop # Stop all services
|
|
159
|
-
/status # Show platform status
|
|
116
|
+
/status # Show platform status
|
|
160
117
|
/cleanup # Remove all containers and data
|
|
161
118
|
/doctor # Run diagnostics and suggest fixes
|
|
162
119
|
```
|
|
163
120
|
|
|
164
|
-
###
|
|
121
|
+
### Cluster Provisioning (Primary Method)
|
|
165
122
|
|
|
166
123
|
```bash
|
|
167
|
-
|
|
168
|
-
/
|
|
169
|
-
/config set <key> <value> # Set configuration value
|
|
170
|
-
/config get <key> # Get configuration value
|
|
171
|
-
```
|
|
124
|
+
# Interactive mode - shows template selection
|
|
125
|
+
/clusters provision
|
|
172
126
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
- `mysql.admin_password` - MySQL admin password
|
|
176
|
-
- `mysql.repl_user` - MySQL replication username
|
|
177
|
-
- `mysql.repl_password` - MySQL replication password
|
|
178
|
-
- `orchestrator.url` - Orchestrator URL
|
|
179
|
-
- `proxysql.host` - ProxySQL hostname
|
|
180
|
-
- `proxysql.admin_port` - ProxySQL admin port
|
|
181
|
-
- `failover.auto_enabled` - Enable auto failover (true/false)
|
|
182
|
-
- `log.level` - Log level (DEBUG/INFO/WARNING/ERROR/SILENT)
|
|
127
|
+
# Provision with template
|
|
128
|
+
/clusters provision --template <template> --cluster <name> --hosts <h:p,...>
|
|
183
129
|
|
|
184
|
-
|
|
130
|
+
# Quick provisioning (minimal arguments)
|
|
131
|
+
/clusters quick <template> <cluster> <h:p,...>
|
|
185
132
|
|
|
186
|
-
|
|
187
|
-
/
|
|
188
|
-
/instances discover <network> [options] # Scan network for MySQL
|
|
189
|
-
--user <user> MySQL username for discovery
|
|
190
|
-
--password <pass> MySQL password
|
|
191
|
-
--port <port> Port range (default: 3306)
|
|
192
|
-
--auto-register Auto-register discovered instances
|
|
193
|
-
|
|
194
|
-
/instances register <host> [port] [options] # Register instance manually
|
|
195
|
-
<host> MySQL hostname or IP (use host IP for demo)
|
|
196
|
-
[port] MySQL port (default: 3306)
|
|
197
|
-
--user <user> MySQL username (default: from config)
|
|
198
|
-
--password <pass> MySQL password
|
|
199
|
-
|
|
200
|
-
/instances remove <host> [port] # Remove instance
|
|
201
|
-
|
|
202
|
-
/instances setup-replication --host <replica:port> --master <primary:port>
|
|
203
|
-
# Configure replication (creates repl user automatically)
|
|
133
|
+
# Deprovision
|
|
134
|
+
/clusters deprovision <cluster> --force
|
|
204
135
|
```
|
|
205
136
|
|
|
206
137
|
### Cluster Management
|
|
207
138
|
|
|
208
|
-
ClawSQL uses a **provisioning-first approach** - create clusters from predefined templates for consistent, validated configurations.
|
|
209
|
-
|
|
210
139
|
```bash
|
|
211
|
-
#
|
|
212
|
-
/clusters
|
|
213
|
-
/clusters provision --template <name> --cluster <name> --hosts <h:p,...>
|
|
214
|
-
# Provision cluster from template
|
|
215
|
-
# First host becomes primary, rest become replicas
|
|
216
|
-
# Auto-configures replication and ProxySQL with dedicated port
|
|
217
|
-
|
|
218
|
-
/clusters quick <template> <cluster> <h:p,...> # Fast provisioning (minimal args)
|
|
219
|
-
/clusters deprovision <cluster> --force # Remove provisioned cluster
|
|
220
|
-
|
|
221
|
-
# View clusters and topology
|
|
222
|
-
/clusters list # List all clusters
|
|
223
|
-
/clusters topology [--name <cluster>] # Show topology
|
|
224
|
-
|
|
225
|
-
# Manual operations (for advanced use cases)
|
|
226
|
-
/clusters manual create --name <name> --primary <h:p> [--replicas <h:p,...>]
|
|
227
|
-
/clusters manual import --primary <h:p> # Import existing topology
|
|
228
|
-
/clusters manual sync [--name <cluster>] # Sync to ProxySQL
|
|
229
|
-
/clusters manual promote --name <cluster> --host <h:p> # Promote replica
|
|
140
|
+
/clusters list # List all clusters
|
|
141
|
+
/clusters topology [--name <name>] # Show topology
|
|
230
142
|
```
|
|
231
143
|
|
|
232
|
-
###
|
|
233
|
-
|
|
234
|
-
Templates are automatically initialized on platform startup. No need to create them manually:
|
|
144
|
+
### Manual Operations (Advanced)
|
|
235
145
|
|
|
236
|
-
|
|
237
|
-
|----------|-------|------|----------|
|
|
238
|
-
| `dev-single` | 1 | async | Development/testing, CI/CD |
|
|
239
|
-
| `dev-replica` | 2 | async | Development with backup |
|
|
240
|
-
| `standard` | 3 | async | General production workloads |
|
|
241
|
-
| `ha-semisync` | 3 | semi-sync | Critical production, zero data loss |
|
|
242
|
-
| `read-heavy` | 5 | async | Analytics, reporting, high read throughput |
|
|
243
|
-
| `production-ha` | 4 | semi-sync | Mission-critical, enterprise databases |
|
|
244
|
-
| `geo-distributed` | 6 | async | Multi-region, disaster recovery |
|
|
146
|
+
For existing topologies or special cases:
|
|
245
147
|
|
|
246
|
-
Quick example:
|
|
247
148
|
```bash
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
149
|
+
/clusters manual import --primary <h:p> # Import existing topology
|
|
150
|
+
/clusters manual create --name <n> --primary <h:p> [--replicas <h:p,...>]
|
|
151
|
+
/clusters manual sync [--name <cluster>] # Sync to ProxySQL
|
|
152
|
+
/clusters manual promote --name <n> --host <h:p>
|
|
251
153
|
```
|
|
252
154
|
|
|
253
|
-
###
|
|
155
|
+
### Instance Management
|
|
254
156
|
|
|
255
157
|
```bash
|
|
256
|
-
/
|
|
257
|
-
/
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
--description <desc> Optional description
|
|
261
|
-
|
|
262
|
-
/templates show <name> # Show template details
|
|
263
|
-
/templates delete <name> --force # Delete custom template (predefined cannot be deleted)
|
|
158
|
+
/instances list # List discovered instances
|
|
159
|
+
/instances discover <network> --auto-register # Scan network for MySQL
|
|
160
|
+
/instances register <host> [port] # Register instance manually
|
|
161
|
+
/instances remove <host> [port] # Remove instance
|
|
264
162
|
```
|
|
265
163
|
|
|
266
164
|
### Failover Operations
|
|
@@ -268,52 +166,44 @@ Cluster "mycluster" ready at port 6033
|
|
|
268
166
|
```bash
|
|
269
167
|
/failover status # Show failover configuration
|
|
270
168
|
/failover history # Show operation history
|
|
271
|
-
/failover switchover <cluster> [target] # Planned primary change
|
|
272
|
-
/failover failover <cluster> [target] # Emergency failover
|
|
273
|
-
/failover recover list # List instances pending recovery
|
|
274
|
-
/failover recover <instance> # Recover specific instance
|
|
275
|
-
/failover recover --all # Recover all pending instances
|
|
169
|
+
/failover switchover <cluster> [target] # Planned primary change
|
|
170
|
+
/failover failover <cluster> [target] # Emergency failover
|
|
276
171
|
```
|
|
277
172
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
### Additional Commands
|
|
173
|
+
### Template Management
|
|
281
174
|
|
|
282
175
|
```bash
|
|
283
|
-
/
|
|
284
|
-
/
|
|
285
|
-
/
|
|
286
|
-
/
|
|
287
|
-
/cron remove <task-id> # Remove scheduled task
|
|
288
|
-
/notify send --message "<msg>" # Send notification
|
|
176
|
+
/templates list # List available templates
|
|
177
|
+
/templates show <name> # Show template details
|
|
178
|
+
/templates create --name <name> [--replicas <n>] [--mode <async|semi-sync>]
|
|
179
|
+
/templates delete <name> --force # Delete custom template
|
|
289
180
|
```
|
|
290
181
|
|
|
182
|
+
## Services
|
|
183
|
+
|
|
184
|
+
| Service | URL | Description |
|
|
185
|
+
|---------|-----|-------------|
|
|
186
|
+
| ClawSQL API | http://localhost:8080 | REST API |
|
|
187
|
+
| API Docs | http://localhost:8080/docs | OpenAPI documentation |
|
|
188
|
+
| Orchestrator | http://localhost:3000 | MySQL topology manager |
|
|
189
|
+
| Prometheus | http://localhost:9090 | Metrics collection |
|
|
190
|
+
| Grafana | http://localhost:3001 | Dashboards (admin/admin) |
|
|
191
|
+
| ProxySQL | localhost:6033+ | MySQL traffic (per-cluster ports) |
|
|
192
|
+
| OpenClaw Gateway | ws://localhost:18789 | AI agent gateway |
|
|
193
|
+
| OpenClaw UI | http://localhost:18790 | AI control panel |
|
|
194
|
+
|
|
291
195
|
## MySQL Configuration Requirements
|
|
292
196
|
|
|
293
197
|
### Admin User (Required)
|
|
294
198
|
|
|
295
|
-
Create the `clawsql` admin user on your MySQL instances. This user is used by ClawSQL for topology discovery, monitoring, and management:
|
|
296
|
-
|
|
297
199
|
```sql
|
|
298
200
|
CREATE USER 'clawsql'@'%' IDENTIFIED WITH mysql_native_password BY 'clawsql_password';
|
|
299
201
|
GRANT ALL PRIVILEGES ON *.* TO 'clawsql'@'%' WITH GRANT OPTION;
|
|
300
202
|
FLUSH PRIVILEGES;
|
|
301
203
|
```
|
|
302
204
|
|
|
303
|
-
### Replication User (Created Automatically)
|
|
304
|
-
|
|
305
|
-
The replication user is created automatically by ClawSQL when you run `/instances setup-replication`. If you want to set up replication manually:
|
|
306
|
-
|
|
307
|
-
```sql
|
|
308
|
-
CREATE USER 'repl'@'%' IDENTIFIED WITH mysql_native_password BY 'repl_password';
|
|
309
|
-
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
|
|
310
|
-
FLUSH PRIVILEGES;
|
|
311
|
-
```
|
|
312
|
-
|
|
313
205
|
### MySQL Server Configuration
|
|
314
206
|
|
|
315
|
-
For replication, your MySQL instances should have:
|
|
316
|
-
|
|
317
207
|
```ini
|
|
318
208
|
[mysqld]
|
|
319
209
|
server-id = 1 # Unique for each server
|
|
@@ -324,25 +214,6 @@ enforce-gtid-consistency = ON
|
|
|
324
214
|
log-slave-updates = ON
|
|
325
215
|
```
|
|
326
216
|
|
|
327
|
-
## Configuration
|
|
328
|
-
|
|
329
|
-
Configuration is managed via environment variables. Copy `.env.example` to `.env`:
|
|
330
|
-
|
|
331
|
-
```bash
|
|
332
|
-
cp .env.example .env
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
Key settings:
|
|
336
|
-
|
|
337
|
-
| Variable | Default | Description |
|
|
338
|
-
|----------|---------|-------------|
|
|
339
|
-
| `API_PORT` | 8080 | API server port |
|
|
340
|
-
| `API_TOKEN_SECRET` | change-me | JWT secret (change in production!) |
|
|
341
|
-
| `MYSQL_ADMIN_USER` | clawsql | MySQL admin username |
|
|
342
|
-
| `MYSQL_ADMIN_PASSWORD` | clawsql_password | MySQL admin password |
|
|
343
|
-
| `AUTO_FAILOVER_ENABLED` | true | Enable automatic failover |
|
|
344
|
-
| `LOG_LEVEL` | INFO | Logging level |
|
|
345
|
-
|
|
346
217
|
## Architecture
|
|
347
218
|
|
|
348
219
|
```
|
|
@@ -355,14 +226,11 @@ Key settings:
|
|
|
355
226
|
│ ProxySQL │
|
|
356
227
|
│ (Read/Write Splitting) │
|
|
357
228
|
│ Per-Cluster Ports: 6033 (cluster1), 6034 (cluster2), ... │
|
|
358
|
-
│ Port 6032 - Admin Interface │
|
|
359
229
|
└───────────────┬─────────────────────────────┬───────────────────┘
|
|
360
230
|
│ │
|
|
361
231
|
┌───────▼───────┐ ┌───────▼───────┐
|
|
362
232
|
│ Primary │ │ Replica │
|
|
363
233
|
│ (Writer) │────────────▶│ (Reader) │
|
|
364
|
-
│ Hostgroup N │ Repl │ Hostgroup N+10│
|
|
365
|
-
│ Port 3306 │ │ Port 3306 │
|
|
366
234
|
└───────────────┘ └───────────────┘
|
|
367
235
|
│ │
|
|
368
236
|
└──────────────┬──────────────┘
|
|
@@ -370,20 +238,16 @@ Key settings:
|
|
|
370
238
|
┌──────────────────────────────▼──────────────────────────────────┐
|
|
371
239
|
│ ClawSQL │
|
|
372
240
|
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
373
|
-
│ │ Orchestrator│ │ Failover │
|
|
374
|
-
│ │
|
|
375
|
-
│
|
|
376
|
-
│ ┌─────────────┐ ┌─────────────────────────────────────────────┐│
|
|
377
|
-
│ │ Provisioning│ │ OpenClaw AI Gateway ││
|
|
378
|
-
│ │ Engine │ │ Port 18789 - Gateway | Port 18790 ││
|
|
379
|
-
│ │ (Templates) │ └─────────────────────────────────────────────┘│
|
|
241
|
+
│ │ Provisioning│ │ Orchestrator│ │ Failover │ │
|
|
242
|
+
│ │ Engine │ │ Client │ │ Engine │ │
|
|
243
|
+
│ │ (Templates) │ └─────────────┘ └─────────────┘ │
|
|
380
244
|
│ └─────────────┘ │
|
|
381
245
|
└─────────────────────────────────────────────────────────────────┘
|
|
382
246
|
```
|
|
383
247
|
|
|
384
248
|
## AI Agent Integration
|
|
385
249
|
|
|
386
|
-
ClawSQL integrates with [OpenClaw](https://github.com/openclaw/openclaw) for AI-powered database operations
|
|
250
|
+
ClawSQL integrates with [OpenClaw](https://github.com/openclaw/openclaw) for AI-powered database operations:
|
|
387
251
|
|
|
388
252
|
```
|
|
389
253
|
clawsql> show me the cluster topology
|
|
@@ -391,79 +255,15 @@ clawsql> what's the replication lag?
|
|
|
391
255
|
clawsql> help me troubleshoot replication issues
|
|
392
256
|
```
|
|
393
257
|
|
|
394
|
-
See **[AI Integration Documentation](docs/AI.md)** for details
|
|
258
|
+
See **[AI Integration Documentation](docs/AI.md)** for details.
|
|
395
259
|
|
|
396
260
|
## Development
|
|
397
261
|
|
|
398
262
|
```bash
|
|
399
|
-
# Install dependencies
|
|
400
263
|
npm install
|
|
401
|
-
|
|
402
|
-
# Build TypeScript
|
|
403
264
|
npm run build
|
|
404
|
-
|
|
405
|
-
# Run CLI locally
|
|
406
|
-
node dist/bin/clawsql.js
|
|
407
|
-
|
|
408
|
-
# Run tests
|
|
409
265
|
npm test
|
|
410
|
-
|
|
411
|
-
# Run with file watcher
|
|
412
|
-
npm run dev
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
### Project Structure
|
|
416
|
-
|
|
417
|
-
```
|
|
418
|
-
clawsql/
|
|
419
|
-
├── src/
|
|
420
|
-
│ ├── index.ts # Entry point
|
|
421
|
-
│ ├── app.ts # Fastify application setup
|
|
422
|
-
│ ├── config/ # Configuration management
|
|
423
|
-
│ ├── types/ # TypeScript types and interfaces
|
|
424
|
-
│ ├── core/ # Core business logic
|
|
425
|
-
│ │ ├── discovery/ # Instance discovery and topology
|
|
426
|
-
│ │ ├── monitoring/ # Metrics and health checks
|
|
427
|
-
│ │ ├── failover/ # Failover operations
|
|
428
|
-
│ │ ├── provisioning/ # Template-based cluster provisioning
|
|
429
|
-
│ │ └── routing/ # ProxySQL integration
|
|
430
|
-
│ ├── api/ # REST API routes
|
|
431
|
-
│ ├── cli/ # CLI commands
|
|
432
|
-
│ │ └── utils/ # CLI utilities (arg parsing, etc.)
|
|
433
|
-
│ ├── utils/ # Utilities
|
|
434
|
-
│ └── __tests__/ # Test files
|
|
435
|
-
├── docker/ # Docker configurations
|
|
436
|
-
├── scripts/ # Utility scripts
|
|
437
|
-
├── package.json # Node.js dependencies
|
|
438
|
-
└── tsconfig.json # TypeScript configuration
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
## Troubleshooting
|
|
442
|
-
|
|
443
|
-
### Check Platform Health
|
|
444
|
-
|
|
445
|
-
```bash
|
|
446
|
-
clawsql -c "/doctor"
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
### View Logs
|
|
450
|
-
|
|
451
|
-
```bash
|
|
452
|
-
docker compose logs -f clawsql
|
|
453
|
-
docker compose logs -f orchestrator
|
|
454
|
-
docker compose logs -f proxysql
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
### Check MySQL Replication
|
|
458
|
-
|
|
459
|
-
```bash
|
|
460
|
-
docker exec mysql-replica-1 mysql -uroot -prootpassword -e "SHOW REPLICA STATUS\G"
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
### Reset ProxySQL
|
|
464
|
-
|
|
465
|
-
```bash
|
|
466
|
-
docker exec proxysql mysql -h127.0.0.1 -P6032 -uadmin -padmin -e "DELETE FROM mysql_servers; LOAD MYSQL SERVERS TO RUNTIME;"
|
|
266
|
+
node dist/bin/clawsql.js
|
|
467
267
|
```
|
|
468
268
|
|
|
469
269
|
## Documentation
|
|
@@ -473,7 +273,6 @@ docker exec proxysql mysql -h127.0.0.1 -P6032 -uadmin -padmin -e "DELETE FROM my
|
|
|
473
273
|
- [API Documentation](docs/API.md) - REST API reference
|
|
474
274
|
- [Demo Guide](docs/DEMO.md) - Testing with demo cluster
|
|
475
275
|
- [Failover Documentation](docs/failover.md) - Failover architecture and operations
|
|
476
|
-
- [System Architecture](docs/architecture/system_design.md) - Technical details
|
|
477
276
|
|
|
478
277
|
## License
|
|
479
278
|
|
package/dist/cli/raw-input.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface InputResult {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare class RawInputHandler {
|
|
27
27
|
private buffer;
|
|
28
|
+
private cursorPos;
|
|
28
29
|
private filteredSuggestions;
|
|
29
30
|
private selectedIndex;
|
|
30
31
|
private showingSuggestions;
|
|
@@ -36,7 +37,14 @@ export declare class RawInputHandler {
|
|
|
36
37
|
private pasteTimeout;
|
|
37
38
|
private static readonly PASTE_TIMEOUT_MS;
|
|
38
39
|
private bracketedPasteSupported;
|
|
39
|
-
|
|
40
|
+
private history;
|
|
41
|
+
private historyIndex;
|
|
42
|
+
private savedBuffer;
|
|
43
|
+
constructor(prompt?: string, history?: string[]);
|
|
44
|
+
/**
|
|
45
|
+
* Update history array (called from REPL after command execution)
|
|
46
|
+
*/
|
|
47
|
+
setHistory(history: string[]): void;
|
|
40
48
|
/**
|
|
41
49
|
* Enable bracketed paste mode (for better paste handling)
|
|
42
50
|
* Returns true if the terminal likely supports it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw-input.d.ts","sourceRoot":"","sources":["../../src/cli/raw-input.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;G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