cueclaw 0.1.2 → 0.1.4

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 CHANGED
@@ -6,8 +6,45 @@
6
6
  An AI workflow orchestrator that turns natural language into executable DAGs. Built on the <a href="https://docs.anthropic.com/en/docs/claude-agent-sdk">Claude Agent SDK</a>.
7
7
  </p>
8
8
 
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/cueclaw"><img src="https://img.shields.io/npm/v/cueclaw" alt="npm version" /></a>
11
+ <a href="https://github.com/memodb-io/cueclaw/actions"><img src="https://img.shields.io/github/actions/workflow/status/memodb-io/cueclaw/ci.yml?branch=main" alt="CI" /></a>
12
+ <a href="https://github.com/memodb-io/cueclaw/blob/main/LICENSE"><img src="https://img.shields.io/github/license/memodb-io/cueclaw" alt="License" /></a>
13
+ <img src="https://img.shields.io/node/v/cueclaw" alt="Node.js" />
14
+ </p>
15
+
9
16
  ## How It Works
10
17
 
18
+ 1. **Describe** what you want in plain language
19
+ 2. **Review** the generated execution plan (DAG)
20
+ 3. **Confirm**, and CueClaw runs it in the background as a daemon
21
+
22
+ ```
23
+ You: "Every day at 10am, scrape GitHub Trending for the top 10 projects,
24
+ summarize each with stars/language/description, and send the digest
25
+ to me on Telegram."
26
+
27
+ CueClaw:
28
+ ┌─ Plan: GitHub Trending Digest ─────────────┐
29
+ │ Trigger: cron (0 10 * * *) │
30
+ │ │
31
+ │ 1. Fetch GitHub Trending page │
32
+ │ 2. Extract top 10 projects with metadata │
33
+ │ └─ depends on: step 1 │
34
+ │ 3. Generate formatted digest summary │
35
+ │ └─ depends on: step 2 │
36
+ │ 4. Send digest via Telegram │
37
+ │ └─ depends on: step 3 │
38
+ │ │
39
+ │ [Y] Confirm [M] Modify [N] Cancel │
40
+ └────────────────────────────────────────────┘
41
+ ```
42
+
43
+ ### More Examples
44
+
45
+ <details>
46
+ <summary><b>X (Twitter) Auto Engage</b> — poll trigger, daily cron summary</summary>
47
+
11
48
  ```
12
49
  You: "Every 30 minutes, check my X timeline for trending AI/LLM tweets,
13
50
  reply with a professional but friendly tone, and post a daily
@@ -24,40 +61,93 @@ CueClaw:
24
61
  │ └─ depends on: step 2 │
25
62
  │ 4. Daily: compose & post trend summary │
26
63
  │ └─ cron: 0 21 * * * │
64
+ └────────────────────────────────────────────┘
65
+ ```
66
+
67
+ </details>
68
+
69
+ <details>
70
+ <summary><b>GitHub Issue to Draft PR</b> — poll trigger, multi-step DAG</summary>
71
+
72
+ ```
73
+ You: "Monitor my repo for issues assigned to me. Create a branch,
74
+ analyze the issue, generate an implementation plan, and open
75
+ a Draft PR linking the issue."
76
+
77
+ CueClaw:
78
+ ┌─ Plan: Issue Auto PR ──────────────────────┐
79
+ │ Trigger: poll (60s) │
27
80
  │ │
28
- [Y] Confirm [M] Modify [N] Cancel
81
+ 1. Clone repo & create feature branch
82
+ │ 2. Analyze issue & generate plan │
83
+ │ └─ depends on: step 1 │
84
+ │ 3. Commit plan & create Draft PR │
85
+ │ └─ depends on: step 2 │
86
+ │ 4. Notify via Telegram │
87
+ │ └─ depends on: step 3 │
88
+ └────────────────────────────────────────────┘
89
+ ```
90
+
91
+ </details>
92
+
93
+ <details>
94
+ <summary><b>PR Review Loop</b> — interactive commands via poll trigger</summary>
95
+
96
+ ```
97
+ You: "Watch my PRs. If someone comments /execute, run the plan in PLAN.md.
98
+ If they comment /modify, update the plan. If /merge, squash-merge
99
+ and close the linked issue."
100
+
101
+ CueClaw:
102
+ ┌─ Plan: PR Review Loop ─────────────────────┐
103
+ │ Trigger: poll (60s) │
104
+ │ │
105
+ │ 1. Parse trigger data for PR & command │
106
+ │ 2. Execute command (run/modify/merge) │
107
+ │ └─ depends on: step 1 │
108
+ │ 3. Comment result on PR & notify user │
109
+ │ └─ depends on: step 2 │
29
110
  └────────────────────────────────────────────┘
30
111
  ```
