@vaultgradient/pipequery-lang 1.6.0 → 1.9.1

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.
Files changed (2) hide show
  1. package/README.md +54 -4
  2. package/package.json +5 -1
package/README.md CHANGED
@@ -18,8 +18,8 @@
18
18
 
19
19
  ## Features
20
20
 
21
+ ### Engine (npm library)
21
22
  - **Pipe-based syntax** — chain operations with `|`, inspired by Unix pipes and SQL
22
- - **MCP server** — plug pipequery into Claude Desktop, Claude Code, Cursor, Copilot, or any MCP client with one command
23
23
  - **Minimal dependencies** — lightweight core engine
24
24
  - **TypeScript-first** — full type definitions included
25
25
  - **25+ aggregate functions** — basic, statistical, and financial aggregations
@@ -27,6 +27,15 @@
27
27
  - **Editor support** — CodeMirror 6, Monaco, and TextMate grammars
28
28
  - **React components** — visual pipeline builder out of the box
29
29
 
30
+ ### CLI (`pq`)
31
+ - **MCP server** — plug pipequery into Claude Desktop, Claude Code, Cursor, Copilot, or any MCP client with one command
32
+ - **11 data sources** — REST, WebSocket, file, static, Postgres, MySQL, SQLite, Kafka, Snowflake, ClickHouse, MongoDB
33
+ - **Push-down to SQL + Mongo** — pipe expressions targeting Postgres / MySQL / Snowflake / ClickHouse compile to native SQL; targeting MongoDB compile to `find()` / `aggregate()`. No in-memory materialization for those engines.
34
+ - **Telegram bot + natural language** — `pq telegram serve` exposes the same MCP verbs in chat; pass `--anthropic-key` and Claude translates plain English into pipequery
35
+ - **Alert watches** — `pq watch add` polls a query and posts a Telegram notification on a state transition
36
+ - **Live API endpoints** — `pq endpoint add /api/foo -q "..."` exposes a JSON endpoint immediately, no config edit
37
+ - **Terminal dashboard** — resizable TUI with 7 visualization types and live SSE updates
38
+
30
39
  ## Install
31
40
 
32
41
  ```bash
@@ -35,7 +44,7 @@ npm install @vaultgradient/pipequery-lang
35
44
 
36
45
  ## CLI — `pq`
37
46
 
38
- PipeQuery also ships a CLI tool for building data pipelines, REST APIs, and rich terminal dashboards.
47
+ PipeQuery also ships a CLI tool for building data pipelines, live API endpoints, terminal dashboards, MCP servers, and Telegram bots.
39
48
 
40
49
  ```bash
41
50
  npm install -g @vaultgradient/pipequery-cli
@@ -51,7 +60,25 @@ pq endpoint add /api/top-coins -q "crypto | sort(market_cap desc) | first(10)"
51
60
  # → http://localhost:3000/api/top-coins is instantly available
52
61
  ```
53
62
 
54
- Create API endpoints on the fly without editing config files — just `pq endpoint add` with a PipeQuery expression and your endpoint is live immediately.
63
+ ### Data sources
64
+
65
+ 11 source types out of the box, all addable at runtime via `pq source add`:
66
+
67
+ | Type | What it polls / streams | Push-down |
68
+ |------|--------------------------|-----------|
69
+ | `rest` | HTTP GET, with `${ENV_VAR}` interpolation in url/headers/params and optional `auth: bearer` | — |
70
+ | `websocket` | WSS stream with optional `subscribe` payload + `heartbeat` keepalive (Binance / Coinbase / Kraken / etc.) | — |
71
+ | `file` | Local JSON / CSV with optional `watch:` mode | — |
72
+ | `static` | Inline JSON in yaml | — |
73
+ | `postgres` (incl. TimescaleDB) | SELECT query | ✅ where/sort/first/select/distinct/rollup/aggregates → SQL |
74
+ | `mysql` / MariaDB | SELECT query | ✅ same operator set, MySQL dialect |
75
+ | `sqlite` | Local SQLite file | — |
76
+ | `kafka` (incl. Redpanda) | Topic subscriber, ring-buffered | — |
77
+ | `snowflake` | SELECT query against Snowflake | ✅ same operator set, Snowflake dialect |
78
+ | `clickhouse` | SELECT query over HTTP/HTTPS | ✅ same operator set, ClickHouse dialect |
79
+ | `mongodb` | `find()` against a collection (with optional default filter) | ✅ where/sort/first/select → `find()`; rollup/aggregates → `aggregate()` |
80
+
81
+ Push-down is auto-routed: when a pipe expression targets a source whose adapter supports it, the engine compiles to native SQL (or Mongo plan) and runs it on the database — no in-memory materialization. Unsupported pipeline shapes transparently fall back to in-process execution.
55
82
 
56
83
  ### Run with Docker
57
84
 
@@ -77,10 +104,33 @@ The dashboard features a resizable 2-column grid with live SSE updates and 7 vis
77
104
  ```bash
