@withone/cli 1.12.8 → 1.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "1.12.8",
3
+ "version": "1.13.0",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -302,6 +302,134 @@ The `source` field contains a JS function body. The flow context is available as
302
302
  }
303
303
  ```
304
304
 
305
+ ### `while` — Condition-driven loop (do-while)
306
+
307
+ Iterates until a condition becomes falsy. The first iteration always runs (do-while semantics), then the condition is checked before each subsequent iteration. Useful for pagination.
308
+
309
+ ```json
310
+ {
311
+ "id": "paginate",
312
+ "name": "Paginate through all pages",
313
+ "type": "while",
314
+ "while": {
315
+ "condition": "$.steps.paginate.output.lastResult.nextPageToken != null",
316
+ "maxIterations": 50,
317
+ "steps": [
318
+ {
319
+ "id": "fetchPage",
320
+ "name": "Fetch next page",
321
+ "type": "action",
322
+ "action": {
323
+ "platform": "gmail",
324
+ "actionId": "GMAIL_LIST_MESSAGES_ACTION_ID",
325
+ "connectionKey": "$.input.gmailKey",
326
+ "queryParams": {
327
+ "pageToken": "$.steps.paginate.output.lastResult.nextPageToken"
328
+ }
329
+ }
330
+ }
331
+ ]
332
+ }
333
+ }
334
+ ```
335
+
336
+ | Field | Type | Description |
337
+ |---|---|---|
338
+ | `condition` | string | JS expression evaluated before each iteration (after iteration 0) |
339
+ | `maxIterations` | number | Safety cap, default: 100 |
340
+ | `steps` | FlowStep[] | Steps to execute each iteration |
341
+
342
+ The step output contains `lastResult` (last step's output from most recent iteration), `iteration` (count), and `results` (array of all iteration outputs). Reference via `$.steps.<id>.output.lastResult`.
343
+
344
+ ### `flow` — Execute a sub-flow
345
+
346
+ Loads and executes another saved flow, enabling flow composition. Circular flows are detected and blocked.
347
+
348
+ ```json
349
+ {
350
+ "id": "processCustomer",
351
+ "name": "Run customer enrichment flow",
352
+ "type": "flow",
353
+ "flow": {
354
+ "key": "enrich-customer",
355
+ "inputs": {
356
+ "email": "$.steps.getCustomer.response.email",
357
+ "connectionKey": "$.input.hubspotConnectionKey"
358
+ }
359
+ }
360
+ }
361
+ ```
362
+
363
+ | Field | Type | Description |
364
+ |---|---|---|
365
+ | `key` | string | Flow key or path (supports selectors) |
366
+ | `inputs` | object | Input values mapped to the sub-flow's declared inputs (supports selectors) |
367
+
368
+ The step output contains all sub-flow step results. The full sub-flow context is available via `$.steps.<id>.response`.
369
+
370
+ ### `paginate` — Auto-collect paginated API results
371
+
372
+ Automatically pages through a paginated API, collecting all results into a single array.
373
+
374
+ ```json
375
+ {
376
+ "id": "allMessages",
377
+ "name": "Fetch all Gmail messages",
378
+ "type": "paginate",
379
+ "paginate": {
380
+ "action": {
381
+ "platform": "gmail",
382
+ "actionId": "GMAIL_LIST_MESSAGES_ACTION_ID",
383
+ "connectionKey": "$.input.gmailKey",
384
+ "queryParams": { "maxResults": 100 }
385
+ },
386
+ "pageTokenField": "nextPageToken",
387
+ "resultsField": "messages",
388
+ "inputTokenParam": "queryParams.pageToken",
389
+ "maxPages": 10
390
+ }
391
+ }
392
+ ```
393
+
394
+ | Field | Type | Description |
395
+ |---|---|---|
396
+ | `action` | FlowActionConfig | The API action to call (same format as action steps) |
397
+ | `pageTokenField` | string | Dot-path in the API response to the next page token |
398
+ | `resultsField` | string | Dot-path in the API response to the results array |
399
+ | `inputTokenParam` | string | Dot-path in the action config where the page token is injected |
400
+ | `maxPages` | number | Maximum pages to fetch, default: 10 |
401
+
402
+ Output is the concatenated results array. Response includes `{ pages, totalResults, results }`.
403
+
404
+ ### `bash` — Execute shell commands
405
+
406
+ Runs a shell command. **Requires `--allow-bash` flag** for security.
407
+
408
+ ```json
409
+ {
410
+ "id": "analyzeData",
411
+ "name": "Analyze data with Claude",
412
+ "type": "bash",
413
+ "bash": {
414
+ "command": "claude --print 'Analyze: {{$.steps.fetchData.response}}' --output-format json",
415
+ "timeout": 120000,
416
+ "parseJson": true
417
+ }
418
+ }
419
+ ```
420
+
421
+ | Field | Type | Description |
422
+ |---|---|---|
423
+ | `command` | string | Shell command to execute (supports selectors and interpolation) |
424
+ | `timeout` | number | Timeout in ms, default: 30000 |
425
+ | `parseJson` | boolean | Parse stdout as JSON, default: false |
426
+ | `cwd` | string | Working directory (supports selectors) |
427
+ | `env` | object | Additional environment variables |
428
+
429
+ Output is stdout (trimmed, or parsed as JSON if `parseJson` is true). Response includes `{ stdout, stderr, exitCode }`.
430
+
431
+ **Security:** Bash steps are blocked by default. Pass `--allow-bash` to `one flow execute` to enable them.
432
+
305
433
  ## 6. Error Handling
306
434
 
307
435
  ### `onError` strategies
@@ -583,6 +711,12 @@ one --agent flow execute <key> -i connectionKey=value -i param=value
583
711
  # Execute with dry run (validate only)
584
712
  one --agent flow execute <key> --dry-run -i connectionKey=value
585
713
 
714
+ # Execute with mock mode (dry-run + mock API responses, runs transforms/code normally)
715
+ one --agent flow execute <key> --dry-run --mock -i connectionKey=value
716
+
717
+ # Execute with bash steps enabled
718
+ one --agent flow execute <key> --allow-bash -i connectionKey=value
719
+
586
720
  # Execute with verbose output
587
721
  one --agent flow execute <key> -v -i connectionKey=value
588
722
 
@@ -601,3 +735,8 @@ one --agent flow resume <runId>
601
735
  - Connection keys are **inputs**, not hardcoded — makes workflows portable and shareable
602
736
  - Use `$.input.*` for input values, `$.steps.*` for step results
603
737
  - Action IDs in examples (like `STRIPE_SEARCH_CUSTOMERS_ACTION_ID`) are placeholders — always use `one actions search` to find the real IDs
738
+ - **Parallel step outputs** are accessible both by index (`$.steps.parallelStep.output[0]`) and by substep ID (`$.steps.substepId.response`)
739
+ - **Loop step outputs** include iteration details via `$.steps.myLoop.response.iterations[0].innerStepId.response`
740
+ - **Code steps** support `await require('crypto')`, `await require('buffer')`, `await require('url')`, `await require('path')` — `fs`, `http`, `child_process`, etc. are blocked
741
+ - **Bash steps** require `--allow-bash` flag for security
742
+ - **State is persisted** after every step completion — resume picks up where it left off