# How it works maps

> How the app's How it works maps are drawn, what updates by itself and what fails when it is stale.

Source: https://werker.cloud/docs/engineering/maps (updated 2026-12-02)

`/how-it-works` (`apps/app/src/lib/components/shell/nav-items.ts`)
draws two maps with Svelte Flow. A stage opens in a panel beside the
map.

## The two maps

- **How work moves:** one card per stage of the process, in rows
  (`process_rows`). Stages and links are in
  `apps/app/src/lib/maps/process-map.ts`; their words are in
  `apps/app/src/lib/messaging/maps.ts`.
- **How the code fits:** one card per package, with an arrow to each
  package it may import. Each package's description is written by
  hand.

## What updates by itself

- **Records, tables, tools, abilities, triggers and adapters** in a
  stage's panel are read from the [registry](registry.md) in
  `packages/domain` when the page is drawn (`stage-facts.ts`): the
  summary, the tables, who creates it, and whether it is planned.
- **A stage is drawn as planned** while every trigger it names is
  planned in the registry.
- **The code map** is built from `tools/checks/policy.ts`. The web app
  cannot import that file, so `pnpm docs:maps` writes
  `apps/app/src/lib/maps/app-map.generated.ts` from it. Columns are
  worked out from the dependencies (`layout.ts`).

A doc a stage names opens on werker.cloud
(`apps/app/src/lib/docs-site.ts`).

## What fails when the app changes and a map does not

- `tools/checks/app-map.test.ts` (in `pnpm test:boundaries`): the
  generated file does not match the policy. Run `pnpm docs:maps`.
- `apps/app/src/lib/maps/process-map.test.ts`:
  - a thing, record table, tool, ability or trigger in the registry is
    on no stage;
  - a run status is on no stage (a new `RunStatus` also fails to
    compile there);
  - a stage's page or one of its source files does not exist;
  - a package in the policy has no description, which also fails the
    type check of `messaging/maps.ts`.

## What is still written by hand

The stages, their order, the links between them and their summaries.
Nothing checks that a summary is true.
