@quereus/quoomb-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 +113 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# quoomb-cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for [Quereus](https://github.com/gotchoices/quereus) — an interactive SQL shell and file execution tool.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g quoomb-cli
|
|
9
|
+
# or run directly with npx
|
|
10
|
+
npx quoomb
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Interactive Mode
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Start REPL with in-memory database
|
|
19
|
+
quoomb
|
|
20
|
+
|
|
21
|
+
# Start with persistent database
|
|
22
|
+
quoomb --store ./data
|
|
23
|
+
|
|
24
|
+
# Connect to sync coordinator
|
|
25
|
+
quoomb --sync http://localhost:3000/sync
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Execute SQL Files
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Run a SQL file
|
|
32
|
+
quoomb script.sql
|
|
33
|
+
|
|
34
|
+
# Run with persistent storage
|
|
35
|
+
quoomb --store ./data script.sql
|
|
36
|
+
|
|
37
|
+
# Run multiple files
|
|
38
|
+
quoomb schema.sql data.sql queries.sql
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Pipe SQL from stdin
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
echo "SELECT 1 + 1 as result" | quoomb
|
|
45
|
+
|
|
46
|
+
cat queries.sql | quoomb --store ./data
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Commands
|
|
50
|
+
|
|
51
|
+
In interactive mode, use dot-commands for meta operations:
|
|
52
|
+
|
|
53
|
+
| Command | Description |
|
|
54
|
+
|---------|-------------|
|
|
55
|
+
| `.tables` | List all tables |
|
|
56
|
+
| `.schema [table]` | Show table schema |
|
|
57
|
+
| `.indexes [table]` | List indexes |
|
|
58
|
+
| `.mode [mode]` | Output mode: table, json, csv, line |
|
|
59
|
+
| `.output [file]` | Send output to file |
|
|
60
|
+
| `.read [file]` | Execute SQL from file |
|
|
61
|
+
| `.quit` | Exit the REPL |
|
|
62
|
+
|
|
63
|
+
## Options
|
|
64
|
+
|
|
65
|
+
| Option | Description |
|
|
66
|
+
|--------|-------------|
|
|
67
|
+
| `--store <path>` | Use persistent LevelDB storage |
|
|
68
|
+
| `--sync <url>` | Connect to sync coordinator |
|
|
69
|
+
| `--format <mode>` | Output format: table, json, csv |
|
|
70
|
+
| `--no-header` | Omit column headers in output |
|
|
71
|
+
| `--help` | Show help |
|
|
72
|
+
| `--version` | Show version |
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Create a table and insert data
|
|
78
|
+
$ quoomb
|
|
79
|
+
quereus> CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);
|
|
80
|
+
quereus> INSERT INTO users VALUES (1, 'Alice'), (2, 'Bob');
|
|
81
|
+
quereus> SELECT * FROM users;
|
|
82
|
+
┌────┬───────┐
|
|
83
|
+
│ id │ name │
|
|
84
|
+
├────┼───────┤
|
|
85
|
+
│ 1 │ Alice │
|
|
86
|
+
│ 2 │ Bob │
|
|
87
|
+
└────┴───────┘
|
|
88
|
+
quereus> .quit
|
|
89
|
+
|
|
90
|
+
# JSON output for scripting
|
|
91
|
+
$ echo "SELECT * FROM users" | quoomb --store ./data --format json
|
|
92
|
+
[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]
|
|
93
|
+
|
|
94
|
+
# CSV export
|
|
95
|
+
$ quoomb --store ./data --format csv -c "SELECT * FROM users" > users.csv
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Plugins
|
|
99
|
+
|
|
100
|
+
The CLI automatically loads:
|
|
101
|
+
- `@quereus/plugin-store` - Persistent storage with LevelDB
|
|
102
|
+
- `@quereus/plugin-sync` - CRDT sync (when `--sync` is provided)
|
|
103
|
+
|
|
104
|
+
## Related Packages
|
|
105
|
+
|
|
106
|
+
- [`quereus`](../quereus/) - Core SQL engine
|
|
107
|
+
- [`@quereus/plugin-store`](../quereus-plugin-store/) - Storage plugin
|
|
108
|
+
- [`@quereus/sync-coordinator`](../sync-coordinator/) - Server for sync
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT
|
|
113
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quereus/quoomb-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Quoomb CLI - Interactive REPL for Quereus SQL engine",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"quoomb": "./dist/bin/quoomb.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"!**/*.tsbuildinfo"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"clean": "rimraf dist",
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"dev": "tsc && node dist/bin/quoomb.js",
|
|
26
|
+
"lint": "eslint src/**/*.ts",
|
|
27
|
+
"test": "vitest",
|
|
28
|
+
"prepublish": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.15.29",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^8.33.0",
|
|
33
|
+
"@typescript-eslint/parser": "^8.33.0",
|
|
34
|
+
"eslint": "^9.28.0",
|
|
35
|
+
"rimraf": "^6.1.2",
|
|
36
|
+
"tsx": "^4.19.4",
|
|
37
|
+
"typescript": "^5.8.3",
|
|
38
|
+
"vitest": "^3.1.4"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@quereus/plugin-loader": "*",
|
|
42
|
+
"@quereus/quereus": "*",
|
|
43
|
+
"chalk": "^5.4.1",
|
|
44
|
+
"cli-table3": "^0.6.5",
|
|
45
|
+
"commander": "^14.0.0",
|
|
46
|
+
"papaparse": "^5.5.3",
|
|
47
|
+
"readline": "^1.3.0"
|
|
48
|
+
}
|
|
49
|
+
}
|