Skip to content

Add viz CLI command (ASCII + DOT export) #46

@dgenio

Description

@dgenio

Context

Split from #33 (CLI meta-issue). This issue adds flow visualization export to the CLI established in #44.

What to do

1. ASCII visualization

chainweaver viz <flow_name> --format ascii produces terminal-friendly output:

Linear flows:

[double] → [add_ten] → [format_result]

DAG flows (when #10 is implemented):

          ┌─[branch_a]─┐
[start]──┤              ├──[merge]
          └─[branch_b]─┘

2. DOT (Graphviz) export

chainweaver viz <flow_name> --format dot produces valid DOT output:

digraph double_add_format {
    double -> add_ten;
    add_ten -> format_result;
}

This enables chainweaver viz flow --format dot | dot -Tpng -o flow.png without ChainWeaver depending on Graphviz.

3. Default format

--format ascii is the default.

Files to modify

  • chainweaver/cli.py — add viz subcommand
  • tests/test_cli.py — add visualization tests

Acceptance Criteria

  • chainweaver viz <flow> --format ascii produces ASCII visualization for linear flows
  • chainweaver viz <flow> --format dot produces valid DOT graph output
  • ASCII output uses arrow notation () for step connections
  • DOT output is syntactically valid (can be parsed by Graphviz)
  • Exit codes: 0 = success, 1 = flow not found
  • At least 3 test cases: ASCII output correctness, DOT output validity, missing flow error

Out of Scope

Dependencies


Part of CLI split from #33. See also: #44 (CLI entry + inspect), #45 (validate + check).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions