Haya.Tool
0.1.0
dotnet tool install --global Haya.Tool --version 0.1.0
dotnet new tool-manifest
dotnet tool install --local Haya.Tool --version 0.1.0
#tool dotnet:?package=Haya.Tool&version=0.1.0
nuke :add-package Haya.Tool --version 0.1.0
<p align="center"> <img src="docs/images/haya-logo.svg" alt="haya" width="280"> </p>
<h3 align="center">Living architecture docs, generated from your code.</h3>
<p align="center"> Haya reads small annotations you put next to your code (<code>Responsibility</code>, <code>Collaborator</code>, <code>Meta</code>) and generates CRC documents, C4 diagrams, a Backstage catalog and Datadog Software Catalog entities, for <b>C#</b> and <b>TypeScript</b> codebases. </p>
<p align="center"> <a href="https://github.com/dburriss/haya-net/actions/workflows/build.yml"><img src="https://github.com/dburriss/haya-net/actions/workflows/build.yml/badge.svg" alt="Build and test"></a> <a href="https://www.nuget.org/packages/Haya.Tool"><img src="https://img.shields.io/nuget/v/Haya.Tool?logo=nuget&label=Haya.Tool" alt="NuGet Haya.Tool"></a> <a href="https://www.nuget.org/packages/Haya"><img src="https://img.shields.io/nuget/v/Haya?logo=nuget&label=Haya" alt="NuGet Haya"></a> <a href="https://github.com/dburriss/haya-net/blob/main/LICENSE"><img src="https://img.shields.io/github/license/dburriss/haya-net" alt="License"></a> </p>
Get started
Install the tool and the attributes package (alpha, hence --prerelease; .NET 10 SDK required):
dotnet tool install --global Haya.Tool --prerelease
dotnet add package Haya --prerelease
For TypeScript, see the TypeScript tutorial.
Then annotate your code and run one command:
[assembly: Meta(AppName = "CheckoutApi", System = "HayaEcomm", Description = "Handles payment for a cart")]
[Responsibility(Description = "Handles order processing")]
public class CreditCardPaymentUsecase { }
haya crc -cc ./Example.sln
Start with the tutorial for your stack:
- Getting started with C#
- Getting started with TypeScript
- Custom C# attributes
- Custom TypeScript annotations
See the annotated C# example and its generated CRC.
What it does
- CRC documents. Components, Responsibilities and Collaborators as Markdown, optionally with embedded diagrams. See the CLI reference.
- C4 diagrams. Level 1 (system context) and level 2 (containers) as Mermaid. See Generate C4 diagrams.
- Interactive explorer.
diagram -f htmlwrites one self-contained page that starts with every system collapsed and lets you open systems, follow relationships, search and filter, for systems too big for a static diagram. See Explore the system graph, or try the live example (built in CI from examples/org-explorer). - Backstage catalog. One component per application with dependencies. See Publish to Backstage.
- Datadog Software Catalog.
entity.datadog.yamlwith services, datastores, queues, systems and their dependencies. See Publish to Datadog. - Describe files. A JSON/YAML description of an application that every other command accepts as input. See the describe format.
- Many systems at once. Merge several codebases, C# and TypeScript mixed, into one picture. See Document several systems together.
- Same output on both stacks. The C# tool (
Haya.Tool) and the TypeScript tool (Haya.Bun) share one rendering core. See Architecture.
Haya is not a replacement for good documentation practices. It keeps a minimum level of documentation next to the code, so it stays current and a new joiner has somewhere to start exploring.
Documentation
Organised by Diataxis, starting at the docs index:
| I want to... | Go to |
|---|---|
| Learn Haya by doing | Tutorials |
| Get a specific job done | How-to guides |
| Look up a flag or attribute | CLI, Attributes |
| Understand why it works this way | Concepts, ADRs |
More: examples · changelog · contributing
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
Configuration: defaults for output path, formats, detail, `crc` diagrams, referenced assemblies (`dotnet.references`) and the
The html explorer's filters are hidden until the **Filters** button is pressed.
The html explorer's side panel can be hidden and shown again with the **Panel** button or `p`. It is open by default on a
The html explorer's address now always holds a link to the current view: shown apps, apps opened to their classes, and the
**Breaking:** `--detail members` records **dependencies** between annotated classes instead of `Uses`. When an annotated
`haya describe` writes describe format `0.5`: every document has a top-level `"detail"` (`"apps"` by default), so default
**Breaking:** `haya diagram -t/--diagram-type c4system|c4container` is replaced by `-d/--detail systems|apps|components`
A `members` detail level, opt-in: `haya describe --detail members` and `haya diagram --detail members` record, for each class
With `--detail members`, the explorer's class panel shows **Constructor** and **Members** (graph format `0.4` adds
The org-explorer example (and its [live page](https://dburriss.github.io/haya-net/)) is built with `--detail members`: the
With `--detail components`, the explorer (`haya diagram -f html`) lists an app's components in its panel: each class that carries a `[Responsibility]`
`haya diagram --detail components` writes a Mermaid C4 component diagram (level 3): each app's annotated classes inside its
In the explorer with `--detail components`, double-click an app with annotated classes to open it: its classes are drawn inside it, the apps it connects
In the explorer, selecting a class (or searching for one) no longer keeps its app's and system's own lines and neighbours