archer-wizard 0.2.1 → 0.2.3
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/ARCHITECTURE.md +378 -0
- package/README.md +115 -134
- package/dist/lib/ascii.js +1 -1
- package/dist/lib/ascii.js.map +1 -1
- package/dist/types/index.d.ts +1 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/wizard/detector.js +3 -3
- package/dist/wizard/detector.js.map +1 -1
- package/dist/wizard/injector.d.ts.map +1 -1
- package/dist/wizard/injector.js +17 -7
- package/dist/wizard/injector.js.map +1 -1
- package/dist/wizard/rules.d.ts.map +1 -1
- package/dist/wizard/rules.js +50 -28
- package/dist/wizard/rules.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/ascii.ts +1 -1
- package/src/types/index.ts +1 -5
- package/src/wizard/detector.ts +3 -3
- package/src/wizard/injector.ts +23 -7
- package/src/wizard/rules.ts +50 -28
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
# Archer MCP — Complete Architecture Deep Dive
|
|
2
|
+
|
|
3
|
+
Archer is an **MCP server + persistent daemon** system that gives AI agents real-time event intelligence over Supabase databases. It operates in two modes: a **setup wizard** (interactive CLI) and an **MCP server** (stdio transport for AI agents), backed by a **TCP daemon** that holds Supabase Realtime channels independently of agent sessions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## High-Level Architecture
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
graph TB
|
|
11
|
+
subgraph "User's Machine"
|
|
12
|
+
CLI["npx archer-wizard<br/>(wizard mode)"]
|
|
13
|
+
MCP["MCP Server<br/>(--mcp mode)"]
|
|
14
|
+
Daemon["Daemon Process<br/>(detached, TCP :44380)"]
|
|
15
|
+
State["~/.archer/state.json"]
|
|
16
|
+
PID["~/.archer/daemon.pid"]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
subgraph "Agent Configs"
|
|
20
|
+
Cursor["Cursor mcp.json"]
|
|
21
|
+
Claude["Claude Desktop config"]
|
|
22
|
+
Windsurf["Windsurf mcp_config.json"]
|
|
23
|
+
OpenCode["OpenCode config"]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
subgraph "External"
|
|
27
|
+
Supabase["Supabase Realtime"]
|
|
28
|
+
Webhook["User Webhook URLs"]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
CLI -->|"scans .env files"| CLI
|
|
32
|
+
CLI -->|"injects archer entry"| Cursor & Claude & Windsurf & OpenCode
|
|
33
|
+
|
|
34
|
+
MCP -->|"TCP IPC"| Daemon
|
|
35
|
+
Daemon -->|"persists"| State
|
|
36
|
+
Daemon -->|"writes"| PID
|
|
37
|
+
Daemon -->|"Realtime channels"| Supabase
|
|
38
|
+
Supabase -->|"postgres_changes event"| Daemon
|
|
39
|
+
Daemon -->|"POST payload"| Webhook
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Entry Point — [index.ts](file:///Users/amirlankalmukhan/archer-mcp/src/index.ts)
|
|
45
|
+
|
|
46
|
+
The single entry point routes between two modes based on CLI flags:
|
|
47
|
+
|
|
48
|
+
| Flag | Mode | Function |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `--mcp` | MCP Server | Starts stdio MCP server, auto-starts daemon via `ensureDaemon()` |
|
|
51
|
+
| *(none)* | Setup Wizard | Runs interactive `clack`-based CLI setup |
|
|
52
|
+
| `--daemon` | Daemon Process | Internal: starts the TCP daemon directly (used by lifecycle spawner) |
|
|
53
|
+
|
|
54
|
+
**MCP Server setup** registers 3 tools (`archer_watch`, `archer_unwatch`, `archer_watches`) on a `StdioServerTransport`, then calls `ensureDaemon()` to guarantee the background process is running.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Module 1: Daemon (`src/daemon/`)
|
|
59
|
+
|
|
60
|
+
The daemon is the heart of Archer — a **detached Node.js process** that holds Supabase Realtime subscriptions and delivers webhooks, surviving agent session restarts.
|
|
61
|
+
|
|
62
|
+
### IPC Protocol — [types.ts](file:///Users/amirlankalmukhan/archer-mcp/src/daemon/types.ts)
|
|
63
|
+
|
|
64
|
+
Defines JSON-over-TCP protocol on `127.0.0.1:44380`:
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// Request types (MCP → Daemon)
|
|
68
|
+
type IpcRequestType = 'add_watch' | 'remove_watch' | 'list_watches' | 'ping';
|
|
69
|
+
|
|
70
|
+
// WatchConfig carries everything needed to subscribe
|
|
71
|
+
interface WatchConfig {
|
|
72
|
+
id: string; // UUID
|
|
73
|
+
table: string;
|
|
74
|
+
event: '*' | 'INSERT' | 'UPDATE' | 'DELETE';
|
|
75
|
+
filter?: string;
|
|
76
|
+
webhookUrl: string;
|
|
77
|
+
supabaseUrl: string; // per-watch credentials for multi-project
|
|
78
|
+
supabaseKey: string;
|
|
79
|
+
createdAt: string; // ISO timestamp
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Key constant: `ARCHER_DIR = ~/.archer` — stores `state.json` + `daemon.pid`.
|
|
84
|
+
|
|
85
|
+
### Persistent Store — [store.ts](file:///Users/amirlankalmukhan/archer-mcp/src/daemon/store.ts)
|
|
86
|
+
|
|
87
|
+
Implements **atomic JSON persistence** at `~/.archer/state.json`:
|
|
88
|
+
|
|
89
|
+
- `loadState()` — reads + parses, returns empty `{ watches: {} }` on failure
|
|
90
|
+
- `saveState()` — writes to temp file first, then `fs.renameSync` for atomicity (no partial writes)
|
|
91
|
+
- State shape: `{ watches: Record<string, WatchConfig> }`
|
|
92
|
+
|
|
93
|
+
### TCP Server & Channel Manager — [process.ts](file:///Users/amirlankalmukhan/archer-mcp/src/daemon/process.ts)
|
|
94
|
+
|
|
95
|
+
The main daemon loop (~190 lines). On startup:
|
|
96
|
+
|
|
97
|
+
1. Loads persisted state from `state.json`
|
|
98
|
+
2. **Reconnects all saved watches** — for each `WatchConfig`, creates a Supabase client + Realtime channel
|
|
99
|
+
3. Starts TCP server on port `44380`
|
|
100
|
+
|
|
101
|
+
**IPC request handling:**
|
|
102
|
+
|
|
103
|
+
| Request | Action |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `add_watch` | Creates Supabase client, subscribes to `postgres_changes` channel, saves to state, begins delivering webhooks |
|
|
106
|
+
| `remove_watch` | Unsubscribes channel, removes from in-memory map + state file |
|
|
107
|
+
| `list_watches` | Returns all `WatchConfig` entries from state |
|
|
108
|
+
| `ping` | Returns `{ status: 'ok', watches: count }` |
|
|
109
|
+
|
|
110
|
+
**Channel subscription pattern:**
|
|
111
|
+
- Event `*` → subscribes to `INSERT`, `UPDATE`, `DELETE` separately
|
|
112
|
+
- Specific event → subscribes to just that one
|
|
113
|
+
- Filter support via Supabase's `filter` parameter on `postgres_changes`
|
|
114
|
+
|
|
115
|
+
**Webhook delivery** happens inline on each Realtime event — builds a payload with Archer metadata + the row data, then POSTs to the configured URL with retry logic (3 attempts, 2s delay).
|
|
116
|
+
|
|
117
|
+
### IPC Client — [client.ts](file:///Users/amirlankalmukhan/archer-mcp/src/daemon/client.ts)
|
|
118
|
+
|
|
119
|
+
Used by MCP tools to talk to the daemon:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
Tool → sendIpcRequest() → TCP connect → JSON write → read response → parse
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- `connectToDaemon()` — creates a `net.Socket`, connects to `127.0.0.1:44380`
|
|
126
|
+
- `sendIpcRequest()` — sends JSON line, reads response, returns parsed `IpcResponse`
|
|
127
|
+
- 5-second timeout on connections
|
|
128
|
+
|
|
129
|
+
### Lifecycle Manager — [lifecycle.ts](file:///Users/amirlankalmukhan/archer-mcp/src/daemon/lifecycle.ts)
|
|
130
|
+
|
|
131
|
+
Manages the daemon as a detached child process:
|
|
132
|
+
|
|
133
|
+
- `ensureDaemon()` — checks if daemon is already running (PID file + `ping`), spawns if not
|
|
134
|
+
- `startDaemon()` — `child_process.spawn` with `detached: true`, `stdio: 'ignore'`, saves PID file
|
|
135
|
+
- `stopDaemon()` — reads PID file, sends `SIGTERM`, removes PID file
|
|
136
|
+
- `isDaemonRunning()` — reads PID, sends `kill(pid, 0)` to check, falls back to TCP `ping`
|
|
137
|
+
|
|
138
|
+
Spawns: `node dist/daemon/run.js` as a fully detached process.
|
|
139
|
+
|
|
140
|
+
### Runner — [run.ts](file:///Users/amirlankalmukhan/archer-mcp/src/daemon/run.ts)
|
|
141
|
+
|
|
142
|
+
7-line entry point for the detached child process — just imports and calls `startDaemonProcess()`.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Module 2: MCP Tools (`src/tools/`)
|
|
147
|
+
|
|
148
|
+
Three tools exposed via the Model Context Protocol:
|
|
149
|
+
|
|
150
|
+
### archer_watch — [watch.ts](file:///Users/amirlankalmukhan/archer-mcp/src/tools/watch.ts)
|
|
151
|
+
|
|
152
|
+
Creates a persistent real-time watch. Accepts:
|
|
153
|
+
- `table` (required) — Supabase table name
|
|
154
|
+
- `event` — `INSERT` | `UPDATE` | `DELETE` | `*` (default: `*`)
|
|
155
|
+
- `filter` — optional Supabase filter expression
|
|
156
|
+
- `webhookUrl` (required) — destination for event payloads
|
|
157
|
+
|
|
158
|
+
**Flow:** Reads `SUPABASE_URL` + `SUPABASE_SERVICE_ROLE_KEY` from env → generates UUID → builds `WatchConfig` → sends `add_watch` IPC to daemon → returns watch ID to agent.
|
|
159
|
+
|
|
160
|
+
### archer_unwatch — [unwatch.ts](file:///Users/amirlankalmukhan/archer-mcp/src/tools/unwatch.ts)
|
|
161
|
+
|
|
162
|
+
Removes a watch by ID. Sends `remove_watch` IPC to daemon.
|
|
163
|
+
|
|
164
|
+
### archer_watches — [watches.ts](file:///Users/amirlankalmukhan/archer-mcp/src/tools/watches.ts)
|
|
165
|
+
|
|
166
|
+
Lists all active watches. Sends `list_watches` IPC to daemon, formats response as a readable list showing table, event, filter, webhook URL, and creation time.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Module 3: Setup Wizard (`src/wizard/`)
|
|
171
|
+
|
|
172
|
+
Interactive CLI that discovers credentials and injects Archer into AI agent configs.
|
|
173
|
+
|
|
174
|
+
### Orchestrator — [index.ts](file:///Users/amirlankalmukhan/archer-mcp/src/wizard/index.ts)
|
|
175
|
+
|
|
176
|
+
10-step `clack`-based flow:
|
|
177
|
+
|
|
178
|
+
1. Show ASCII art banner
|
|
179
|
+
2. Start clack intro
|
|
180
|
+
3. Scan project for Supabase credentials
|
|
181
|
+
4. Detect project framework (Next.js / Vite)
|
|
182
|
+
5. Prompt for any missing credentials
|
|
183
|
+
6. Detect installed AI agents
|
|
184
|
+
7. Inject Archer MCP config into agents
|
|
185
|
+
8. Filter successful injections
|
|
186
|
+
9. Inject agent rules (tool documentation)
|
|
187
|
+
10. Show success box
|
|
188
|
+
|
|
189
|
+
### Scanner — [scanner.ts](file:///Users/amirlankalmukhan/archer-mcp/src/wizard/scanner.ts)
|
|
190
|
+
|
|
191
|
+
Discovers Supabase credentials from the user's project:
|
|
192
|
+
|
|
193
|
+
**Env file priority:** `.env.local` > `.env` > `.env.development` > `.env.production`
|
|
194
|
+
|
|
195
|
+
**Key aliases searched:**
|
|
196
|
+
| Credential | Aliases |
|
|
197
|
+
|---|---|
|
|
198
|
+
| URL | `SUPABASE_URL`, `NEXT_PUBLIC_SUPABASE_URL`, `VITE_SUPABASE_URL` |
|
|
199
|
+
| Service Key | `SUPABASE_SERVICE_ROLE_KEY`, `SUPABASE_SERVICE_KEY` |
|
|
200
|
+
| Anon Key | `SUPABASE_ANON_KEY`, `NEXT_PUBLIC_SUPABASE_ANON_KEY`, `VITE_SUPABASE_ANON_KEY` |
|
|
201
|
+
|
|
202
|
+
Also **scans the entire codebase** (recursive file search, skipping `node_modules` and hidden dirs) for hardcoded credential patterns as a fallback.
|
|
203
|
+
|
|
204
|
+
`promptForMissing()` — interactive prompts with Zod validation for any credentials not found.
|
|
205
|
+
|
|
206
|
+
### Detector — [detector.ts](file:///Users/amirlankalmukhan/archer-mcp/src/wizard/detector.ts)
|
|
207
|
+
|
|
208
|
+
Discovers installed AI agents by checking platform-specific config paths:
|
|
209
|
+
|
|
210
|
+
| Agent | macOS Config Path |
|
|
211
|
+
|---|---|
|
|
212
|
+
| Cursor | `~/.cursor/mcp.json` |
|
|
213
|
+
| Claude Code | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
214
|
+
| OpenCode | `~/.config/opencode/opencode.json` |
|
|
215
|
+
| Antigravity | `~/.config/antigravity/config.json` |
|
|
216
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
|
|
217
|
+
|
|
218
|
+
Cross-platform: has `darwin`, `linux`, `win32` paths for each agent.
|
|
219
|
+
|
|
220
|
+
An agent is considered "installed" if its config file or parent directory exists.
|
|
221
|
+
|
|
222
|
+
### Injector — [injector.ts](file:///Users/amirlankalmukhan/archer-mcp/src/wizard/injector.ts)
|
|
223
|
+
|
|
224
|
+
Writes Archer's MCP server entry into each agent's config JSON:
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
// Standard format (Cursor, Claude, Windsurf, Antigravity)
|
|
228
|
+
{ "command": "npx", "args": ["-y", "archer-wizard@latest", "--mcp"],
|
|
229
|
+
"env": { "SUPABASE_URL": "...", "SUPABASE_SERVICE_ROLE_KEY": "..." } }
|
|
230
|
+
|
|
231
|
+
// OpenCode format
|
|
232
|
+
{ "type": "local", "command": ["npx", "-y", "archer-wizard@latest", "--mcp"],
|
|
233
|
+
"environment": { ... } }
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Reads existing config, merges without overwriting other MCP servers, writes back.
|
|
237
|
+
|
|
238
|
+
### Rules — [rules.ts](file:///Users/amirlankalmukhan/archer-mcp/src/wizard/rules.ts)
|
|
239
|
+
|
|
240
|
+
Injects a **markdown documentation block** into each agent's rules file so the agent knows about Archer's tools. Uses `<!-- archer:start -->` / `<!-- archer:end -->` comment markers for idempotent updates.
|
|
241
|
+
|
|
242
|
+
Content includes: tool descriptions, parameter docs, usage examples, trigger words ("watch", "monitor", "alert me", etc.).
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Module 4: Shared Libraries (`src/lib/`)
|
|
247
|
+
|
|
248
|
+
### ascii.ts — [ascii.ts](file:///Users/amirlankalmukhan/archer-mcp/src/lib/ascii.ts)
|
|
249
|
+
|
|
250
|
+
Terminal UI utilities:
|
|
251
|
+
- `showAsciiArt()` — green block-character ARCHER banner
|
|
252
|
+
- Status loggers: `logAction` (◆ blue), `logSuccess` (✓ green), `logError` (✗ red), `logProgress` (● white), `logReady` (▶ green)
|
|
253
|
+
- `maskCredential()` — shows first 3-8 chars + `******`
|
|
254
|
+
- `showSuccessBox()` — bordered box with setup summary
|
|
255
|
+
- `stderr*` variants — for MCP mode (stdout is reserved for JSON-RPC)
|
|
256
|
+
|
|
257
|
+
### supabase.ts — [supabase.ts](file:///Users/amirlankalmukhan/archer-mcp/src/lib/supabase.ts)
|
|
258
|
+
|
|
259
|
+
Supabase client factory + channel helpers:
|
|
260
|
+
- Singleton client from `SUPABASE_URL` + `SUPABASE_SERVICE_ROLE_KEY` env vars
|
|
261
|
+
- `createAuthChannel()` — listens to `auth.users` INSERT events
|
|
262
|
+
- `createTableChannel()` — listens to arbitrary table events in `public` schema
|
|
263
|
+
- `removeChannel()` — cleanup helper
|
|
264
|
+
|
|
265
|
+
### webhook.ts — [webhook.ts](file:///Users/amirlankalmukhan/archer-mcp/src/lib/webhook.ts)
|
|
266
|
+
|
|
267
|
+
HTTP webhook delivery with retry:
|
|
268
|
+
- 3 attempts, 2-second delay between retries
|
|
269
|
+
- Headers: `Content-Type: application/json`, `User-Agent: Archer/0.1.0`, `X-Archer-Event: <event>`
|
|
270
|
+
- `buildWebhookPayload()` — wraps data in `{ archer: { watchId, event, source, firedAt }, data }`
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Module 5: Type System (`src/types/index.ts`)
|
|
275
|
+
|
|
276
|
+
All shared types in one file, Zod-validated where applicable:
|
|
277
|
+
|
|
278
|
+
| Type | Purpose |
|
|
279
|
+
|---|---|
|
|
280
|
+
| `Framework` | `'nextjs' \| 'vite' \| 'unknown'` |
|
|
281
|
+
| `ScanResult` | Scanner output: credentials, framework, source file |
|
|
282
|
+
| `AgentInfo` | Detected agent: name, install status, config path |
|
|
283
|
+
| `WatchEvent` | Zod enum: `auth.signup`, `table.insert/update/delete` |
|
|
284
|
+
| `WatchInput` | Zod schema with refinement: table required for non-auth events |
|
|
285
|
+
| `WatchResult` | Tool response: success, watchId, message |
|
|
286
|
+
| `WebhookPayload` | Structured payload with archer metadata + data |
|
|
287
|
+
| `PostgresEvent` | `'INSERT' \| 'UPDATE' \| 'DELETE'` |
|
|
288
|
+
| `InjectionResult` | Agent injection outcome |
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Data Flow: End-to-End Watch Lifecycle
|
|
293
|
+
|
|
294
|
+
```mermaid
|
|
295
|
+
sequenceDiagram
|
|
296
|
+
participant Agent as AI Agent
|
|
297
|
+
participant MCP as MCP Server
|
|
298
|
+
participant Daemon as Daemon (:44380)
|
|
299
|
+
participant SB as Supabase
|
|
300
|
+
participant WH as Webhook URL
|
|
301
|
+
|
|
302
|
+
Agent->>MCP: archer_watch({ table, event, webhookUrl })
|
|
303
|
+
MCP->>MCP: Read SUPABASE_URL/KEY from env
|
|
304
|
+
MCP->>MCP: Generate UUID watchId
|
|
305
|
+
MCP->>Daemon: TCP: add_watch(WatchConfig)
|
|
306
|
+
Daemon->>Daemon: Create Supabase client
|
|
307
|
+
Daemon->>SB: Subscribe postgres_changes channel
|
|
308
|
+
Daemon->>Daemon: Save to state.json (atomic)
|
|
309
|
+
Daemon->>MCP: TCP: { success, watchId }
|
|
310
|
+
MCP->>Agent: "Watch created: {watchId}"
|
|
311
|
+
|
|
312
|
+
Note over SB,Daemon: Later, a database change occurs...
|
|
313
|
+
|
|
314
|
+
SB->>Daemon: Realtime: row INSERT/UPDATE/DELETE
|
|
315
|
+
Daemon->>Daemon: Build webhook payload
|
|
316
|
+
Daemon->>WH: POST { archer: {...}, data: {...} }
|
|
317
|
+
WH->>Daemon: 200 OK
|
|
318
|
+
|
|
319
|
+
Note over Agent,Daemon: Agent session can restart...
|
|
320
|
+
Note over Daemon: Daemon survives, keeps watching
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Key Design Decisions
|
|
326
|
+
|
|
327
|
+
| Decision | Rationale |
|
|
328
|
+
|---|---|
|
|
329
|
+
| **TCP IPC over Unix sockets** | Cross-platform (macOS, Linux, Windows) |
|
|
330
|
+
| **JSON lines protocol** | Simple, debuggable, no binary framing |
|
|
331
|
+
| **Detached daemon process** | Survives parent MCP server lifecycle |
|
|
332
|
+
| **Per-watch credentials** | Multi-project Supabase support |
|
|
333
|
+
| **Atomic state writes** | Temp file + rename prevents corruption |
|
|
334
|
+
| **Auto-start daemon** | `ensureDaemon()` on MCP boot — zero friction |
|
|
335
|
+
| **Agent-aware config injection** | Different JSON shapes for OpenCode vs others |
|
|
336
|
+
| **Idempotent rules injection** | HTML comment markers for safe re-runs |
|
|
337
|
+
| **Env file priority chain** | `.env.local` wins over `.env` — matches Next.js convention |
|
|
338
|
+
| **Codebase-wide credential scan** | Fallback when env files are missing |
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## File Map (17 source files)
|
|
343
|
+
|
|
344
|
+
```
|
|
345
|
+
src/
|
|
346
|
+
├── index.ts ← Entry point: --mcp / --daemon / wizard
|
|
347
|
+
├── daemon/
|
|
348
|
+
│ ├── types.ts ← IPC protocol, WatchConfig, constants
|
|
349
|
+
│ ├── store.ts ← Atomic JSON persistence (~/.archer/state.json)
|
|
350
|
+
│ ├── process.ts ← TCP server, Supabase channels, webhook delivery
|
|
351
|
+
│ ├── client.ts ← IPC client (tools → daemon)
|
|
352
|
+
│ ├── lifecycle.ts ← Start/stop/ensure daemon, PID management
|
|
353
|
+
│ └── run.ts ← Detached process entry point
|
|
354
|
+
├── tools/
|
|
355
|
+
│ ├── watch.ts ← archer_watch tool
|
|
356
|
+
│ ├── unwatch.ts ← archer_unwatch tool
|
|
357
|
+
│ └── watches.ts ← archer_watches tool
|
|
358
|
+
├── wizard/
|
|
359
|
+
│ ├── index.ts ← 10-step clack CLI orchestrator
|
|
360
|
+
│ ├── scanner.ts ← Credential discovery (env files + codebase)
|
|
361
|
+
│ ├── detector.ts ← AI agent detection (5 agents, 3 platforms)
|
|
362
|
+
│ ├── injector.ts ← MCP config injection
|
|
363
|
+
│ └── rules.ts ← Agent rules/docs injection
|
|
364
|
+
├── lib/
|
|
365
|
+
│ ├── ascii.ts ← Terminal UI (banner, loggers, stderr)
|
|
366
|
+
│ ├── supabase.ts ← Client factory + channel helpers
|
|
367
|
+
│ └── webhook.ts ← HTTP delivery with retry
|
|
368
|
+
└── types/
|
|
369
|
+
└── index.ts ← All shared types + Zod schemas
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
## Verification
|
|
373
|
+
|
|
374
|
+
- ✅ TypeScript build (`npm run build`) — zero errors
|
|
375
|
+
- ✅ All source files compiled to `dist/`
|
|
376
|
+
- ✅ IPC protocol uses JSON-over-TCP on `127.0.0.1:44380`
|
|
377
|
+
- ✅ State persists to `~/.archer/state.json` with atomic writes
|
|
378
|
+
- ✅ 5 AI agents supported across 3 platforms (macOS/Linux/Windows)
|
package/README.md
CHANGED
|
@@ -11,237 +11,218 @@
|
|
|
11
11
|
|
|
12
12
|
**event intelligence layer for AI agents**
|
|
13
13
|
|
|
14
|
+
[](https://www.npmjs.com/package/archer-wizard)
|
|
15
|
+
[](LICENSE)
|
|
16
|
+
|
|
14
17
|
</div>
|
|
15
18
|
|
|
16
19
|
---
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Zapier was built for apps talking to apps.
|
|
21
|
-
**Archer was built for the world talking to AI agents.**
|
|
22
|
-
|
|
23
|
-
Every AI agent today is reactive. Cursor, Claude Code, opencode — they sit completely idle until you manually talk to them. Nobody built the layer that lets them feel what's happening in real time and act on their own.
|
|
24
|
-
|
|
25
|
-
Archer is that layer.
|
|
26
|
-
|
|
27
|
-
You define a condition once in plain english. Archer watches your data sources 24/7. The moment that condition is true — your AI agent wakes up, already loaded with full context, and acts immediately. No prompting. No polling. No manual triggers.
|
|
21
|
+
Every AI agent today is reactive. It sits idle until you talk to it. Archer gives your agent a nervous system — it watches your database 24/7, and fires the moment something changes.
|
|
28
22
|
|
|
29
23
|
---
|
|
30
24
|
|
|
31
|
-
##
|
|
25
|
+
## quickstart
|
|
32
26
|
|
|
33
27
|
```bash
|
|
34
|
-
npx archer@latest
|
|
28
|
+
npx archer-wizard@latest
|
|
35
29
|
```
|
|
36
30
|
|
|
37
|
-
Run this inside any project folder. Archer
|
|
31
|
+
Run this inside any project folder. Archer scans for credentials, detects your agents, and injects itself — one command, no manual config.
|
|
38
32
|
|
|
39
33
|
---
|
|
40
34
|
|
|
41
|
-
##
|
|
35
|
+
## installation
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
your data source ──→ Archer watches 24/7 ──→ condition met ──→ agent fires
|
|
45
|
-
```
|
|
37
|
+
### one-liner (recommended)
|
|
46
38
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
4. **teaches** every agent when to call `archer.watch()` automatically via global rules
|
|
51
|
-
5. your agent now has a nervous system — it feels the world and acts on its own
|
|
39
|
+
```bash
|
|
40
|
+
npx archer-wizard@latest
|
|
41
|
+
```
|
|
52
42
|
|
|
53
|
-
|
|
43
|
+
Archer will:
|
|
44
|
+
1. Scan your `.env` files for Supabase credentials
|
|
45
|
+
2. Detect which AI agents are installed on your machine
|
|
46
|
+
3. Inject itself into all their MCP configs automatically
|
|
47
|
+
4. Teach every agent when to call `archer_watch` via rules
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+
### with explicit credentials
|
|
56
50
|
|
|
57
51
|
```bash
|
|
58
|
-
|
|
52
|
+
SUPABASE_URL=https://xyz.supabase.co \
|
|
53
|
+
SUPABASE_SERVICE_ROLE_KEY=your-key \
|
|
59
54
|
npx archer-wizard@latest
|
|
55
|
+
```
|
|
60
56
|
|
|
61
|
-
|
|
57
|
+
---
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
"watch my users table for new signups and fire https://your-webhook-url"
|
|
59
|
+
## MCP tools
|
|
65
60
|
|
|
66
|
-
|
|
61
|
+
Once set up, your agent has these tools available natively. You describe what you want in plain English — the agent calls them.
|
|
67
62
|
|
|
68
|
-
|
|
63
|
+
```bash
|
|
64
|
+
# Tell your agent:
|
|
65
|
+
"watch the users table and fire https://your-webhook.com on new inserts"
|
|
66
|
+
"monitor orders where status equals shipped"
|
|
67
|
+
"show all active watches"
|
|
68
|
+
"stop watching the payments table"
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
### `archer_watch`
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
```typescript
|
|
74
|
+
archer_watch({
|
|
75
|
+
table: string, // table to watch (required)
|
|
76
|
+
event?: string, // INSERT | UPDATE | DELETE | * (default: *)
|
|
77
|
+
filter?: string, // e.g. "status=eq.active", "amount=gt.1000"
|
|
78
|
+
webhookUrl: string // URL to POST when the event fires
|
|
79
|
+
})
|
|
80
|
+
```
|
|
74
81
|
|
|
75
|
-
|
|
82
|
+
### `archer_unwatch`
|
|
76
83
|
|
|
77
84
|
```typescript
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
event: string, // what to listen for
|
|
81
|
-
table?: string, // table name for table events
|
|
82
|
-
condition?: string, // plain english condition (optional)
|
|
83
|
-
webhookUrl: string // where to fire when condition is met
|
|
85
|
+
archer_unwatch({
|
|
86
|
+
watchId: string // ID returned by archer_watch
|
|
84
87
|
})
|
|
85
88
|
```
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
### `archer_watches`
|
|
88
91
|
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
when a new user signs up with a .edu email"
|
|
92
|
+
```typescript
|
|
93
|
+
archer_watches() // list all active watches with status
|
|
92
94
|
```
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
"watch my orders table for new inserts and notify https://your-webhook.com"
|
|
96
|
-
```
|
|
96
|
+
---
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
## supported agents
|
|
99
|
+
|
|
100
|
+
| agent | config location |
|
|
101
|
+
|---|---|
|
|
102
|
+
| Cursor | `~/.cursor/mcp.json` |
|
|
103
|
+
| Claude Code | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
104
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
|
|
105
|
+
| OpenCode | `~/.config/opencode/opencode.json` |
|
|
106
|
+
| Antigravity | `~/.config/antigravity/config.json` |
|
|
101
107
|
|
|
102
108
|
---
|
|
103
109
|
|
|
104
|
-
## supported events
|
|
110
|
+
## supported events
|
|
105
111
|
|
|
106
112
|
| event | description |
|
|
107
113
|
|---|---|
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
|
|
|
114
|
+
| `INSERT` | new row inserted into a table |
|
|
115
|
+
| `UPDATE` | existing row modified |
|
|
116
|
+
| `DELETE` | row removed |
|
|
117
|
+
| `*` | all of the above (default) |
|
|
118
|
+
| `filter` | narrow by any Supabase filter expression |
|
|
112
119
|
|
|
113
120
|
---
|
|
114
121
|
|
|
115
122
|
## webhook payload
|
|
116
123
|
|
|
117
|
-
Every
|
|
124
|
+
Every event POSTs this to your webhook URL:
|
|
118
125
|
|
|
119
126
|
```json
|
|
120
127
|
{
|
|
121
128
|
"archer": {
|
|
122
|
-
"watchId": "
|
|
123
|
-
"event": "
|
|
124
|
-
"
|
|
125
|
-
"firedAt": "
|
|
129
|
+
"watchId": "550e8400-e29b-41d4-a716-446655440000",
|
|
130
|
+
"event": "INSERT",
|
|
131
|
+
"table": "users",
|
|
132
|
+
"firedAt": "2025-03-16T09:15:00.000Z"
|
|
126
133
|
},
|
|
127
134
|
"data": {
|
|
128
135
|
"id": "row-id",
|
|
129
|
-
"email": "user@
|
|
130
|
-
"created_at": "
|
|
136
|
+
"email": "user@example.com",
|
|
137
|
+
"created_at": "2025-03-16T09:15:00.000Z"
|
|
131
138
|
}
|
|
132
139
|
}
|
|
133
140
|
```
|
|
134
141
|
|
|
135
|
-
|
|
142
|
+
Headers included on every request:
|
|
136
143
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
Archer auto-detects and injects into all of these:
|
|
140
|
-
|
|
141
|
-
| agent | status |
|
|
144
|
+
| header | value |
|
|
142
145
|
|---|---|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
| Google Antigravity | ✓ supported |
|
|
147
|
-
| Windsurf | ✓ supported |
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## supported data sources
|
|
152
|
-
|
|
153
|
-
Archer is built universal — any data source, any platform.
|
|
146
|
+
| `Content-Type` | `application/json` |
|
|
147
|
+
| `User-Agent` | `Archer/0.2.2` |
|
|
148
|
+
| `X-Archer-Event` | event type (INSERT / UPDATE / DELETE) |
|
|
154
149
|
|
|
155
|
-
|
|
156
|
-
|---|---|
|
|
157
|
-
| Supabase | ✓ available now |
|
|
158
|
-
| GitHub | coming soon |
|
|
159
|
-
| Stripe | coming soon |
|
|
160
|
-
| Linear | coming soon |
|
|
161
|
-
| Vercel | coming soon |
|
|
162
|
-
| custom webhooks | coming soon |
|
|
150
|
+
Archer retries failed deliveries 3 times with a 2s delay.
|
|
163
151
|
|
|
164
152
|
---
|
|
165
153
|
|
|
166
|
-
##
|
|
154
|
+
## credential discovery
|
|
167
155
|
|
|
168
|
-
Archer scans these files automatically in priority order:
|
|
156
|
+
Archer scans these files automatically, in priority order:
|
|
169
157
|
|
|
170
158
|
```
|
|
171
|
-
.env.local
|
|
159
|
+
.env.local ← checked first
|
|
172
160
|
.env
|
|
173
161
|
.env.development
|
|
174
162
|
.env.production
|
|
175
163
|
```
|
|
176
164
|
|
|
177
|
-
It recognizes
|
|
165
|
+
It recognizes common aliases automatically:
|
|
178
166
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
SUPABASE_URL
|
|
182
|
-
SUPABASE_SERVICE_ROLE_KEY
|
|
167
|
+
| credential | aliases checked |
|
|
168
|
+
|---|---|
|
|
169
|
+
| Supabase URL | `SUPABASE_URL`, `NEXT_PUBLIC_SUPABASE_URL`, `VITE_SUPABASE_URL` |
|
|
170
|
+
| Service key | `SUPABASE_SERVICE_ROLE_KEY`, `SUPABASE_SERVICE_KEY` |
|
|
171
|
+
| Anon key | `SUPABASE_ANON_KEY`, `NEXT_PUBLIC_SUPABASE_ANON_KEY`, `VITE_SUPABASE_ANON_KEY` |
|
|
183
172
|
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
If no env file is found, Archer scans your codebase for hardcoded values as a fallback.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## how it works
|
|
186
178
|
|
|
187
|
-
|
|
188
|
-
|
|
179
|
+
```
|
|
180
|
+
your agent calls archer_watch
|
|
181
|
+
↓
|
|
182
|
+
Archer daemon starts (detached, persists across sessions)
|
|
183
|
+
↓
|
|
184
|
+
subscribes to Supabase Realtime channel
|
|
185
|
+
↓
|
|
186
|
+
database change detected
|
|
187
|
+
↓
|
|
188
|
+
POST to your webhook URL (3 retries)
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
**The daemon runs at `127.0.0.1:44380` and survives MCP server restarts.** Watches are persisted to `~/.archer/state.json` — they resume automatically after machine restarts.
|
|
192
192
|
|
|
193
193
|
---
|
|
194
194
|
|
|
195
195
|
## requirements
|
|
196
196
|
|
|
197
197
|
- Node.js 18 or higher
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
- realtime enabled on tables you want to watch
|
|
198
|
+
- At least one supported AI agent installed
|
|
199
|
+
- A Supabase project with [Realtime enabled](https://supabase.com/docs/guides/realtime) on the tables you want to watch
|
|
201
200
|
|
|
202
201
|
---
|
|
203
202
|
|
|
204
|
-
##
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
developer's machine data source
|
|
208
|
-
─────────────────── ───────────
|
|
209
|
-
npx archer-wizard@latest realtime channel
|
|
210
|
-
↓ ↓
|
|
211
|
-
wizard scans .env Archer subscribes to changes 24/7
|
|
212
|
-
↓ ↓
|
|
213
|
-
injects into agents condition matched → webhook fires
|
|
214
|
-
↓ ↓
|
|
215
|
-
agent calls archer.watch() AI agent wakes up with full context
|
|
216
|
-
```
|
|
203
|
+
## supported data sources
|
|
217
204
|
|
|
218
|
-
|
|
205
|
+
| source | status |
|
|
206
|
+
|---|---|
|
|
207
|
+
| Supabase | ✓ available |
|
|
208
|
+
| PostgreSQL (direct) | coming soon |
|
|
209
|
+
| MySQL | coming soon |
|
|
210
|
+
| GitHub events | coming soon |
|
|
211
|
+
| Stripe webhooks | coming soon |
|
|
219
212
|
|
|
220
213
|
---
|
|
221
214
|
|
|
222
|
-
##
|
|
223
|
-
|
|
224
|
-
- no dashboard
|
|
225
|
-
- no account required
|
|
226
|
-
- no sign in
|
|
227
|
-
- no API key
|
|
228
|
-
- no cloud service
|
|
229
|
-
|
|
230
|
-
Everything runs locally on your machine using your own credentials. The architecture is universal from day one — the simplicity is intentional.
|
|
215
|
+
## architecture
|
|
231
216
|
|
|
217
|
+
See [ARCHITECTURE.md](./ARCHITECTURE.md) for a full deep dive — daemon IPC protocol, state persistence, MCP tool implementation, and the setup wizard pipeline.
|
|
232
218
|
|
|
219
|
+
---
|
|
233
220
|
|
|
234
|
-
|
|
235
|
-
# Install from npm
|
|
236
|
-
npx archer-wizard@latest
|
|
221
|
+
## no account. no cloud. no dashboard.
|
|
237
222
|
|
|
238
|
-
|
|
239
|
-
git clone https://github.com/amirlan-labs/archer-mcp
|
|
240
|
-
cd archer-mcp
|
|
241
|
-
npm install
|
|
242
|
-
npm run dev
|
|
243
|
-
```
|
|
223
|
+
Archer runs entirely on your machine using your own credentials. No sign-in, no API keys, no data leaves your infrastructure.
|
|
244
224
|
|
|
225
|
+
---
|
|
245
226
|
|
|
246
227
|
<div align="center">
|
|
247
228
|
|
package/dist/lib/ascii.js
CHANGED
|
@@ -50,7 +50,7 @@ export function showSuccessBox(agentCount) {
|
|
|
50
50
|
` ${pc.green('▶')} Archer is ready`,
|
|
51
51
|
'',
|
|
52
52
|
` injected into ${agentCount} agent${agentCount !== 1 ? 's' : ''}`,
|
|
53
|
-
' connected to your
|
|
53
|
+
' connected to your backend',
|
|
54
54
|
'',
|
|
55
55
|
' open your AI agent and say:',
|
|
56
56
|
` ${pc.dim('"watch my users table for new signups"')}`,
|
package/dist/lib/ascii.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ascii.js","sourceRoot":"","sources":["../../src/lib/ascii.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,qCAAqC;AACrC,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AAErC,yDAAyD;AACzD,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC;AAE9B,+DAA+D;AAE/D,MAAM,UAAU,YAAY;IAC1B,MAAM,KAAK,GAAG;QACZ,EAAE;QACF,oDAAoD;QACpD,oDAAoD;QACpD,oDAAoD;QACpD,oDAAoD;QACpD,oDAAoD;QACpD,oDAAoD;QACpD,EAAE;KACH,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,+DAA+D;AAE/D,MAAM,UAAU,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C,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,+DAA+D;AAE/D,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -76,9 +76,5 @@ export interface InjectionResult {
|
|
|
76
76
|
success: boolean;
|
|
77
77
|
error?: string;
|
|
78
78
|
}
|
|
79
|
-
export
|
|
80
|
-
command: string;
|
|
81
|
-
args: string[];
|
|
82
|
-
env: Record<string, string>;
|
|
83
|
-
}
|
|
79
|
+
export type McpServerEntry = Record<string, unknown>;
|
|
84
80
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAItD,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAID,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG,UAAU,GAAG,aAAa,GAAG,UAAU,CAAC;AAE3F,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,YAAY,GAAG,KAAK,CAAC;IAChC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC;AAID,eAAO,MAAM,gBAAgB;;;;;EAK3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,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AAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,UAAU,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,aAAa,CAAC;CACtB;AAID,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/wizard/detector.js
CHANGED
|
@@ -21,9 +21,9 @@ const AGENTS = [
|
|
|
21
21
|
{
|
|
22
22
|
name: 'opencode',
|
|
23
23
|
paths: {
|
|
24
|
-
darwin: path.join(os.homedir(), '.config', 'opencode', '
|
|
25
|
-
linux: path.join(os.homedir(), '.config', 'opencode', '
|
|
26
|
-
win32: path.join(process.env['APPDATA'] ?? os.homedir(), 'opencode', '
|
|
24
|
+
darwin: path.join(os.homedir(), '.config', 'opencode', 'opencode.json'),
|
|
25
|
+
linux: path.join(os.homedir(), '.config', 'opencode', 'opencode.json'),
|
|
26
|
+
win32: path.join(process.env['APPDATA'] ?? os.homedir(), 'opencode', 'opencode.json'),
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detector.js","sourceRoot":"","sources":["../../src/wizard/detector.ts"],"names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;IAC5C,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,gEAAgE;IAChE,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,+DAA+D;AAE/D,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAE7B,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;QAC9D,KAAK,aAAa;YAChB,qDAAqD;YACrD,mDAAmD;YACnD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC;QAC/C,KAAK,UAAU;YACb,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAC/D,KAAK,aAAa;YAChB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;QAClE,KAAK,UAAU;YACb,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAChE;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injector.d.ts","sourceRoot":"","sources":["../../src/wizard/injector.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAkB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"injector.d.ts","sourceRoot":"","sources":["../../src/wizard/injector.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAkB,MAAM,mBAAmB,CAAC;AAuFpF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EAAE,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,eAAe,EAAE,CAAC,CAiC5B"}
|
package/dist/wizard/injector.js
CHANGED
|
@@ -4,15 +4,25 @@ import * as clack from '@clack/prompts';
|
|
|
4
4
|
import pc from 'picocolors';
|
|
5
5
|
import { logSuccess, logError, logAction } from '../lib/ascii.js';
|
|
6
6
|
import { getConfigKey } from './detector.js';
|
|
7
|
-
// ─── Archer MCP Entry
|
|
8
|
-
function buildArcherEntry(supabaseUrl, serviceRoleKey) {
|
|
7
|
+
// ─── Archer MCP Entry (agent-aware) ─────────────────────────
|
|
8
|
+
function buildArcherEntry(agentName, supabaseUrl, serviceRoleKey) {
|
|
9
|
+
const envVars = {
|
|
10
|
+
SUPABASE_URL: supabaseUrl,
|
|
11
|
+
SUPABASE_SERVICE_ROLE_KEY: serviceRoleKey,
|
|
12
|
+
};
|
|
13
|
+
// opencode uses { type, command[], environment }
|
|
14
|
+
if (agentName === 'opencode') {
|
|
15
|
+
return {
|
|
16
|
+
type: 'local',
|
|
17
|
+
command: ['npx', '-y', 'archer-wizard@latest', '--mcp'],
|
|
18
|
+
environment: envVars,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
// cursor, claude-code, windsurf, antigravity use { command, args, env }
|
|
9
22
|
return {
|
|
10
23
|
command: 'npx',
|
|
11
24
|
args: ['-y', 'archer-wizard@latest', '--mcp'],
|
|
12
|
-
env:
|
|
13
|
-
SUPABASE_URL: supabaseUrl,
|
|
14
|
-
SUPABASE_SERVICE_ROLE_KEY: serviceRoleKey,
|
|
15
|
-
},
|
|
25
|
+
env: envVars,
|
|
16
26
|
};
|
|
17
27
|
}
|
|
18
28
|
// ─── Read or Create Config ──────────────────────────────────
|
|
@@ -40,7 +50,7 @@ function injectIntoAgent(agent, supabaseUrl, serviceRoleKey) {
|
|
|
40
50
|
try {
|
|
41
51
|
const configKey = getConfigKey(agent.name);
|
|
42
52
|
const config = readConfig(agent.configPath);
|
|
43
|
-
const archerEntry = buildArcherEntry(supabaseUrl, serviceRoleKey);
|
|
53
|
+
const archerEntry = buildArcherEntry(agent.name, supabaseUrl, serviceRoleKey);
|
|
44
54
|
// Ensure the config key object exists
|
|
45
55
|
if (!config[configKey] || typeof config[configKey] !== 'object') {
|
|
46
56
|
config[configKey] = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injector.js","sourceRoot":"","sources":["../../src/wizard/injector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,+DAA+D;AAE/D,SAAS,gBAAgB,
|
|
1
|
+
{"version":3,"file":"injector.js","sourceRoot":"","sources":["../../src/wizard/injector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,+DAA+D;AAE/D,SAAS,gBAAgB,CACvB,SAAiB,EACjB,WAAmB,EACnB,cAAsB;IAEtB,MAAM,OAAO,GAAG;QACd,YAAY,EAAE,WAAW;QACzB,yBAAyB,EAAE,cAAc;KAC1C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d.ts","sourceRoot":"","sources":["../../src/wizard/rules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/wizard/rules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AA4InD,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAIrD"}
|
package/dist/wizard/rules.js
CHANGED
|
@@ -6,53 +6,75 @@ import { getRulesPath } from './detector.js';
|
|
|
6
6
|
const RULE_CONTENT = `
|
|
7
7
|
# Archer — Event Intelligence for AI Agents
|
|
8
8
|
|
|
9
|
-
Archer is the event intelligence layer for AI agents. It
|
|
9
|
+
Archer is the universal event intelligence layer for AI agents. It watches your data sources in real time, detects changes the moment they happen, and delivers full context to your webhook — so your agent can react instantly, without polling.
|
|
10
10
|
|
|
11
|
-
## Available
|
|
11
|
+
## Available MCP Tools
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### archer_watch
|
|
14
|
+
Create a persistent real-time watch on a data source. Watches survive agent session restarts.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
**Parameters:**
|
|
17
|
+
- **table** *(required)* — name of the table or resource to watch
|
|
18
|
+
- **event** — type of change: \`INSERT\`, \`UPDATE\`, \`DELETE\`, or \`*\` (all). Default: \`*\`
|
|
19
|
+
- **filter** — optional filter expression, e.g. \`"status=eq.active"\` or \`"amount=gt.1000"\`
|
|
20
|
+
- **webhookUrl** — URL to receive a POST with full event payload when a match fires
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- Watch for new user signups
|
|
20
|
-
- React to events in external services
|
|
21
|
-
- Automate responses to data changes
|
|
22
|
-
- Set up real-time notifications
|
|
22
|
+
### archer_unwatch
|
|
23
|
+
Remove an active watch by its ID. Stops listening and cleans up.
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
**Parameters:**
|
|
26
|
+
- **watchId** *(required)* — the watch ID returned by \`archer_watch\`
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- **table**: the table name (required for table events)
|
|
29
|
-
- **condition**: optional filter like \`"email ends with @gmail.com"\`
|
|
30
|
-
- **webhookUrl**: URL to receive POST notifications when events match
|
|
28
|
+
### archer_watches
|
|
29
|
+
List all active watches — their IDs, tables, events, filters, and webhook URLs.
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
## When to Use Archer
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
Use Archer any time the user wants to:
|
|
34
|
+
- **Monitor data changes** — new rows, updates, deletions in any table
|
|
35
|
+
- **React to events** — trigger automations when conditions are met
|
|
36
|
+
- **Set up alerts** — notify on signups, new orders, status changes, threshold breaches
|
|
37
|
+
- **Build event-driven workflows** — chain watches with webhooks for real-time pipelines
|
|
38
|
+
- **Track activity** — audit logs, user actions, system events
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
1. Watch for new rows in a table:
|
|
43
|
+
\`\`\`
|
|
44
|
+
archer_watch({ table: "users", event: "INSERT", webhookUrl: "https://hooks.example.com/new-users" })
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
2. Watch for updates with a filter:
|
|
35
48
|
\`\`\`
|
|
36
|
-
|
|
49
|
+
archer_watch({ table: "orders", event: "UPDATE", filter: "status=eq.shipped", webhookUrl: "https://hooks.example.com/shipped" })
|
|
37
50
|
\`\`\`
|
|
38
51
|
|
|
39
|
-
|
|
52
|
+
3. Watch all changes on a table:
|
|
40
53
|
\`\`\`
|
|
41
|
-
|
|
54
|
+
archer_watch({ table: "payments", webhookUrl: "https://hooks.example.com/payments" })
|
|
42
55
|
\`\`\`
|
|
43
56
|
|
|
44
|
-
|
|
57
|
+
4. List active watches:
|
|
45
58
|
\`\`\`
|
|
46
|
-
|
|
59
|
+
archer_watches()
|
|
47
60
|
\`\`\`
|
|
48
61
|
|
|
49
|
-
|
|
62
|
+
5. Stop a watch:
|
|
63
|
+
\`\`\`
|
|
64
|
+
archer_unwatch({ watchId: "abc-123" })
|
|
65
|
+
\`\`\`
|
|
66
|
+
|
|
67
|
+
## Best Practices
|
|
68
|
+
|
|
69
|
+
- Add filters to reduce noise — only fire on events that matter
|
|
70
|
+
- Use descriptive webhook URLs that map to specific actions
|
|
71
|
+
- Chain multiple watches for complex event-driven workflows
|
|
72
|
+
- Use \`archer_watches\` to inspect and manage active watchers
|
|
73
|
+
- Clean up watches you no longer need with \`archer_unwatch\`
|
|
50
74
|
|
|
51
|
-
|
|
52
|
-
- Add conditions to filter events and reduce noise
|
|
53
|
-
- Combine with your existing workflows for maximum impact
|
|
75
|
+
## Trigger Words
|
|
54
76
|
|
|
55
|
-
When the user
|
|
77
|
+
When the user says **"watch"**, **"monitor"**, **"notify me"**, **"alert me"**, **"track"**, **"listen for"**, or **"fire when"** — use Archer.
|
|
56
78
|
`.trim();
|
|
57
79
|
// ─── Archer Block Markers ───────────────────────────────────
|
|
58
80
|
const BLOCK_START = '<!-- archer:start -->';
|
package/dist/wizard/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/wizard/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,+DAA+D;AAE/D,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/wizard/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,QA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 +65,7 @@ export function showSuccessBox(agentCount: number): void {
|
|
|
65
65
|
` ${pc.green('▶')} Archer is ready`,
|
|
66
66
|
'',
|
|
67
67
|
` injected into ${agentCount} agent${agentCount !== 1 ? 's' : ''}`,
|
|
68
|
-
' connected to your
|
|
68
|
+
' connected to your backend',
|
|
69
69
|
'',
|
|
70
70
|
' open your AI agent and say:',
|
|
71
71
|
` ${pc.dim('"watch my users table for new signups"')}`,
|
package/src/types/index.ts
CHANGED
package/src/wizard/detector.ts
CHANGED
|
@@ -34,9 +34,9 @@ const AGENTS: AgentPathConfig[] = [
|
|
|
34
34
|
{
|
|
35
35
|
name: 'opencode',
|
|
36
36
|
paths: {
|
|
37
|
-
darwin: path.join(os.homedir(), '.config', 'opencode', '
|
|
38
|
-
linux: path.join(os.homedir(), '.config', 'opencode', '
|
|
39
|
-
win32: path.join(process.env['APPDATA'] ?? os.homedir(), 'opencode', '
|
|
37
|
+
darwin: path.join(os.homedir(), '.config', 'opencode', 'opencode.json'),
|
|
38
|
+
linux: path.join(os.homedir(), '.config', 'opencode', 'opencode.json'),
|
|
39
|
+
win32: path.join(process.env['APPDATA'] ?? os.homedir(), 'opencode', 'opencode.json'),
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
{
|
package/src/wizard/injector.ts
CHANGED
|
@@ -6,16 +6,32 @@ import { logSuccess, logError, logAction } from '../lib/ascii.js';
|
|
|
6
6
|
import { getConfigKey } from './detector.js';
|
|
7
7
|
import type { AgentInfo, InjectionResult, McpServerEntry } from '../types/index.js';
|
|
8
8
|
|
|
9
|
-
// ─── Archer MCP Entry
|
|
9
|
+
// ─── Archer MCP Entry (agent-aware) ─────────────────────────
|
|
10
10
|
|
|
11
|
-
function buildArcherEntry(
|
|
11
|
+
function buildArcherEntry(
|
|
12
|
+
agentName: string,
|
|
13
|
+
supabaseUrl: string,
|
|
14
|
+
serviceRoleKey: string,
|
|
15
|
+
): McpServerEntry {
|
|
16
|
+
const envVars = {
|
|
17
|
+
SUPABASE_URL: supabaseUrl,
|
|
18
|
+
SUPABASE_SERVICE_ROLE_KEY: serviceRoleKey,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// opencode uses { type, command[], environment }
|
|
22
|
+
if (agentName === 'opencode') {
|
|
23
|
+
return {
|
|
24
|
+
type: 'local',
|
|
25
|
+
command: ['npx', '-y', 'archer-wizard@latest', '--mcp'],
|
|
26
|
+
environment: envVars,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// cursor, claude-code, windsurf, antigravity use { command, args, env }
|
|
12
31
|
return {
|
|
13
32
|
command: 'npx',
|
|
14
33
|
args: ['-y', 'archer-wizard@latest', '--mcp'],
|
|
15
|
-
env:
|
|
16
|
-
SUPABASE_URL: supabaseUrl,
|
|
17
|
-
SUPABASE_SERVICE_ROLE_KEY: serviceRoleKey,
|
|
18
|
-
},
|
|
34
|
+
env: envVars,
|
|
19
35
|
};
|
|
20
36
|
}
|
|
21
37
|
|
|
@@ -51,7 +67,7 @@ function injectIntoAgent(
|
|
|
51
67
|
try {
|
|
52
68
|
const configKey = getConfigKey(agent.name);
|
|
53
69
|
const config = readConfig(agent.configPath);
|
|
54
|
-
const archerEntry = buildArcherEntry(supabaseUrl, serviceRoleKey);
|
|
70
|
+
const archerEntry = buildArcherEntry(agent.name, supabaseUrl, serviceRoleKey);
|
|
55
71
|
|
|
56
72
|
// Ensure the config key object exists
|
|
57
73
|
if (!config[configKey] || typeof config[configKey] !== 'object') {
|
package/src/wizard/rules.ts
CHANGED
|
@@ -9,53 +9,75 @@ import type { AgentInfo } from '../types/index.js';
|
|
|
9
9
|
const RULE_CONTENT = `
|
|
10
10
|
# Archer — Event Intelligence for AI Agents
|
|
11
11
|
|
|
12
|
-
Archer is the event intelligence layer for AI agents. It
|
|
12
|
+
Archer is the universal event intelligence layer for AI agents. It watches your data sources in real time, detects changes the moment they happen, and delivers full context to your webhook — so your agent can react instantly, without polling.
|
|
13
13
|
|
|
14
|
-
## Available
|
|
14
|
+
## Available MCP Tools
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
### archer_watch
|
|
17
|
+
Create a persistent real-time watch on a data source. Watches survive agent session restarts.
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
**Parameters:**
|
|
20
|
+
- **table** *(required)* — name of the table or resource to watch
|
|
21
|
+
- **event** — type of change: \`INSERT\`, \`UPDATE\`, \`DELETE\`, or \`*\` (all). Default: \`*\`
|
|
22
|
+
- **filter** — optional filter expression, e.g. \`"status=eq.active"\` or \`"amount=gt.1000"\`
|
|
23
|
+
- **webhookUrl** — URL to receive a POST with full event payload when a match fires
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Watch for new user signups
|
|
23
|
-
- React to events in external services
|
|
24
|
-
- Automate responses to data changes
|
|
25
|
-
- Set up real-time notifications
|
|
25
|
+
### archer_unwatch
|
|
26
|
+
Remove an active watch by its ID. Stops listening and cleans up.
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
**Parameters:**
|
|
29
|
+
- **watchId** *(required)* — the watch ID returned by \`archer_watch\`
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- **table**: the table name (required for table events)
|
|
32
|
-
- **condition**: optional filter like \`"email ends with @gmail.com"\`
|
|
33
|
-
- **webhookUrl**: URL to receive POST notifications when events match
|
|
31
|
+
### archer_watches
|
|
32
|
+
List all active watches — their IDs, tables, events, filters, and webhook URLs.
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
## When to Use Archer
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
Use Archer any time the user wants to:
|
|
37
|
+
- **Monitor data changes** — new rows, updates, deletions in any table
|
|
38
|
+
- **React to events** — trigger automations when conditions are met
|
|
39
|
+
- **Set up alerts** — notify on signups, new orders, status changes, threshold breaches
|
|
40
|
+
- **Build event-driven workflows** — chain watches with webhooks for real-time pipelines
|
|
41
|
+
- **Track activity** — audit logs, user actions, system events
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
1. Watch for new rows in a table:
|
|
46
|
+
\`\`\`
|
|
47
|
+
archer_watch({ table: "users", event: "INSERT", webhookUrl: "https://hooks.example.com/new-users" })
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
2. Watch for updates with a filter:
|
|
38
51
|
\`\`\`
|
|
39
|
-
|
|
52
|
+
archer_watch({ table: "orders", event: "UPDATE", filter: "status=eq.shipped", webhookUrl: "https://hooks.example.com/shipped" })
|
|
40
53
|
\`\`\`
|
|
41
54
|
|
|
42
|
-
|
|
55
|
+
3. Watch all changes on a table:
|
|
43
56
|
\`\`\`
|
|
44
|
-
|
|
57
|
+
archer_watch({ table: "payments", webhookUrl: "https://hooks.example.com/payments" })
|
|
45
58
|
\`\`\`
|
|
46
59
|
|
|
47
|
-
|
|
60
|
+
4. List active watches:
|
|
48
61
|
\`\`\`
|
|
49
|
-
|
|
62
|
+
archer_watches()
|
|
50
63
|
\`\`\`
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
5. Stop a watch:
|
|
66
|
+
\`\`\`
|
|
67
|
+
archer_unwatch({ watchId: "abc-123" })
|
|
68
|
+
\`\`\`
|
|
69
|
+
|
|
70
|
+
## Best Practices
|
|
71
|
+
|
|
72
|
+
- Add filters to reduce noise — only fire on events that matter
|
|
73
|
+
- Use descriptive webhook URLs that map to specific actions
|
|
74
|
+
- Chain multiple watches for complex event-driven workflows
|
|
75
|
+
- Use \`archer_watches\` to inspect and manage active watchers
|
|
76
|
+
- Clean up watches you no longer need with \`archer_unwatch\`
|
|
53
77
|
|
|
54
|
-
|
|
55
|
-
- Add conditions to filter events and reduce noise
|
|
56
|
-
- Combine with your existing workflows for maximum impact
|
|
78
|
+
## Trigger Words
|
|
57
79
|
|
|
58
|
-
When the user
|
|
80
|
+
When the user says **"watch"**, **"monitor"**, **"notify me"**, **"alert me"**, **"track"**, **"listen for"**, or **"fire when"** — use Archer.
|
|
59
81
|
`.trim();
|
|
60
82
|
|
|
61
83
|
// ─── Archer Block Markers ───────────────────────────────────
|