78
105
  pq mcp serve # stdio — plug into Claude Desktop / Cursor / Claude Code
79
106
  pq mcp serve --http --port 3001 # HTTP/SSE — for remote clients or hosted deployments
107
+ pq mcp serve --http --auth-token "$PIPEQUERY_MCP_TOKEN" # bearer-token auth on the HTTP transport
80
108
  pq mcp serve --attach http://localhost:3000 # attach to a running `pq serve`
81
109
  ```
82
110
 
83
- Your AI agent gets 5 tools: `query`, `list_sources`, `describe_source`, `list_endpoints`, `call_endpoint`. See [`cli/README.md`](./cli/README.md#use-with-ai-mcp) for client setup recipes.
111
+ Your AI agent gets 5 tools: `query`, `list_sources`, `describe_source`, `list_endpoints`, `call_endpoint`. Push-down auto-routing applies here too — agents asking *"top 5 paid orders"* against a Postgres / MySQL / Snowflake / ClickHouse / Mongo source compile to native SQL or Mongo plans automatically. See [`cli/README.md`](./cli/README.md#use-with-ai-mcp) for client setup recipes.
112
+
113
+ ## Telegram bot + alerts
114
+
115
+ ```bash
116
+ # Bot exposes the same MCP verbs as Telegram slash commands
117
+ PIPEQUERY_TG_BOT_TOKEN=<token> pq telegram serve --allow-user @yourname
118
+
119
+ # Add --anthropic-key to enable plain-English questions (Haiku 4.5 + prompt caching)
120
+ ANTHROPIC_API_KEY=sk-ant-... pq telegram serve --allow-user @yourname
121
+
122
+ # Add --log-file ./bot.jsonl to record every event as JSONL for jq / SIEM analysis
123
+ pq telegram serve --allow-user @yourname --log-file ./bot.jsonl
124
+
125
+ # Alert watches — query → notification on state transition
126
+ pq watch add btc-dip \
127
+ --query "crypto | where(symbol == 'BTC' && price < 50000)" \
128
+ --interval 60s --fire-when when_non_empty \
129
+ --telegram-chat-id -1001234567890 \
130
+ --telegram-message "🚨 BTC dipped: \${{ .price }}"
131
+ ```
132
+
133
+ Bot commands mirror MCP tools (`/sources`, `/describe`, `/endpoints`, `/call`, `/query`); plain text gets translated to pipequery via Anthropic's API when configured. Watches support `when_non_empty` (default), `when_empty`, and `on_change` fire conditions — idempotent across the chosen mode, no flapping. See [`cli/README.md`](./cli/README.md#use-from-telegram) for the full surface.
84
134
 
85
135
  ## Quick Start
86
136
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaultgradient/pipequery-lang",
3
- "version": "1.6.0",
3
+ "version": "1.9.1",
4
4
  "description": "Pipe-based query language for filtering, transforming, and aggregating data",
5
5
  "type": "module",
6
6
  "main": "./dist/engine/index.cjs",
@@ -45,6 +45,7 @@
45
45
  ],
46
46
  "scripts": {
47
47
  "build": "tsup",
48
+ "typecheck": "tsc",
48
49
  "test": "vitest run",
49
50
  "test:watch": "vitest",
50
51
  "prepublishOnly": "npm run build"
@@ -62,6 +63,9 @@
62
63
  ],
63
64
  "author": "andreadito",
64
65
  "license": "MIT",
66
+ "engines": {
67
+ "node": ">=24"
68
+ },
65
69
  "repository": {
66
70
  "type": "git",
67
71
  "url": "git+https://github.com/andreadito/pipequery.git"