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
@@ -54,6 +54,9 @@ clear operator feedback before adding more architecture.
- Completed: the opencode browser-click challenge harness is local-first via
`wf --config examples/browser_click_workflow/wf.config.json --local`, with
optional `--start-server` / `--server-url` modes for JSON-RPC-path trials.
- Completed: focused draft edit helpers are exposed through RPC/CLI, and
`wf deploy create` is accepted as an alias for `wf deploy save`. Docs now
distinguish draft shape from raw plan shape for agent authoring.
- Keep status read-only; do not mutate registry, auth, config, or stores.
## Priority 2: Durable Run/Resume Hardening
File diff suppressed because it is too large Load Diff
+23 -1
View File
@@ -286,6 +286,22 @@ wf draft patch concat_ws \
--input-file draft-patch.json
```
Focused draft edit commands cover common graph edits without writing RFC 6902
patches directly:
```bash
wf draft set-name concat_ws --revision 1 --name concat_ws_v2
wf draft set-route concat_ws --revision 2 --step call --outcome ok --to __end__
wf draft set-input concat_ws --revision 3 --step call --map input.items=items --map input.separator=separator
wf draft set-output concat_ws --revision 4 --step call --map value=state.value
```
`set-input` maps graph source paths to node-local input fields:
`input.text=text` means `input.text -> local.text`.
`set-output` maps node-local output fields to workflow state paths:
`text=state.text` means `local.text -> state.text`.
Validate:
```bash
@@ -346,6 +362,10 @@ wf artifact create-from-plan workflow.plan.json \
--binding local.ops=local.ops
```
`artifact create-from-plan` expects the raw workflow plan shape (`nodes`,
`edges`, `node`). It does not accept draft workspace shape (`steps`, `routes`,
`use`).
Prefer draft workspaces for iterative authoring. Use `create-from-plan` when a
compiler, fixture, or advanced client already has a complete raw workflow plan.
@@ -368,6 +388,9 @@ wf deploy save concat_ws.default \
--version 1
```
`wf deploy create` is accepted as an alias for `wf deploy save`; docs use
`save` as the canonical verb because deployments are mutable records.
Save a deployment from JSON:
```bash
@@ -527,5 +550,4 @@ wf explain --input-file validation-output.json
- The CLI reuses `wf_mcp` service/config/store wiring in v1.
- Config loading registers stores and connections, but not arbitrary in-memory
test `NodeSpec` functions.
- Targeted draft editing helpers such as `wf draft step add` are not in v1.
- `wf` does not replace MCP resources/prompts or interactive MCP clients.
+20
View File
@@ -718,6 +718,26 @@ workflow can wrap a raw MCP call and map result content to outcomes such as
`found`, `not_found`, `unauthorized`, or `rate_limited` when those meanings are
known for that tool.
## Raw Plan Import
`wf artifact create-from-plan` imports a complete raw workflow plan. This is an
advanced/compiler path, not the interactive draft authoring path.
Raw plans use execution-model fields such as:
- `nodes`
- `edges`
- node field `node`
Draft workspaces use authoring fields such as:
- `steps`
- `routes`
- step field `use`
Do not pass draft JSON to `artifact create-from-plan`; save drafts with
`wf draft save`.
## Open Questions
- How should child workflow interrupts compose with parent workflow execution
+16
View File
@@ -667,6 +667,22 @@ the authoring envelope while raw JSON Schema fields remain plain JSON objects.
path. It validates and compiles the same draft workspace, but fixes the saved
artifact kind to `wrapper` so clients do not need to pass `kind` manually.
## Focused Edit Commands
For routine edits, prefer focused commands over hand-written JSON Patch:
```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_step_or___end__>
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
```
Use `draft patch` when these focused commands do not cover the structural edit.
Drafts are not raw workflow plans. Drafts use `steps`, `routes`, and step field
`use`. Raw plans use `nodes`, `edges`, and node field `node`.
## Patching Drafts
`patch_draft` accepts JSON Patch operations.