Haya.Tool
0.0.6
See the version list below for details.
dotnet tool install --global Haya.Tool --version 0.0.6
dotnet new tool-manifest
dotnet tool install --local Haya.Tool --version 0.0.6
#tool dotnet:?package=Haya.Tool&version=0.0.6
nuke :add-package Haya.Tool --version 0.0.6
<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.
**Breaking:** `Relationship.InternalUser` and `ExternalUser` are removed (C#, TypeScript and describe files). Use a
Releases are tag-driven: pushing a `v*` tag publishes `Haya` and `Haya.Tool` to NuGet with
People: a collaborator with `Kind = AppKind.Person` (C#; `kind: AppKind.Person` in TypeScript) is a user rather than an
The interactive explorer is published to GitHub Pages at <https://dburriss.github.io/haya-net/>, built in CI from `examples/org-explorer` (nine systems, JSON and YAML describe files); no HTML is committed.
`haya diagram -f html` writes an interactive graph explorer: one self-contained page (no network, works from a file)
`haya datadog` writes Datadog Software Catalog entities (`entity.datadog.yaml`, schema v3) on both the .NET tool and
`Lifecycle` and `Tier` on `Meta` (C# attributes and TypeScript `meta()`), written to the Datadog entity.
Describe format `0.3`: optional `meta.lifecycle`, `meta.tier` and an app-level `language` (`dotnet` or `javascript`)
`--include-references` and `--include-assembly <glob>` (with `--verbose`) read Haya attributes from public types in
Custom TypeScript annotations with defaults: `defineResponsibility`, `defineCollaborator` and `defineMeta` in
Custom C# attributes with defaults: derive from `ResponsibilityAttribute`, `CollaboratorAttribute` or `MetaAttribute` and
Documentation reorganised by Diataxis under `docs/` (tutorials, how-to guides, reference, explanation), a new README
C4 Level 2 (container) diagram: `crc -cc` adds it after the level 1 diagram and `diagram -t c4container` writes only
`Technology` and `Kind` on `Meta` (`meta({ technology, kind })` in TypeScript). `Kind` is an `AppKind`
Every command accepts several inputs (solutions, tsconfig projects and/or describe files, mixed) and builds one
`crc`, `describe`, `diagram` and `backstage` accept a `haya describe` file (`.json`, `.yaml`, `.yml`) as input
`Haya.Bun` is a working CLI: `crc`, `describe`, `diagram` and `backstage` for TypeScript projects, with a static analyser
`src/Haya.TypeScript` (`@haya/annotations`): `@Responsibility`, `@Collaborator` and `meta()` for TypeScript, replacing
`examples/typescript/example`: TypeScript equivalent of the C# example; its `CRC.md` is now generated by the CLI.
`src/Haya.Bun`: experimental Fable → TypeScript build of the CLI running on Bun (command skeleton).
`AGENTS.md` (with `CLAUDE.md` symlink), `global.json`, `nuget.config`, local Fable tool manifest.
The `describe` document is now version `0.2`: an app's `meta` may have `tech` and `kind` (left out when unset).
The `describe` document moved to version `0.1` before `0.2`: `{ "apps": [ { meta, responsibilities, collaborators } ], "version": "0.1" }`
Library API: `Describe`, `Crc`, `Diagram` and `Backstage` take an `App list` instead of a `Descriptor list`;
`Haya.Bun` references `Haya.Core` as a whole and compiles all of it with Fable (previously three linked files).
`crc` markdown is rendered by an internal builder instead of FuncyDown (output unchanged, always LF line endings).
JSON/YAML output is written with Flexi.Json and Flexi.Yaml via explicit encoders (ADR004), replacing
Roslyn analysis moved out of `Haya.Core` into the new `Haya.Roslyn` project (ADR003). `Haya.Core` no longer
Target .NET 10 (`Haya` attributes stay on netstandard2.0).
Upgraded dependencies: Roslyn 5.9, YamlDotNet 18.1, FuncyDown 1.4.2, Argu 6.2.5.
Tests migrated to xunit.v3 on Microsoft.Testing.Platform.
CI uses the SDK from `global.json` and builds the Bun project.
Markdown table cells escape `|` and newlines.
`diagram` (and the `crc` C4 diagram) apply the same default system for a collaborator without a `System` as
`backstage`: an app now lists, in `dependsOn`, the apps in the catalog that declare it as an upstream collaborator.
`backstage`: a collaborator without a `System` now takes its owning app's system (or `External` when its
`backstage`: `dependsOn` and `dependencyOf` now follow the collaborator `Direction`: downstream collaborators go in
`backstage` no longer fails for an app without `meta()`; it catalogues the collaborators only (regression test added).
`backstage -f json` now writes JSON (an array of Component entities) instead of YAML, on both stacks.
`Haya.Bun` now finds annotations in workspace packages imported by name (symlinked into `node_modules`) and in
`Haya.Tool` no longer emits a responsibility twice and drops the collaborator for a C# class that has both
Solutions containing F# projects no longer crash analysis; only C# projects are analysed.
FSharpPlus dependency.
Direct `Microsoft.Build` package references (Roslyn's MSBuild build host handles project loading).