Skip to content

feat: add dotflow viz β€” terminal pipeline visualization command#160

Open
avarga1 wants to merge 5 commits intodotflow-io:developfrom
avarga1:feature/108-viz
Open

feat: add dotflow viz β€” terminal pipeline visualization command#160
avarga1 wants to merge 5 commits intodotflow-io:developfrom
avarga1:feature/108-viz

Conversation

@avarga1
Copy link
Copy Markdown

@avarga1 avarga1 commented Apr 7, 2026

Closes #108

What this adds

A new dotflow viz CLI command that renders any workflow as an ASCII pipeline diagram β€” no browser, no external service, zero new dependencies (uses rich which is already in the project).

$ dotflow viz -s my_pipeline.workflow

dotflow viz  Β·  3 tasks  Β·  mode: sequential

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ extract        β”‚ ──▢ β”‚ transform      β”‚ ──▢ β”‚ load_data      β”‚
β”‚                β”‚     β”‚                β”‚     β”‚                β”‚
β”‚                β”‚     β”‚ retry: 3       β”‚     β”‚ timeout: 30s   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Parallel mode stacks tasks with a fork bracket:

$ dotflow viz -s my_pipeline.workflow -m parallel

dotflow viz  Β·  3 tasks  Β·  mode: parallel

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ extract        β”‚
  β”Œβ”€β”‚                β”‚
  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  β”‚
  β”œβ”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ β”‚ transform      β”‚
  β”‚ β”‚ retry: 3       β”‚
  β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  β”‚
  β””β”€β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ load_data      β”‚
    β”‚ timeout: 30s   β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Mermaid export for docs:

$ dotflow viz -s my_pipeline.workflow --format mermaid

graph LR
  extract --> transform
  transform --> load_data

Files changed

File What
dotflow/utils/visualizer.py Core rendering logic β€” box builder, sequential/parallel/group/mermaid renderers
dotflow/cli/commands/viz.py VizCommand β€” wires the CLI args to the visualizer
dotflow/cli/commands/__init__.py Exports VizCommand
dotflow/cli/setup.py Registers dotflow viz subcommand with --step, --mode, --format args
tests/utils/test_visualizer.py 16 tests covering name resolution, box rendering, sequential, parallel, and mermaid output

Usage

# Sequential (default)
dotflow viz -s my_module.workflow

# Parallel
dotflow viz -s my_module.workflow -m parallel

# Mermaid export
dotflow viz -s my_module.workflow --format mermaid

Closes dotflow-io#108

New command: dotflow viz -s <step> [-m <mode>] [--format terminal|mermaid]

Renders a workflow pipeline as an ASCII box diagram in the terminal,
or exports Mermaid graph syntax for documentation.

- Sequential mode: boxes connected left-to-right with ──▢ arrows
- Parallel mode: stacked boxes with fork bracket on the left
- Sequential group mode: sections rendered per group
- Each box shows task name, retry count, and timeout when set
- --format mermaid outputs a graph LR Mermaid diagram
- 16 tests covering name resolution, box rendering, and all output modes
@avarga1
Copy link
Copy Markdown
Author

avarga1 commented Apr 9, 2026

Hey @dotflow-io β€” just checking in on this one. Happy to address any feedback or rebase if needed. Let me know!

Copy link
Copy Markdown
Member

@FernandoCelmer FernandoCelmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ” Code Review

Code issues found: 2 blocking/suggestion + 5 inline guidance comments

# Severity Comment
1 [Blocking] Background mode displays wrong label
2 [Suggestion] Duplicate names break Mermaid output
3 [Suggestion] Remove unnecessary inline comments in viz.py
4 [Suggestion] Remove narration comments in visualizer.py
5 [Suggestion] Use rich console instead of bare print()
6 [Suggestion] Leverage rich Panel/Tree/Columns for rendering
7 [Comment] Test structure feedback and missing test case

Comment thread dotflow/utils/visualizer.py
Comment thread dotflow/utils/visualizer.py
Comment thread dotflow/cli/commands/flow.py
Comment thread dotflow/utils/visualizer.py
Comment thread dotflow/utils/visualizer.py
Comment thread dotflow/utils/visualizer.py
Comment thread tests/utils/test_visualizer.py
@FernandoCelmer FernandoCelmer added the enhancement New feature or request label Apr 11, 2026
@FernandoCelmer
Copy link
Copy Markdown
Member

Hey! πŸ‘‹

Just a heads-up β€” this branch currently has merge conflicts with develop. Could you rebase or merge develop into your branch when you get a chance? That way we can get this reviewed and merged smoothly.

git checkout feature/ISSUE-108
git fetch origin
git merge origin/develop
# resolve conflicts
git push

πŸ’‘ Tip: If you're using Claude Code, there's a git-flow skill that automates branch naming, commits, and rebasing following the project conventions:

πŸ‘‰ https://github.com/FernandoCelmer/skills/blob/master/skills/git-flow/SKILL.md

You can install it with:

claude plugins install git-flow@FernandoCelmer-skills

It handles the feature/ISSUE-NUMBER branch pattern and conventional commit messages automatically β€” super handy for keeping everything consistent!

@FernandoCelmer
Copy link
Copy Markdown
Member

Hey! One more thing β€” could you rename the command from dotflow viz to dotflow flow? This applies to:

  • The CLI subcommand registration (add_parser("viz", ...) β†’ add_parser("flow", ...))
  • The class name (VizCommand β†’ FlowCommand)
  • The file name (commands/viz.py β†’ commands/flow.py)
  • The setup method (setup_viz() β†’ setup_flow())
  • The __all__ export and imports
  • Help texts and docstrings referencing "viz"

dotflow flow reads more naturally as a pipeline visualization command and aligns better with the project's naming conventions.

avarga1 added 4 commits April 11, 2026 15:12
- Rename command viz β†’ flow (file, class, setup method, subcommand, __all__)
- Fix background mode showing wrong label (was falling through to sequential)
- Fix Mermaid duplicate node IDs collapsing into self-loop (positional suffix)
- Use console.print() instead of bare print() for Mermaid output
- Remove narration inline comments; keep only non-obvious why comments
- Add test for duplicate task names in Mermaid output
- Update existing Mermaid tests for new node ID format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants