Skip to content

Use Ashlar with Rehearse

At the end of this guide, Rehearse runs your features' reach scripts as flows, and knows which of them a change reaches through Ashlar's import graph.

Rehearse tries changes: it brings the product up, runs scenarios on the base and on your work, and compares them. It never needs Ashlar. When a project uses Ashlar, Ashlar fills two of its blocks:

Rehearse needs Ashlar gives it
Flows: steps by accessible name each feature's reach script, as it is
What a change reaches, for rehearse list --affected ashlar dependents, from the import graph

Reach scripts stay Ashlar's data. Rehearse runs them.

  1. Print the blocks Ashlar fills:

    Terminal window
    $ pnpm exec ashlar rehearse
    # Ashlar fills these blocks of rehearse.yaml: each feature’s reach script is a flow, and it
    # covers its feature’s folder. rehearse list --affected asks `ashlar dependents` for the rest.
    scenarios:
    flows:
    - path: 'desktop/electron-renderer/features/board/reach.ts'
    covers: ['desktop/electron-renderer/features/board/**']

    Each feature with a reach script becomes a flow, and it covers its feature's folder: a change anywhere in that folder reaches the flow. --json prints the same block in Rehearse's manifest schema, with each flow as Rehearse reads it.

  2. Copy the block into rehearse.yaml, beside what your project already declares there.

  3. Ask what a change reaches. Rehearse runs this itself when it finds ashlar.config.ts and an ashlar binary:

    Terminal window
    $ pnpm exec ashlar dependents desktop/electron-renderer/client/ideas.ts --json
    {
    "v": 1,
    "dependents": {
    "desktop/electron-renderer/client/ideas.ts": [
    "desktop/electron-renderer/features/board/Board.test.tsx",
    "desktop/electron-renderer/features/board/Board.tsx",
    "desktop/electron-renderer/features/board/reach.ts"
    ]
    },
    "unknown": []
    }

    Each file lists every file that reaches it through imports, directly or not, and the reach script of each feature those files sit in. A reach script imports only types, so the graph alone would never lead to it. A file the graph doesn't hold, such as README.md, goes in unknown. The shape is Rehearse's own contract, v its version.

  4. See which features a change reaches. ashlar affected --json lists them beside the tests, each with the reach script Rehearse runs as its flow:

    "features": [
    {
    "folder": "desktop/electron-renderer/features/board",
    "reach": "desktop/electron-renderer/features/board/reach.ts"
    }
    ]
  5. Walk a feature. With a rehearse.yaml and no drive in ashlar.config.ts, ashlar drive <feature> walks its reach through rehearse drive: it stops anything left driven, starts the flows' service with rehearse drive start, takes each step, then stops again. A drive in the config wins: a project keeps its own drive command until it chooses Rehearse's. Rehearse's own browser shows the light colour scheme whatever --scheme asks; a service that names its own driver gets DRIVE_SCHEME and can honour it.

A gotcha can be a rule in .claude/rules/, or a Rehearse scenario that tries it on every change. Name the scenario file *.guard.flow.yaml or *.guard.rehearse.yaml, and ashlar onboard lists it as a gotcha of its folder, with its name and describe:

apps/api/src/orders/cutoff.guard.rehearse.yaml
name: A Toronto order at 16:59 still ships today
describe: The 17:00 cutoff once acted at noon.

Guards are found anywhere in the repository but the ignored folders, and onboard.guards in the config names other patterns. A rule in .claude/rules/ can point at its guard too, with guard: <scenario file> in its frontmatter; the guide and briefs then say "Guarded by" that file. Rehearse itself has no notion of a guard: the name is Ashlar's convention, and the scenario is an ordinary Rehearse scenario.