31
112
 
32
- Confirm the plan, and CueClaw runs it continuously in the background as a daemon.
113
+ </details>
33
114
 
34
115
  ## Features
35
116
 
117
+ **Core**
36
118
  - **Natural language in, workflow out** — Describe "when X happens, do Y". No YAML/JSON authoring.
37
119
  - **Human-in-the-loop** — Review the generated DAG before anything runs. Modify or cancel at any point.
38
- - **Multi-channel** — TUI, WhatsApp, or Telegram. All channels share identical capabilities.
39
- - **Triggers** — Poll scripts, cron schedules, or manual. Runs as a system service with auto-restart.
40
- - **Parallel DAG execution** — Independent steps run concurrently. Dependencies are respected.
41
- - **Container isolation** (optional) — Agents can run in Docker with filesystem isolation and mount allowlists. Defaults to local mode with PreToolUse hooks for permission control.
120
+ - **Multi-turn planner** — The planner asks clarifying questions, stores credentials, then generates the workflow.
121
+ - **Parallel DAG execution** — Independent steps run concurrently via `Promise.all`. Dependencies are respected.
122
+
123
+ **Channels**
124
+ - **TUI** — Interactive terminal UI with themes, keyboard shortcuts, and real-time execution views.
125
+ - **WhatsApp** — Baileys-based. QR code auth, inline confirmation, typing indicators.
126
+ - **Telegram** — Grammy-based. Inline keyboard buttons, message chunking, callback queries.
42
127
 
43
- ## Install
128
+ **Infrastructure**
129
+ - **Daemon** — Runs as a launchd (macOS) or systemd (Linux) service with auto-restart on crash.
130
+ - **Triggers** — Poll scripts, cron schedules, or manual execution.
131
+ - **Concurrency control** — GroupQueue with global cap and per-workflow serialization.
132
+ - **Container isolation** (optional) — Docker execution with filesystem isolation, mount allowlists, and stdin-only secret delivery. Defaults to local mode with safety hooks.
133
+ - **Structured logging** — pino to `~/.cueclaw/logs/`, per-workflow execution logs, TUI log stream.
134
+
135
+ ## Quick Start
44
136
 
45
137
  Runtime: **Node.js 22+**.
46
138
 
47
139
  ```bash
48
140
  npm install -g cueclaw@latest
49
- # or: pnpm add -g cueclaw@latest
50
-
51
141
  cueclaw config set claude.api_key $ANTHROPIC_API_KEY
52
142
  cueclaw
53
143
  ```
54
144
 
55
- Or from source:
145
+ From source:
56
146
 
57
147
  ```bash
58
148
  git clone https://github.com/memodb-io/cueclaw.git
59
- cd cueclaw
60
- pnpm install && pnpm build
149
+ cd cueclaw && pnpm install && pnpm build
150
+ pnpm dev # or: node dist/cli.js
61
151
  ```
62
152
 
