Skip to main content

Graph Command

The graph command parses a workflow directory to construct and print a visual dependency graph of your API requests in Mermaid format. This graph shows the execution flow and variable dependencies between your request files.

Basic Usage

rumour graph <PATH>
  • <PATH> — Path to the workflow directory containing .toml request files.

Output Format

The command outputs a Mermaid-compatible diagram wrapped in a colored console frame.

Example Output

--- MERMAID GRAPH ---
graph TD
_home_bugsfounder_workspace_testing_dependency_example_producer_requests_producer_node_toml["producer_node"]
_home_bugsfounder_workspace_testing_dependency_example_consumer_requests_consumer_node_toml["consumer_node"]
_home_bugsfounder_workspace_testing_dependency_example_producer_requests_producer_node_toml -->|token| _home_bugsfounder_workspace_testing_dependency_example_consumer_requests_consumer_node_toml
----------------------

How Dependency Detection Works

Rumour's engine uses two methods to link requests together:

  1. Explicit Dependencies ([dependencies] block): Defined inside a request TOML to force a specific parent node and variable mapping:

    [dependencies]
    "../../producer/requests/producer_node.toml" = "token"
  2. Implicit Data Flow (Auto-detection): If 01_login.toml extracts token in its [extract] section, and a downstream request 02_profile.toml references {{token}} in its URL, headers, or body, the engine automatically draws a dependency edge between them:

    login -->|token| profile

Verified Example — Step-by-Step

Let's walk through the dependency_example workspace.

The Request Files

1. producer_node.toml (located in producer/requests/)

[request]
method = "POST"
url = "{{base_url}}/post"

[body]
type = "json"
raw = '{"session_token": "abc_123_xyz"}'

[extract]
token = "json.session_token"

2. consumer_node.toml (located in consumer/requests/)

[dependencies]
"../../producer/requests/producer_node.toml" = "token"

[request]
method = "GET"
url = "{{base_url}}/headers"

[headers]
Authorization = "Bearer {{token}}"

Run the Command

rumour graph /home/bugsfounder/workspace/testing/dependency_example/

Console Output:

--- MERMAID GRAPH ---
graph TD
_home_bugsfounder_workspace_testing_dependency_example_consumer_requests_consumer_node_toml["consumer_node"]
_home_bugsfounder_workspace_testing_dependency_example_producer_requests_producer_node_toml["producer_node"]
_home_bugsfounder_workspace_testing_dependency_example_producer_requests_producer_node_toml -->|token| _home_bugsfounder_workspace_testing_dependency_example_consumer_requests_consumer_node_toml
----------------------

Rendering the Mermaid Output

When rendered in a Markdown reader (like GitHub or Docusaurus), the Mermaid code produces this visualization:

Graph Annotations and Edge Labels

Connection StyleMeaningExample
A -->|variable| BNormal Flow: Node A extracts variable, which node B consumes.producer_node -->|token| consumer_node
A -->|SHARED_STATE_COLLISION:var| BConflict Warning: Two or more requests write to/modify the same variable var at the same level.node_a -->|SHARED_STATE_COLLISION:accessToken| node_b

Shared State Collision Example

If two separate producers write to the exact same variable key (e.g. accessToken), the graph highlights it so you can avoid runtime state race conditions:

producer_b -->|SHARED_STATE_COLLISION:accessToken| producer_a

Extracting the Graph to a File

Because rumour graph prints colorized console frames (--- MERMAID GRAPH ---), you need to remove the headers/footers and ANSI color escapes to get a pure .mmd file.

Simply copy the output text starting from graph TD down to the last node/edge line, and paste it into a file (e.g., workflow.mmd) or directly inside a Markdown code block:

```mermaid
graph TD
producer_node["producer_node"] -->|token| consumer_node["consumer_node"]
```

2. Command Line Extraction (Using sed/grep)

Use sed to strip the terminal header, footer, and ANSI color codes:

rumour graph ./requests | sed -e 's/\x1b\[[0-9;]*m//g' | grep -v '^-' > graph.mmd

This generates a clean graph.mmd file containing only the Mermaid graph lines:

graph TD
_home_bugsfounder_workspace_testing_run_example_requests_01_get_toml["01_get"]
...

Common Use Cases

Pre-execution Checks

Verify your test execution flow before initiating a long suite:

rumour graph ./test_suites/

Visualizing CI/CD Workflows

Generate Mermaid graphs of your test suites in your build documentation to keep documentation in sync with changing request files.