feat: add focused draft cli edits

This commit is contained in:
lda
2026-06-15 18:27:27 +07:00 Verified
parent 577fb4707a
commit 97076479f1
20 changed files with 1832 additions and 6 deletions
+3
View File
@@ -41,9 +41,12 @@ low-level escape hatch or you already have a complete compiler/generated plan.
lifecycle behavior.
- Treat wrapper hints as scaffolding, not semantic truth.
- Use draft workspaces for iterative authoring; avoid rewriting full drafts.
- Prefer focused draft edit commands before hand-writing JSON Patch.
- If a complete raw JSON/YAML plan already exists, the CLI escape hatch is
`wf artifact create-from-plan`; do not write helper scripts that call
`WorkflowApi.create_artifact_from_plan` directly.
- Use `artifact create-from-plan` only for complete raw plans; do not pass draft
JSON to it.
- Use explicit source bindings at deployment time.
- Keep traces bounded with `trace_range`.
- Do not expect a newly saved workflow to become a new MCP tool mid-session.
@@ -69,6 +69,21 @@ Prefer focused helpers over JSON Patch for common edits:
- `set_step_input_map`
- `set_step_output_map`
CLI equivalents:
```bash
wf draft set-name <workspace_id> --revision <n> --name <name>
wf draft set-route <workspace_id> --revision <n> --step <step_id> --outcome ok --to <target>
wf draft set-input <workspace_id> --revision <n> --step <step_id> --map input.text=text
wf draft set-output <workspace_id> --revision <n> --step <step_id> --map text=state.text
```
`set-input` direction: `input.text=text` means graph source `input.text` maps to
node-local target `local.text`.
`set-output` direction: `text=state.text` means node-local source `local.text`
maps to graph target `state.text`.
Use JSON Patch for structural edits the helpers do not cover.
For larger patches, write a JSON Patch array to a file and pass it with
@@ -18,12 +18,14 @@ validated, runnable deployment.
- MCP: `wf.workflow.create_draft_workspace_from_capability`
- CLI: `wf draft create-from-capability <workspace_id> <capability>`
5. Inspect/patch/validate the workspace until valid.
- Prefer focused helpers when available.
- Use JSON Patch only for general edits.
- Use focused CLI commands (`set-name`, `set-route`, `set-input`, `set-output`)
for common edits.
- Use JSON Patch only for general structural edits.
6. Save an artifact.
- Full workflow: `create_artifact_from_workspace`
- Reusable wrapper: `create_wrapper_from_workspace`
7. Save and validate a deployment.
- `wf deploy save` (or `wf deploy create` alias)
8. Run the deployment.
9. Inspect the run summary first; read bounded traces only when needed.
@@ -43,6 +45,10 @@ wf artifact create-from-plan workflow.plan.json \
--binding <logical_source>=<concrete_source>
```
Do not pass draft JSON to `artifact create-from-plan`. Drafts use `steps`,
`routes`, and step field `use`. Raw plans use `nodes`, `edges`, and node field
`node`.
Then continue with the normal deployment and run steps:
```bash