63
153
  Optional: [Docker](https://docker.com/products/docker-desktop) for container isolation, WhatsApp / Telegram for bot channels.
@@ -65,20 +155,99 @@ Optional: [Docker](https://docker.com/products/docker-desktop) for container iso
65
155
  ## Architecture
66
156
 
67
157
  ```mermaid
68
- flowchart LR
69
- A[Natural Language] --> B[Planner<br/><small>LLM</small>]
70
- B --> C[Workflow DAG]
71
- C --> D{User Confirms}
72
- D -->|Yes| E[Executor<br/><small>Claude Agent SDK</small>]
73
- D -->|Modify| B
74
- E --> F[(SQLite)]
75
- E --> G[Notify<br/><small>TUI / WhatsApp / Telegram</small>]
158
+ flowchart TB
159
+ subgraph Channels
160
+ TUI[TUI<br/><small>Ink / React</small>]
161
+ WA[WhatsApp<br/><small>Baileys</small>]
162
+ TG[Telegram<br/><small>Grammy</small>]
163
+ end
164
+
165
+ subgraph Core
166
+ Router[Message Router]
167
+ PS[Planner Session<br/><small>multi-turn LLM</small>]
168
+ Exec[Executor<br/><small>parallel DAG</small>]
169
+ AR[Agent Runner<br/><small>Claude Agent SDK</small>]
170
+ end
171
+
172
+ subgraph Daemon
173
+ TL[Trigger Loop<br/><small>poll / cron</small>]
174
+ GQ[GroupQueue<br/><small>concurrency control</small>]
175
+ end
176
+
177
+ TUI & WA & TG --> Router
178
+ Router --> PS
179
+ PS -->|Workflow DAG| Router
180
+ Router -->|User confirms| Exec
181
+ Exec --> AR
182
+ AR -->|local| SDK[Claude Agent SDK<br/><small>query&#40;&#41;</small>]
183
+ AR -->|container| Docker[Docker Container]
184
+ Exec --> DB[(SQLite)]
185
+ TL --> GQ --> Exec
186
+ Exec -->|notify| Router
187
+ Router --> TUI & WA & TG
76
188
  ```
77
189
 
78
- Single Node.js process. Each workflow step runs in its own agent session. Independent steps execute in parallel. Data flows between steps via `$steps.{id}.output` references. Optional Docker containers for OS-level isolation.
190
+ Single Node.js process. Each workflow step runs in its own agent session. Data flows between steps via `$steps.{id}.output` references. The daemon manages trigger evaluation and workflow execution with crash recovery.
79
191
 
80
192
  See [docs/architecture.md](docs/architecture.md) for the full design.
81
193
 
194
+ ## Commands
195
+
196
+ **CLI**
197
+
198
+ ```bash
199
+ cueclaw # Launch TUI (default)
200
+ cueclaw new "description" # Create workflow directly
201
+ cueclaw list # List all workflows
202
+ cueclaw status <id> # Workflow details
203
+ cueclaw pause|resume|delete # Lifecycle management
204
+ cueclaw daemon start|stop|status|install|uninstall|logs
205
+ cueclaw config get|set # Configuration management
206
+ cueclaw setup # First-run validation
207
+ ```
208
+
209
+ **TUI Slash Commands**
210
+
211
+ ```
212
+ /new [description] Create a new workflow
213
+ /list List all workflows
214
+ /status <id> Workflow status
215
+ /cancel <id> Cancel running workflow
216
+ /bot start|status Manage bot channels
217
+ /daemon start|stop Daemon control
218
+ /theme [name] Switch theme (default, mono, ocean)
219
+ /help Show all commands
220
+ ```
221
+
222
+ ## Project Structure
223
+
224
+ ```
225
+ src/
226
+ ├── cli.ts # CLI entry point (commander)
227
+ ├── config.ts # YAML config + Zod validation
228
+ ├── db.ts # SQLite persistence (WAL mode)
229
+ ├── planner.ts # LLM → Workflow DAG generation
230
+ ├── planner-session.ts # Multi-turn planner conversation
231
+ ├── executor.ts # Parallel DAG execution engine
232
+ ├── agent-runner.ts # Claude Agent SDK wrapper (local + container)
233
+ ├── router.ts # Message routing across channels
234
+ ├── daemon.ts # Background process + PID management
235
+ ├── service.ts # launchd / systemd integration
236
+ ├── trigger-loop.ts # Poll + cron trigger evaluation
237
+ ├── container-runner.ts # Docker container execution
238
+ ├── container-runtime.ts # Image management (build / pull)
239
+ ├── channels/
240
+ │ ├── tui.ts # TUI channel
241
+ │ ├── whatsapp.ts # WhatsApp (Baileys)
242
+ │ └── telegram.ts # Telegram (Grammy)
243
+ └── tui/
244
+ ├── app.tsx # Main TUI application
245
+ ├── commands/ # Slash command registry
246
+ ├── hooks/ # Custom React hooks
247
+ ├── messages/ # Per-type message components
248
+ └── theme/ # Theme system (3 built-in themes)
249
+ ```
250
+
82
251
  ## Documentation
83
252
 
84
253
  | Doc | Description |
@@ -90,6 +259,19 @@ See [docs/architecture.md](docs/architecture.md) for the full design.
90
259
  | [docs/config.md](docs/config.md) | Configuration and CLI reference |
91
260
  | [docs/testing.md](docs/testing.md) | Test strategy |
92
261
 
262
+ ## Contributing
263
+
264
+ Contributions are welcome. CueClaw follows a **skills-over-features** philosophy — the core stays minimal, and domain-specific capabilities live as skills in `.claude/skills/`.
265
+
266
+ ```bash
267
+ pnpm install # Install dependencies
268
+ pnpm test # Run tests (~309 tests, 33 files)
269
+ pnpm lint # Lint
270
+ pnpm typecheck # Type check
271
+ ```
272
+
273
+ See [docs/testing.md](docs/testing.md) for test conventions (co-located tests, in-memory SQLite, mock patterns).
274
+
93
275
  ## License
94
276
 
95
277
  Apache-2.0