Files
video-setup/docs/cli/reconciler_cli.md
mikael-lovqvists-claude-agent 44090c1d6d docs: write CLI docs for all 12 previously undocumented tools
Add docs/cli/ entries for:
  transport_cli, discovery_cli, config_cli, protocol_cli, query_cli,
  test_image_cli, xorg_cli, v4l2_view_cli, stream_send_cli,
  stream_recv_cli, reconciler_cli, controller_cli

Each doc covers: description, build instructions, full usage with all
options and defaults, example output, and a relationship note pointing
to related tools. controller_cli includes the display control IDs table
and notes its temporary status.

README.md: convert all CLI tool entries to links.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 00:45:27 +00:00

84 lines
2.6 KiB
Markdown

# reconciler_cli
An interactive REPL for exploring the reconciler module. Sets up a simulated three-resource state machine (device, transport, stream) with declared dependencies and lets you drive reconciliation manually — useful for understanding reconciler behaviour before wiring it into the node.
---
## Build
From the repository root:
```sh
make cli
```
The binary is placed in `build/cli/`.
---
## Usage
```sh
./reconciler_cli
```
Drops into an interactive prompt:
```
reconciler> _
```
### Demo resources
Three resources are pre-configured:
| Resource | States | Notes |
|---|---|---|
| `device` | CLOSED → OPEN → STREAMING | Simulates a V4L2 device |
| `transport` | DISCONNECTED → CONNECTED | Depends on device=OPEN |
| `stream` | INACTIVE → ACTIVE | Depends on transport=CONNECTED and device=STREAMING |
Dependencies are checked before each transition: the reconciler will not advance a resource until all its prerequisites are met. Blocked resources show the unmet dependency in the status output.
### Commands
```
status print all resources with current/wanted state and transition status
want <name> <state> set the desired state (by number or case-insensitive name)
tick run one reconciler tick
run tick until stable (max 20 ticks) or a failure occurs
fail <name> make the next action for this resource fail (simulates an error)
help show commands
quit / exit exit
```
### Example session
```
reconciler> want device STREAMING
reconciler> want transport CONNECTED
reconciler> want stream ACTIVE
reconciler> run
[device] CLOSED → OPEN ok
[device] OPEN → STREAMING ok
[transport] DISCONNECTED → CONNECTED ok
[stream] INACTIVE → ACTIVE ok
reconciler> status
device current=STREAMING wanted=STREAMING
transport current=CONNECTED wanted=CONNECTED
stream current=ACTIVE wanted=ACTIVE
reconciler> fail transport
reconciler> tick
[transport] CONNECTED → DISCONNECTED error (simulated)
reconciler> status
device current=STREAMING wanted=STREAMING
transport current=DISCONNECTED wanted=CONNECTED (will retry)
stream current=ACTIVE wanted=ACTIVE (blocked: transport != CONNECTED)
```
---
## Relationship to the Video Routing System
The reconciler module manages device open/close and transport connect/disconnect in the video node. `reconciler_cli` lets you exercise the BFS pathfinding, dependency checking, and event-driven tick logic without any real hardware — the same code paths that run in the node on every incoming command or timer event.