@picahq/cli 1.12.0 → 1.12.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.
- package/README.md +12 -12
- package/dist/index.js +72 -72
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ one flow validate welcome-customer
|
|
|
76
76
|
one flow execute welcome-customer -i email=jane@example.com
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
Workflows are stored as JSON at `.one/flows/<key>.flow.json` and support conditions, loops, parallel steps, transforms, and more. Run `one guide flows` for the full reference.
|
|
80
80
|
|
|
81
81
|
## How it works
|
|
82
82
|
|
|
@@ -223,7 +223,7 @@ In agent mode (`--agent`), the JSON response includes the guide content and an `
|
|
|
223
223
|
|
|
224
224
|
### `one flow create [key]`
|
|
225
225
|
|
|
226
|
-
Create a
|
|
226
|
+
Create a workflow from a JSON definition. Workflows are saved to `.one/flows/<key>.flow.json`.
|
|
227
227
|
|
|
228
228
|
```bash
|
|
229
229
|
# From a --definition flag
|
|
@@ -238,12 +238,12 @@ one flow create my-flow --definition '...' -o ./custom/path.json
|
|
|
238
238
|
|
|
239
239
|
| Option | What it does |
|
|
240
240
|
|--------|-------------|
|
|
241
|
-
| `--definition <json>` |
|
|
241
|
+
| `--definition <json>` | Workflow definition as a JSON string |
|
|
242
242
|
| `-o, --output <path>` | Custom output path (default: `.one/flows/<key>.flow.json`) |
|
|
243
243
|
|
|
244
244
|
### `one flow execute <key>`
|
|
245
245
|
|
|
246
|
-
Execute a
|
|
246
|
+
Execute a workflow by key or file path. Pass inputs with repeatable `-i` flags.
|
|
247
247
|
|
|
248
248
|
```bash
|
|
249
249
|
# Execute with inputs
|
|
@@ -257,7 +257,7 @@ one flow execute welcome-customer --dry-run -i customerEmail=jane@example.com
|
|
|
257
257
|
one flow execute welcome-customer -v -i customerEmail=jane@example.com
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
Connection inputs with a `connection` field in the
|
|
260
|
+
Connection inputs with a `connection` field in the workflow definition are auto-resolved when the user has exactly one connection for that platform.
|
|
261
261
|
|
|
262
262
|
Press Ctrl+C during execution to pause — the run can be resumed later with `one flow resume <runId>`.
|
|
263
263
|
|
|
@@ -269,7 +269,7 @@ Press Ctrl+C during execution to pause — the run can be resumed later with `on
|
|
|
269
269
|
|
|
270
270
|
### `one flow list`
|
|
271
271
|
|
|
272
|
-
List all
|
|
272
|
+
List all workflows saved in `.one/flows/`.
|
|
273
273
|
|
|
274
274
|
```bash
|
|
275
275
|
one flow list
|
|
@@ -277,7 +277,7 @@ one flow list
|
|
|
277
277
|
|
|
278
278
|
### `one flow validate <key>`
|
|
279
279
|
|
|
280
|
-
Validate a
|
|
280
|
+
Validate a workflow JSON file against the schema.
|
|
281
281
|
|
|
282
282
|
```bash
|
|
283
283
|
one flow validate welcome-customer
|
|
@@ -285,7 +285,7 @@ one flow validate welcome-customer
|
|
|
285
285
|
|
|
286
286
|
### `one flow resume <runId>`
|
|
287
287
|
|
|
288
|
-
Resume a paused or failed
|
|
288
|
+
Resume a paused or failed workflow run from where it left off.
|
|
289
289
|
|
|
290
290
|
```bash
|
|
291
291
|
one flow resume abc123
|
|
@@ -293,11 +293,11 @@ one flow resume abc123
|
|
|
293
293
|
|
|
294
294
|
### `one flow runs [flowKey]`
|
|
295
295
|
|
|
296
|
-
List
|
|
296
|
+
List workflow runs, optionally filtered by workflow key.
|
|
297
297
|
|
|
298
298
|
```bash
|
|
299
299
|
one flow runs # all runs
|
|
300
|
-
one flow runs welcome-customer # runs for a specific
|
|
300
|
+
one flow runs welcome-customer # runs for a specific workflow
|
|
301
301
|
```
|
|
302
302
|
|
|
303
303
|
### `one config`
|
|
@@ -330,7 +330,7 @@ one actions execute → Do it.
|
|
|
330
330
|
|
|
331
331
|
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.
|
|
332
332
|
|
|
333
|
-
For multi-step workflows that chain actions across platforms
|
|
333
|
+
For multi-step workflows that chain actions across platforms:
|
|
334
334
|
|
|
335
335
|
```
|
|
336
336
|
one actions knowledge → Learn each action's schema
|
|
@@ -339,7 +339,7 @@ one flow validate → Check it
|
|
|
339
339
|
one flow execute → Run it
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
Workflows support conditions, loops, parallel execution, transforms, code steps, and file I/O. Run `one guide flows` for the full schema reference and examples.
|
|
343
343
|
|
|
344
344
|
## For AI agents
|
|
345
345
|
|
package/dist/index.js
CHANGED
|
@@ -599,7 +599,7 @@ QUERY PARAMS: {{QUERY_PARAMS}}`;
|
|
|
599
599
|
import open from "open";
|
|
600
600
|
var ONE_APP_URL = "https://app.withone.ai";
|
|
601
601
|
function getConnectionUrl(platform) {
|
|
602
|
-
return `${ONE_APP_URL}
|
|
602
|
+
return `${ONE_APP_URL}/?#open=${platform}`;
|
|
603
603
|
}
|
|
604
604
|
function getApiKeyUrl() {
|
|
605
605
|
return `${ONE_APP_URL}/settings/api-keys`;
|
|
@@ -2942,7 +2942,7 @@ async function autoResolveConnectionInputs(flow2, inputs, api) {
|
|
|
2942
2942
|
return resolved;
|
|
2943
2943
|
}
|
|
2944
2944
|
async function flowCreateCommand(key, options) {
|
|
2945
|
-
intro2(pc7.bgCyan(pc7.black(" One
|
|
2945
|
+
intro2(pc7.bgCyan(pc7.black(" One Workflow ")));
|
|
2946
2946
|
let flow2;
|
|
2947
2947
|
if (options.definition) {
|
|
2948
2948
|
try {
|
|
@@ -2962,7 +2962,7 @@ async function flowCreateCommand(key, options) {
|
|
|
2962
2962
|
error("Invalid JSON from stdin");
|
|
2963
2963
|
}
|
|
2964
2964
|
} else {
|
|
2965
|
-
error("Interactive
|
|
2965
|
+
error("Interactive workflow creation not yet supported. Use --definition <json> or pipe JSON via stdin.");
|
|
2966
2966
|
}
|
|
2967
2967
|
if (key) {
|
|
2968
2968
|
flow2.key = key;
|
|
@@ -2981,25 +2981,25 @@ ${errors.map((e) => ` ${e.path}: ${e.message}`).join("\n")}`);
|
|
|
2981
2981
|
json({ created: true, key: flow2.key, path: flowPath });
|
|
2982
2982
|
return;
|
|
2983
2983
|
}
|
|
2984
|
-
note2(`
|
|
2984
|
+
note2(`Workflow "${flow2.name}" saved to ${flowPath}`, "Created");
|
|
2985
2985
|
outro2(`Validate: ${pc7.cyan(`one flow validate ${flow2.key}`)}
|
|
2986
2986
|
Execute: ${pc7.cyan(`one flow execute ${flow2.key}`)}`);
|
|
2987
2987
|
}
|
|
2988
2988
|
async function flowExecuteCommand(keyOrPath, options) {
|
|
2989
|
-
intro2(pc7.bgCyan(pc7.black(" One
|
|
2989
|
+
intro2(pc7.bgCyan(pc7.black(" One Workflow ")));
|
|
2990
2990
|
const { apiKey, permissions, actionIds } = getConfig2();
|
|
2991
2991
|
const api = new OneApi(apiKey);
|
|
2992
2992
|
const spinner5 = createSpinner();
|
|
2993
|
-
spinner5.start(`Loading
|
|
2993
|
+
spinner5.start(`Loading workflow "${keyOrPath}"...`);
|
|
2994
2994
|
let flow2;
|
|
2995
2995
|
try {
|
|
2996
2996
|
flow2 = loadFlow(keyOrPath);
|
|
2997
2997
|
} catch (err) {
|
|
2998
|
-
spinner5.stop("
|
|
2998
|
+
spinner5.stop("Workflow not found");
|
|
2999
2999
|
error(err instanceof Error ? err.message : String(err));
|
|
3000
3000
|
return;
|
|
3001
3001
|
}
|
|
3002
|
-
spinner5.stop(`
|
|
3002
|
+
spinner5.stop(`Workflow: ${flow2.name} (${flow2.steps.length} steps)`);
|
|
3003
3003
|
const inputs = parseInputs(options.input || []);
|
|
3004
3004
|
const resolvedInputs = await autoResolveConnectionInputs(flow2, inputs, api);
|
|
3005
3005
|
const runner = new FlowRunner(flow2, resolvedInputs);
|
|
@@ -3030,7 +3030,7 @@ ${pc7.yellow("Pausing after current step completes...")} (run ID: ${runId})`);
|
|
|
3030
3030
|
};
|
|
3031
3031
|
const execSpinner = createSpinner();
|
|
3032
3032
|
if (!options.verbose && !isAgentMode()) {
|
|
3033
|
-
execSpinner.start("Executing
|
|
3033
|
+
execSpinner.start("Executing workflow...");
|
|
3034
3034
|
}
|
|
3035
3035
|
try {
|
|
3036
3036
|
const context = await runner.execute(flow2, api, permissions, actionIds, {
|
|
@@ -3040,11 +3040,11 @@ ${pc7.yellow("Pausing after current step completes...")} (run ID: ${runId})`);
|
|
|
3040
3040
|
});
|
|
3041
3041
|
process.off("SIGINT", sigintHandler);
|
|
3042
3042
|
if (!options.verbose && !isAgentMode()) {
|
|
3043
|
-
execSpinner.stop("
|
|
3043
|
+
execSpinner.stop("Workflow completed");
|
|
3044
3044
|
}
|
|
3045
3045
|
if (isAgentMode()) {
|
|
3046
3046
|
json({
|
|
3047
|
-
event: "
|
|
3047
|
+
event: "workflow:result",
|
|
3048
3048
|
runId,
|
|
3049
3049
|
logFile: logPath,
|
|
3050
3050
|
status: "success",
|
|
@@ -3066,12 +3066,12 @@ ${pc7.yellow("Pausing after current step completes...")} (run ID: ${runId})`);
|
|
|
3066
3066
|
} catch (error2) {
|
|
3067
3067
|
process.off("SIGINT", sigintHandler);
|
|
3068
3068
|
if (!options.verbose && !isAgentMode()) {
|
|
3069
|
-
execSpinner.stop("
|
|
3069
|
+
execSpinner.stop("Workflow failed");
|
|
3070
3070
|
}
|
|
3071
3071
|
const errorMsg = error2 instanceof Error ? error2.message : String(error2);
|
|
3072
3072
|
if (isAgentMode()) {
|
|
3073
3073
|
json({
|
|
3074
|
-
event: "
|
|
3074
|
+
event: "workflow:result",
|
|
3075
3075
|
runId,
|
|
3076
3076
|
logFile: logPath,
|
|
3077
3077
|
status: "failed",
|
|
@@ -3081,18 +3081,18 @@ ${pc7.yellow("Pausing after current step completes...")} (run ID: ${runId})`);
|
|
|
3081
3081
|
}
|
|
3082
3082
|
console.log(` ${pc7.dim(`Run ID: ${runId}`)}`);
|
|
3083
3083
|
console.log(` ${pc7.dim(`Log: ${logPath}`)}`);
|
|
3084
|
-
error(`
|
|
3084
|
+
error(`Workflow failed: ${errorMsg}`);
|
|
3085
3085
|
}
|
|
3086
3086
|
}
|
|
3087
3087
|
async function flowListCommand() {
|
|
3088
|
-
intro2(pc7.bgCyan(pc7.black(" One
|
|
3088
|
+
intro2(pc7.bgCyan(pc7.black(" One Workflow ")));
|
|
3089
3089
|
const flows = listFlows();
|
|
3090
3090
|
if (isAgentMode()) {
|
|
3091
|
-
json({ flows });
|
|
3091
|
+
json({ workflows: flows });
|
|
3092
3092
|
return;
|
|
3093
3093
|
}
|
|
3094
3094
|
if (flows.length === 0) {
|
|
3095
|
-
note2("No
|
|
3095
|
+
note2("No workflows found in .one/flows/\n\nCreate one with: one flow create", "Workflows");
|
|
3096
3096
|
return;
|
|
3097
3097
|
}
|
|
3098
3098
|
console.log();
|
|
@@ -3115,7 +3115,7 @@ async function flowListCommand() {
|
|
|
3115
3115
|
console.log();
|
|
3116
3116
|
}
|
|
3117
3117
|
async function flowValidateCommand(keyOrPath) {
|
|
3118
|
-
intro2(pc7.bgCyan(pc7.black(" One
|
|
3118
|
+
intro2(pc7.bgCyan(pc7.black(" One Workflow ")));
|
|
3119
3119
|
const spinner5 = createSpinner();
|
|
3120
3120
|
spinner5.start(`Validating "${keyOrPath}"...`);
|
|
3121
3121
|
let flowData;
|
|
@@ -3125,7 +3125,7 @@ async function flowValidateCommand(keyOrPath) {
|
|
|
3125
3125
|
flowData = JSON.parse(content);
|
|
3126
3126
|
} catch (err) {
|
|
3127
3127
|
spinner5.stop("Validation failed");
|
|
3128
|
-
error(`Could not read
|
|
3128
|
+
error(`Could not read workflow: ${err instanceof Error ? err.message : String(err)}`);
|
|
3129
3129
|
}
|
|
3130
3130
|
const errors = validateFlow(flowData);
|
|
3131
3131
|
if (errors.length > 0) {
|
|
@@ -3141,15 +3141,15 @@ async function flowValidateCommand(keyOrPath) {
|
|
|
3141
3141
|
console.log();
|
|
3142
3142
|
error(`${errors.length} validation error(s) found`);
|
|
3143
3143
|
}
|
|
3144
|
-
spinner5.stop("
|
|
3144
|
+
spinner5.stop("Workflow is valid");
|
|
3145
3145
|
if (isAgentMode()) {
|
|
3146
3146
|
json({ valid: true, key: flowData.key });
|
|
3147
3147
|
return;
|
|
3148
3148
|
}
|
|
3149
|
-
note2(`
|
|
3149
|
+
note2(`Workflow "${flowData.key}" passed all validation checks`, "Valid");
|
|
3150
3150
|
}
|
|
3151
3151
|
async function flowResumeCommand(runId) {
|
|
3152
|
-
intro2(pc7.bgCyan(pc7.black(" One
|
|
3152
|
+
intro2(pc7.bgCyan(pc7.black(" One Workflow ")));
|
|
3153
3153
|
const state = FlowRunner.loadRunState(runId);
|
|
3154
3154
|
if (!state) {
|
|
3155
3155
|
error(`Run "${runId}" not found`);
|
|
@@ -3163,7 +3163,7 @@ async function flowResumeCommand(runId) {
|
|
|
3163
3163
|
try {
|
|
3164
3164
|
flow2 = loadFlow(state.flowKey);
|
|
3165
3165
|
} catch (err) {
|
|
3166
|
-
error(`Could not load
|
|
3166
|
+
error(`Could not load workflow "${state.flowKey}": ${err instanceof Error ? err.message : String(err)}`);
|
|
3167
3167
|
return;
|
|
3168
3168
|
}
|
|
3169
3169
|
const runner = FlowRunner.fromRunState(state);
|
|
@@ -3176,10 +3176,10 @@ async function flowResumeCommand(runId) {
|
|
|
3176
3176
|
spinner5.start(`Resuming run ${runId} (${state.completedSteps.length} steps already completed)...`);
|
|
3177
3177
|
try {
|
|
3178
3178
|
const context = await runner.resume(flow2, api, permissions, actionIds, { onEvent });
|
|
3179
|
-
spinner5.stop("
|
|
3179
|
+
spinner5.stop("Workflow completed");
|
|
3180
3180
|
if (isAgentMode()) {
|
|
3181
3181
|
json({
|
|
3182
|
-
event: "
|
|
3182
|
+
event: "workflow:result",
|
|
3183
3183
|
runId,
|
|
3184
3184
|
logFile: runner.getLogPath(),
|
|
3185
3185
|
status: "success",
|
|
@@ -3193,14 +3193,14 @@ async function flowResumeCommand(runId) {
|
|
|
3193
3193
|
spinner5.stop("Resume failed");
|
|
3194
3194
|
const errorMsg = error2 instanceof Error ? error2.message : String(error2);
|
|
3195
3195
|
if (isAgentMode()) {
|
|
3196
|
-
json({ event: "
|
|
3196
|
+
json({ event: "workflow:result", runId, status: "failed", error: errorMsg });
|
|
3197
3197
|
process.exit(1);
|
|
3198
3198
|
}
|
|
3199
3199
|
error(`Resume failed: ${errorMsg}`);
|
|
3200
3200
|
}
|
|
3201
3201
|
}
|
|
3202
3202
|
async function flowRunsCommand(flowKey) {
|
|
3203
|
-
intro2(pc7.bgCyan(pc7.black(" One
|
|
3203
|
+
intro2(pc7.bgCyan(pc7.black(" One Workflow ")));
|
|
3204
3204
|
const runs = FlowRunner.listRuns(flowKey);
|
|
3205
3205
|
if (isAgentMode()) {
|
|
3206
3206
|
json({
|
|
@@ -3217,14 +3217,14 @@ async function flowRunsCommand(flowKey) {
|
|
|
3217
3217
|
return;
|
|
3218
3218
|
}
|
|
3219
3219
|
if (runs.length === 0) {
|
|
3220
|
-
note2(flowKey ? `No runs found for
|
|
3220
|
+
note2(flowKey ? `No runs found for workflow "${flowKey}"` : "No workflow runs found", "Runs");
|
|
3221
3221
|
return;
|
|
3222
3222
|
}
|
|
3223
3223
|
console.log();
|
|
3224
3224
|
printTable(
|
|
3225
3225
|
[
|
|
3226
3226
|
{ key: "runId", label: "Run ID" },
|
|
3227
|
-
{ key: "flowKey", label: "
|
|
3227
|
+
{ key: "flowKey", label: "Workflow" },
|
|
3228
3228
|
{ key: "status", label: "Status" },
|
|
3229
3229
|
{ key: "startedAt", label: "Started" },
|
|
3230
3230
|
{ key: "steps", label: "Steps Done" }
|
|
@@ -3282,7 +3282,7 @@ This guide has three sections you can request individually:
|
|
|
3282
3282
|
|
|
3283
3283
|
- **overview** \u2014 This section. Setup, flag usage, and discovery workflow.
|
|
3284
3284
|
- **actions** \u2014 Full workflow for searching, reading docs, and executing platform actions.
|
|
3285
|
-
- **
|
|
3285
|
+
- **workflows** \u2014 Building and executing multi-step API workflows (JSON-based).
|
|
3286
3286
|
|
|
3287
3287
|
## Discovery Workflow
|
|
3288
3288
|
|
|
@@ -3291,9 +3291,9 @@ This guide has three sections you can request individually:
|
|
|
3291
3291
|
3. \`one --agent actions knowledge <platform> <actionId>\` \u2014 Read full docs (REQUIRED before execute)
|
|
3292
3292
|
4. \`one --agent actions execute <platform> <actionId> <connectionKey>\` \u2014 Execute the action
|
|
3293
3293
|
|
|
3294
|
-
For multi-step workflows
|
|
3294
|
+
For multi-step workflows:
|
|
3295
3295
|
1. Discover actions with the workflow above
|
|
3296
|
-
2. Build a
|
|
3296
|
+
2. Build a workflow JSON definition
|
|
3297
3297
|
3. \`one --agent flow create <key> --definition '<json>'\`
|
|
3298
3298
|
4. \`one --agent flow execute <key> -i param=value\`
|
|
3299
3299
|
|
|
@@ -3434,20 +3434,20 @@ Parse the output as JSON. If the \`error\` key is present, the command failed \u
|
|
|
3434
3434
|
- If search returns no results, try broader queries (e.g., \`"list"\` instead of \`"list active premium customers"\`)
|
|
3435
3435
|
- The execute command respects access control settings configured via \`one config\` \u2014 if execution is blocked, the user may need to adjust their permissions
|
|
3436
3436
|
`;
|
|
3437
|
-
var GUIDE_FLOWS = `# One
|
|
3437
|
+
var GUIDE_FLOWS = `# One Workflows \u2014 Multi-Step API Workflows
|
|
3438
3438
|
|
|
3439
|
-
You have access to the One CLI's
|
|
3439
|
+
You have access to the One CLI's workflow engine, which lets you create and execute multi-step API workflows as JSON files. Workflows chain actions across platforms \u2014 e.g., look up a Stripe customer, then send them a welcome email via Gmail.
|
|
3440
3440
|
|
|
3441
3441
|
## 1. Overview
|
|
3442
3442
|
|
|
3443
|
-
-
|
|
3443
|
+
- Workflows are JSON files stored at \`.one/flows/<key>.flow.json\`
|
|
3444
3444
|
- All dynamic values (including connection keys) are declared as **inputs**
|
|
3445
|
-
- Each
|
|
3445
|
+
- Each workflow has a unique **key** used to reference and execute it
|
|
3446
3446
|
- Executed via \`one --agent flow execute <key> -i name=value\`
|
|
3447
3447
|
|
|
3448
|
-
## 2. Building a
|
|
3448
|
+
## 2. Building a Workflow \u2014 Step-by-Step Process
|
|
3449
3449
|
|
|
3450
|
-
**You MUST follow this process to build a correct
|
|
3450
|
+
**You MUST follow this process to build a correct workflow:**
|
|
3451
3451
|
|
|
3452
3452
|
### Step 1: Discover connections
|
|
3453
3453
|
|
|
@@ -3463,20 +3463,20 @@ Find out which platforms are connected and get their connection keys.
|
|
|
3463
3463
|
# Find the action ID
|
|
3464
3464
|
one --agent actions search <platform> "<query>" -t execute
|
|
3465
3465
|
|
|
3466
|
-
# Read the full docs \u2014 REQUIRED before adding to a
|
|
3466
|
+
# Read the full docs \u2014 REQUIRED before adding to a workflow
|
|
3467
3467
|
one --agent actions knowledge <platform> <actionId>
|
|
3468
3468
|
\`\`\`
|
|
3469
3469
|
|
|
3470
|
-
**CRITICAL:** You MUST call \`one actions knowledge\` for every action you include in the
|
|
3470
|
+
**CRITICAL:** You MUST call \`one actions knowledge\` for every action you include in the workflow. The knowledge output tells you the exact request body structure, required fields, path variables, and query parameters. Without this, your workflow JSON will have incorrect data shapes.
|
|
3471
3471
|
|
|
3472
|
-
### Step 3: Construct the
|
|
3472
|
+
### Step 3: Construct the workflow JSON
|
|
3473
3473
|
|
|
3474
|
-
Using the knowledge gathered, build the
|
|
3474
|
+
Using the knowledge gathered, build the workflow JSON with:
|
|
3475
3475
|
- All inputs declared (connection keys + user parameters)
|
|
3476
3476
|
- Each step with the correct actionId, platform, and data structure (from knowledge)
|
|
3477
3477
|
- Data wired between steps using \`$.input.*\` and \`$.steps.*\` selectors
|
|
3478
3478
|
|
|
3479
|
-
### Step 4: Write the
|
|
3479
|
+
### Step 4: Write the workflow file
|
|
3480
3480
|
|
|
3481
3481
|
\`\`\`bash
|
|
3482
3482
|
one --agent flow create <key> --definition '<json>'
|
|
@@ -3496,7 +3496,7 @@ one --agent flow validate <key>
|
|
|
3496
3496
|
one --agent flow execute <key> -i connectionKey=xxx -i param=value
|
|
3497
3497
|
\`\`\`
|
|
3498
3498
|
|
|
3499
|
-
## 3.
|
|
3499
|
+
## 3. Workflow JSON Schema Reference
|
|
3500
3500
|
|
|
3501
3501
|
\`\`\`json
|
|
3502
3502
|
{
|
|
@@ -3552,7 +3552,7 @@ one --agent flow execute <key> -i connectionKey=xxx -i param=value
|
|
|
3552
3552
|
| \`description\` | string | Human-readable description |
|
|
3553
3553
|
| \`connection\` | object | Connection metadata: \`{ "platform": "gmail" }\` \u2014 enables auto-resolution |
|
|
3554
3554
|
|
|
3555
|
-
**Connection inputs** have a \`connection\` field. If the user has exactly one connection for that platform, the engine auto-resolves it.
|
|
3555
|
+
**Connection inputs** have a \`connection\` field. If the user has exactly one connection for that platform, the workflow engine auto-resolves it.
|
|
3556
3556
|
|
|
3557
3557
|
## 4. Selector Syntax Reference
|
|
3558
3558
|
|
|
@@ -3758,20 +3758,20 @@ Skip a step based on previous results:
|
|
|
3758
3758
|
}
|
|
3759
3759
|
\`\`\`
|
|
3760
3760
|
|
|
3761
|
-
## 7. Updating Existing
|
|
3761
|
+
## 7. Updating Existing Workflows
|
|
3762
3762
|
|
|
3763
|
-
To modify an existing
|
|
3763
|
+
To modify an existing workflow:
|
|
3764
3764
|
|
|
3765
|
-
1. Read the
|
|
3765
|
+
1. Read the workflow JSON file at \`.one/flows/<key>.flow.json\`
|
|
3766
3766
|
2. Understand its current structure
|
|
3767
3767
|
3. Use \`one --agent actions knowledge <platform> <actionId>\` for any new actions
|
|
3768
3768
|
4. Modify the JSON (add/remove/update steps, change data mappings, add inputs)
|
|
3769
|
-
5. Write back the updated
|
|
3769
|
+
5. Write back the updated workflow file
|
|
3770
3770
|
6. Validate: \`one --agent flow validate <key>\`
|
|
3771
3771
|
|
|
3772
3772
|
## 8. Complete Examples
|
|
3773
3773
|
|
|
3774
|
-
### Example 1: Simple 2-step \u2014 Search Stripe customer, send Gmail email
|
|
3774
|
+
### Example 1: Simple 2-step workflow \u2014 Search Stripe customer, send Gmail email
|
|
3775
3775
|
|
|
3776
3776
|
\`\`\`json
|
|
3777
3777
|
{
|
|
@@ -3907,7 +3907,7 @@ To modify an existing flow:
|
|
|
3907
3907
|
}
|
|
3908
3908
|
\`\`\`
|
|
3909
3909
|
|
|
3910
|
-
### Example 3: Loop \u2014 Iterate over Shopify orders, create invoices
|
|
3910
|
+
### Example 3: Loop workflow \u2014 Iterate over Shopify orders, create invoices
|
|
3911
3911
|
|
|
3912
3912
|
\`\`\`json
|
|
3913
3913
|
{
|
|
@@ -3985,16 +3985,16 @@ To modify an existing flow:
|
|
|
3985
3985
|
## CLI Commands Reference
|
|
3986
3986
|
|
|
3987
3987
|
\`\`\`bash
|
|
3988
|
-
# Create a
|
|
3988
|
+
# Create a workflow
|
|
3989
3989
|
one --agent flow create <key> --definition '<json>'
|
|
3990
3990
|
|
|
3991
|
-
# List all
|
|
3991
|
+
# List all workflows
|
|
3992
3992
|
one --agent flow list
|
|
3993
3993
|
|
|
3994
|
-
# Validate a
|
|
3994
|
+
# Validate a workflow
|
|
3995
3995
|
one --agent flow validate <key>
|
|
3996
3996
|
|
|
3997
|
-
# Execute a
|
|
3997
|
+
# Execute a workflow
|
|
3998
3998
|
one --agent flow execute <key> -i connectionKey=value -i param=value
|
|
3999
3999
|
|
|
4000
4000
|
# Execute with dry run (validate only)
|
|
@@ -4003,7 +4003,7 @@ one --agent flow execute <key> --dry-run -i connectionKey=value
|
|
|
4003
4003
|
# Execute with verbose output
|
|
4004
4004
|
one --agent flow execute <key> -v -i connectionKey=value
|
|
4005
4005
|
|
|
4006
|
-
# List
|
|
4006
|
+
# List workflow runs
|
|
4007
4007
|
one --agent flow runs [flowKey]
|
|
4008
4008
|
|
|
4009
4009
|
# Resume a paused/failed run
|
|
@@ -4013,16 +4013,16 @@ one --agent flow resume <runId>
|
|
|
4013
4013
|
## Important Notes
|
|
4014
4014
|
|
|
4015
4015
|
- **Always use \`--agent\` flag** for structured JSON output
|
|
4016
|
-
- **Always call \`one actions knowledge\`** before adding an action step to a
|
|
4016
|
+
- **Always call \`one actions knowledge\`** before adding an action step to a workflow
|
|
4017
4017
|
- Platform names are **kebab-case** (e.g., \`hub-spot\`, not \`HubSpot\`)
|
|
4018
|
-
- Connection keys are **inputs**, not hardcoded \u2014 makes
|
|
4018
|
+
- Connection keys are **inputs**, not hardcoded \u2014 makes workflows portable and shareable
|
|
4019
4019
|
- Use \`$.input.*\` for input values, \`$.steps.*\` for step results
|
|
4020
4020
|
- Action IDs in examples (like \`STRIPE_SEARCH_CUSTOMERS_ACTION_ID\`) are placeholders \u2014 always use \`one actions search\` to find the real IDs
|
|
4021
4021
|
`;
|
|
4022
4022
|
var TOPICS = [
|
|
4023
4023
|
{ topic: "overview", description: "Setup, --agent flag, discovery workflow" },
|
|
4024
4024
|
{ topic: "actions", description: "Search, read docs, and execute platform actions" },
|
|
4025
|
-
{ topic: "flows", description: "Build and execute multi-step
|
|
4025
|
+
{ topic: "flows", description: "Build and execute multi-step workflows" },
|
|
4026
4026
|
{ topic: "all", description: "Complete guide (all topics combined)" }
|
|
4027
4027
|
];
|
|
4028
4028
|
function getGuideContent(topic) {
|
|
@@ -4032,7 +4032,7 @@ function getGuideContent(topic) {
|
|
|
4032
4032
|
case "actions":
|
|
4033
4033
|
return { title: "One CLI \u2014 Agent Guide: Actions", content: GUIDE_ACTIONS };
|
|
4034
4034
|
case "flows":
|
|
4035
|
-
return { title: "One CLI \u2014 Agent Guide:
|
|
4035
|
+
return { title: "One CLI \u2014 Agent Guide: Workflows", content: GUIDE_FLOWS };
|
|
4036
4036
|
case "all":
|
|
4037
4037
|
return {
|
|
4038
4038
|
title: "One CLI \u2014 Agent Guide: Complete",
|
|
@@ -4086,12 +4086,12 @@ program.name("one").option("--agent", "Machine-readable JSON output (no colors,
|
|
|
4086
4086
|
4. one actions execute <p> <id> <key> Execute the action
|
|
4087
4087
|
|
|
4088
4088
|
Guide:
|
|
4089
|
-
one guide [topic] Full CLI guide (topics: overview, actions,
|
|
4089
|
+
one guide [topic] Full CLI guide (topics: overview, actions, workflows, all)
|
|
4090
4090
|
|
|
4091
|
-
|
|
4092
|
-
one flow list List saved
|
|
4093
|
-
one flow create [key] Create a
|
|
4094
|
-
one flow execute <key> Execute a
|
|
4091
|
+
Workflows (multi-step):
|
|
4092
|
+
one flow list List saved workflows
|
|
4093
|
+
one flow create [key] Create a workflow from JSON
|
|
4094
|
+
one flow execute <key> Execute a workflow
|
|
4095
4095
|
one flow validate <key> Validate a flow
|
|
4096
4096
|
|
|
4097
4097
|
Example \u2014 send an email through Gmail:
|
|
@@ -4149,23 +4149,23 @@ actions.command("execute <platform> <actionId> <connectionKey>").alias("x").desc
|
|
|
4149
4149
|
dryRun: options.dryRun
|
|
4150
4150
|
});
|
|
4151
4151
|
});
|
|
4152
|
-
var flow = program.command("flow").alias("f").description("Create, execute, and manage multi-step
|
|
4153
|
-
flow.command("create [key]").description("Create a new
|
|
4152
|
+
var flow = program.command("flow").alias("f").description("Create, execute, and manage multi-step workflows");
|
|
4153
|
+
flow.command("create [key]").description("Create a new workflow from JSON definition").option("--definition <json>", "Workflow definition as JSON string").option("-o, --output <path>", "Custom output path (default .one/flows/<key>.flow.json)").action(async (key, options) => {
|
|
4154
4154
|
await flowCreateCommand(key, options);
|
|
4155
4155
|
});
|
|
4156
|
-
flow.command("execute <keyOrPath>").alias("x").description("Execute a
|
|
4156
|
+
flow.command("execute <keyOrPath>").alias("x").description("Execute a workflow by key or file path").option("-i, --input <name=value>", "Input parameter (repeatable)", collect, []).option("--dry-run", "Validate and show execution plan without running").option("-v, --verbose", "Show full request/response for each step").action(async (keyOrPath, options) => {
|
|
4157
4157
|
await flowExecuteCommand(keyOrPath, options);
|
|
4158
4158
|
});
|
|
4159
|
-
flow.command("list").alias("ls").description("List all
|
|
4159
|
+
flow.command("list").alias("ls").description("List all workflows in .one/flows/").action(async () => {
|
|
4160
4160
|
await flowListCommand();
|
|
4161
4161
|
});
|
|
4162
|
-
flow.command("validate <keyOrPath>").description("Validate a
|
|
4162
|
+
flow.command("validate <keyOrPath>").description("Validate a workflow JSON file").action(async (keyOrPath) => {
|
|
4163
4163
|
await flowValidateCommand(keyOrPath);
|
|
4164
4164
|
});
|
|
4165
|
-
flow.command("resume <runId>").description("Resume a paused or failed
|
|
4165
|
+
flow.command("resume <runId>").description("Resume a paused or failed workflow run").action(async (runId) => {
|
|
4166
4166
|
await flowResumeCommand(runId);
|
|
4167
4167
|
});
|
|
4168
|
-
flow.command("runs [flowKey]").description("List
|
|
4168
|
+
flow.command("runs [flowKey]").description("List workflow runs (optionally filtered by flow key)").action(async (flowKey) => {
|
|
4169
4169
|
await flowRunsCommand(flowKey);
|
|
4170
4170
|
});
|
|
4171
4171
|
program.command("guide [topic]").description("Full CLI usage guide for agents (topics: overview, actions, flows, all)").action(async (topic) => {
|