@picahq/cli 1.9.3 → 1.10.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.
Files changed (3) hide show
  1. package/README.md +145 -0
  2. package/dist/index.js +2222 -71
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -43,6 +43,41 @@ pica actions execute gmail <actionId> <connectionKey> \
43
43
 
44
44
  That's it. Five commands to go from zero to sending an email through Gmail's API — fully authenticated, correctly formatted, without touching a single OAuth token.
45
45
 
46
+ ### Multi-step flows
47
+
48
+ Chain actions across platforms into reusable workflows:
49
+
50
+ ```bash
51
+ # Create a flow that looks up a Stripe customer and sends a Gmail welcome email
52
+ pica flow create welcome-customer --definition '{
53
+ "key": "welcome-customer",
54
+ "name": "Welcome New Customer",
55
+ "version": "1",
56
+ "inputs": {
57
+ "stripeKey": { "type": "string", "required": true, "connection": { "platform": "stripe" } },
58
+ "gmailKey": { "type": "string", "required": true, "connection": { "platform": "gmail" } },
59
+ "email": { "type": "string", "required": true }
60
+ },
61
+ "steps": [
62
+ { "id": "find", "name": "Find customer", "type": "action",
63
+ "action": { "platform": "stripe", "actionId": "<actionId>", "connectionKey": "$.input.stripeKey",
64
+ "data": { "query": "email:'\''{{$.input.email}}'\''" } } },
65
+ { "id": "send", "name": "Send email", "type": "action",
66
+ "if": "$.steps.find.response.data.length > 0",
67
+ "action": { "platform": "gmail", "actionId": "<actionId>", "connectionKey": "$.input.gmailKey",
68
+ "data": { "to": "{{$.input.email}}", "subject": "Welcome!", "body": "Thanks for joining." } } }
69
+ ]
70
+ }'
71
+
72
+ # Validate it
73
+ pica flow validate welcome-customer
74
+
75
+ # Run it — connection keys auto-resolve if you have one connection per platform
76
+ pica flow execute welcome-customer -i email=jane@example.com
77
+ ```
78
+
79
+ Flows are stored as JSON at `.one/flows/<key>.flow.json` and support conditions, loops, parallel steps, transforms, and more. Run `pica guide flows` for the full reference.
80
+
46
81
  ## How it works
47
82
 
48
83
  ```
@@ -167,6 +202,103 @@ pica actions execute stripe <actionId> <connectionKey> \
167
202
  | `--form-data` | Send as multipart/form-data |
168
203
  | `--form-url-encoded` | Send as application/x-www-form-urlencoded |
169
204
 
205
+ ### `pica guide [topic]`
206
+
207
+ Get the full CLI usage guide, designed for AI agents that only have the binary (no MCP, no IDE skills).
208
+
209
+ ```bash
210
+ pica guide # full guide (all topics)
211
+ pica guide overview # setup, --agent flag, discovery workflow
212
+ pica guide actions # search, knowledge, execute workflow
213
+ pica guide flows # multi-step API workflows
214
+
215
+ pica --agent guide # full guide as structured JSON
216
+ pica --agent guide flows # single topic as JSON
217
+ ```
218
+
219
+ Topics: `overview`, `actions`, `flows`, `all` (default).
220
+
221
+ In agent mode (`--agent`), the JSON response includes the guide content and an `availableTopics` array so agents can discover what sections exist.
222
+
223
+ ### `pica flow create [key]`
224
+
225
+ Create a flow from a JSON definition. Flows are saved to `.one/flows/<key>.flow.json`.
226
+
227
+ ```bash
228
+ # From a --definition flag
229
+ pica flow create welcome-customer --definition '{"key":"welcome-customer","name":"Welcome","version":"1","inputs":{},"steps":[]}'
230
+
231
+ # From stdin
232
+ cat flow.json | pica flow create
233
+
234
+ # Custom output path
235
+ pica flow create my-flow --definition '...' -o ./custom/path.json
236
+ ```
237
+
238
+ | Option | What it does |
239
+ |--------|-------------|
240
+ | `--definition <json>` | Flow definition as a JSON string |
241
+ | `-o, --output <path>` | Custom output path (default: `.one/flows/<key>.flow.json`) |
242
+
243
+ ### `pica flow execute <key>`
244
+
245
+ Execute a flow by key or file path. Pass inputs with repeatable `-i` flags.
246
+
247
+ ```bash
248
+ # Execute with inputs
249
+ pica flow execute welcome-customer \
250
+ -i customerEmail=jane@example.com
251
+
252
+ # Dry run — validate and show plan without executing
253
+ pica flow execute welcome-customer --dry-run -i customerEmail=jane@example.com
254
+
255
+ # Verbose — show each step as it runs
256
+ pica flow execute welcome-customer -v -i customerEmail=jane@example.com
257
+ ```
258
+
259
+ Connection inputs with a `connection` field in the flow definition are auto-resolved when the user has exactly one connection for that platform.
260
+
261
+ Press Ctrl+C during execution to pause — the run can be resumed later with `pica flow resume <runId>`.
262
+
263
+ | Option | What it does |
264
+ |--------|-------------|
265
+ | `-i, --input <name=value>` | Input parameter (repeatable) |
266
+ | `--dry-run` | Validate and show execution plan without running |
267
+ | `-v, --verbose` | Show full request/response for each step |
268
+
269
+ ### `pica flow list`
270
+
271
+ List all flows saved in `.one/flows/`.
272
+
273
+ ```bash
274
+ pica flow list
275
+ ```
276
+
277
+ ### `pica flow validate <key>`
278
+
279
+ Validate a flow JSON file against the schema.
280
+
281
+ ```bash
282
+ pica flow validate welcome-customer
283
+ ```
284
+
285
+ ### `pica flow resume <runId>`
286
+
287
+ Resume a paused or failed flow run from where it left off.
288
+
289
+ ```bash
290
+ pica flow resume abc123
291
+ ```
292
+
293
+ ### `pica flow runs [flowKey]`
294
+
295
+ List flow runs, optionally filtered by flow key.
296
+
297
+ ```bash
298
+ pica flow runs # all runs
299
+ pica flow runs welcome-customer # runs for a specific flow
300
+ ```
301
+
170
302
  ### `pica config`
171
303
 
172
304
  Configure access control for the MCP server. Optional — full access is the default.
@@ -197,8 +329,21 @@ pica actions execute → Do it.
197
329
 
198
330
  This is the same workflow whether you're sending emails, creating CRM contacts, processing payments, managing inventory, or posting to Slack. One pattern, any platform.
199
331
 
332
+ For multi-step workflows that chain actions across platforms, use **flows**:
333
+
334
+ ```
335
+ pica actions knowledge → Learn each action's schema
336
+ pica flow create → Define the workflow as JSON
337
+ pica flow validate → Check it
338
+ pica flow execute → Run it
339
+ ```
340
+
341
+ Flows support conditions, loops, parallel execution, transforms, code steps, and file I/O. Run `pica guide flows` for the full schema reference and examples.
342
+
200
343
  ## For AI agents
201
344
 
345
+ If you're an AI agent with only the `pica` binary (no MCP server or IDE skills), start with `pica --agent guide` to get the full usage guide as structured JSON. This teaches you the complete workflow, JSON schemas, selector syntax, and more — everything you need to bootstrap yourself.
346
+
202
347
  If you're an AI agent using the Pica MCP server, the tools map directly:
203
348
 
204
349
  | MCP Tool | CLI Command |