Skip to content

Commit ff4b67d

Browse files
authored
docs: explain auto-generated .mermaid files (#1506) (#1579)
1 parent 9682896 commit ff4b67d

5 files changed

Lines changed: 41 additions & 2 deletions

File tree

packages/uipath/docs/cli/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ Running `uipath init` will process these function definitions and create the cor
8282
✓ Created '.uipath/studio_metadata.json' file.
8383
✓ Created: CLAUDE.md, CLI_REFERENCE.md, SDK_REFERENCE.md, AGENTS.md, REQUIRED_STRUCTURE.md.
8484
```
85+
86+
/// info
87+
### About the `.mermaid` files
88+
89+
`uipath init` generates one `<entrypoint>.mermaid` file per function/agent containing a static call graph, rendered in the UiPath Orchestrator UI. These files are regenerated on every `uipath init`.
90+
///
8591
---
8692

8793
::: mkdocs-click

packages/uipath/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.10.49"
3+
version = "2.10.50"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath/src/uipath/_cli/cli_init.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ def write_studio_metadata_file(directory: str) -> None:
277277
)
278278

279279

280+
MERMAID_FILE_HEADER = (
281+
"%% AUTO-GENERATED by `uipath init`. Do not edit manually.\n"
282+
"%% Regenerated on every `uipath init`.\n"
283+
)
284+
285+
280286
def write_mermaid_files(entry_points: list[UiPathRuntimeSchema]) -> list[Path]:
281287
"""Write mermaid diagram files for each entrypoint.
282288
@@ -299,6 +305,7 @@ def write_mermaid_files(entry_points: list[UiPathRuntimeSchema]) -> list[Path]:
299305
mermaid_file_path = Path(os.getcwd()) / f"{ep.file_path}.mermaid"
300306

301307
with open(mermaid_file_path, "w") as f:
308+
f.write(MERMAID_FILE_HEADER)
302309
f.write(str(chart))
303310

304311
mermaid_paths.append(mermaid_file_path)

packages/uipath/tests/cli/test_init.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,3 +659,29 @@ def test_init_does_not_overwrite_existing_studio_metadata(
659659
metadata = json.load(f)
660660
assert metadata["schemaVersion"] == 99
661661
assert metadata["codeVersion"] == "5.0.0"
662+
663+
664+
class TestWriteMermaidFiles:
665+
def test_mermaid_file_starts_with_header_comment(
666+
self, runner: CliRunner, temp_dir: str
667+
) -> None:
668+
"""Generated .mermaid files begin with the clarifying header comment."""
669+
from uipath._cli.cli_init import MERMAID_FILE_HEADER, write_mermaid_files
670+
from uipath.runtime.schema import UiPathRuntimeGraph, UiPathRuntimeSchema
671+
672+
ep = UiPathRuntimeSchema(
673+
filePath="main.py",
674+
uniqueId="main",
675+
type="function",
676+
input={},
677+
output={},
678+
graph=UiPathRuntimeGraph(),
679+
)
680+
681+
with runner.isolated_filesystem(temp_dir=temp_dir):
682+
paths = write_mermaid_files([ep])
683+
assert len(paths) == 1
684+
contents = paths[0].read_text()
685+
assert contents.startswith(MERMAID_FILE_HEADER)
686+
assert "AUTO-GENERATED" in contents
687+
assert "uipath init" in contents

packages/uipath/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)