# zebflow.command.run

Runs Zebflow's own operations — write and read files, register, switch on, switch off and delete pipelines — inside the fence a zebflow_control credential draws: one folder, one route prefix, the operations it opens and the credentials it delegates

# zebflow.command.run

```
zebflow.command.run --credential TEXT --command EXPR [--as EXPR] → command
```

Runs Zebflow's own operations — write and read files, register, switch on, switch off and delete pipelines — inside the fence a `zebflow_control` credential draws: one folder, one route prefix, the operations it opens and the credentials it delegates. A downstream app's webhook hands it `--command`, one `{ tool, arguments }` or a list, in the shape the MCP tools take. A pipeline it makes may start only with a webhook, schedule or manual trigger, may answer only under the route prefix, may use only delegated credentials named as written, and never uses `zebflow.*`; which other nodes it may use is the fence's `nodes` list, in deny mode (by default the project's shared stores: `sekejap`, `sqlite`, `kv`, `fs`, `table`, `function`) or allow mode (only those listed). `out` adds `command: { ok, results }`. A refused or failed command fails the node, naming its index, tool and reason; the commands before it stay done. Every change is recorded as `control · <fence>` and the `--as` person.

## Flags

- `--credential` (required): The zebflow_control credential that draws the fence.
- `--command` (required): One { tool, arguments } or a list of them: "{{ input.webhook.body }}".
- `--as`: Who asked, recorded beside the fence in the change record: "{{ input.webhook.auth.sub }}".

## Examples

### An admin-only door for a downstream app

```
| zebflow.command.run --credential zf_modules --command "{{ input.webhook.body }}" --as "{{ input.webhook.auth.sub }}"
```

Behind `trigger.webhook --auth jwt` with an admin role. The body is `{ "tool": "pipeline_activate", "arguments": { "file_rel_path": "modules/rain/jobs/hourly.zf.json" } }`.

It answers:

```json
{
  "command": {
    "ok": true,
    "results": [
      {
        "tool": "pipeline_activate",
        "ok": true,
        "answer": "activated modules/rain/jobs/hourly.zf.json"
      }
    ]
  }
}
```

## Used in

- [Let an app build inside its own project (control door)](/examples/app-control-door.md)
