The feature map
In a repository
Section titled “In a repository”A Tauri app keeps each feature in its own folder under desktop/src/features/. The Notes feature holds a
reach script, reach.ts: the steps a person takes to get to it in the running app.
import type { ReachScript } from '@kurvball/ashlar/reach';
export default { name: 'Notes', steps: [ { click: 'Notes', role: 'link' }, { click: 'New note', role: 'button' }, { type: 'Buy bread' }, { key: 'Enter' }, { snapshot: 'Buy bread', role: 'listitem' }, ],} satisfies ReachScript;ashlar map lists every feature, its reach and its proofs, the tests in its folder:
$ pnpm exec ashlar mapNotes desktop/src/features/notes Notes › New note › “Buy bread” › Enter › Buy bread 1 proofSettings desktop/src/features/settings no reach script yet 0 proofsSettings has no reach script yet, and ashlar check counts that as a break:
$ pnpm exec ashlar checkAshlar checked 5 files in 0.2 s: 1 count rose.
feature-reach in desktop/src/features/settings/reach.ts: 1, up from 0 desktop/src/features/settings/reach.ts:1:1 Every feature folder holds a reach script, `reach.ts`: the developer's way to the feature as drive steps, ending on a snapshot of what it reaches. It is plain data that imports only types. Write one, then run it with `ashlar drive <feature>`.Why a map
Section titled “Why a map”An agent told to "fix the notes screen" has to guess which code that is, and how to get there to see its work. A feature on the map has one name that the developer and every agent use for the same folder, and a way to it that a run proves.
The verify skill builds on it. An agent finds the features its work changes on the map, walks each one's reach in the running app, and shows screens of what it saw, named by the feature's name.
Feature folders
Section titled “Feature folders”A feature is a folder in an app's features: by default each folder in features/ inside the renderer, such
as desktop/src/features/* for a Tauri app at desktop. A repository with no apps has no features. See
Rules for how an app's layout is set.
A feature's name is the name its reach script gives. Until it has one, the name comes from its folder:
settings is Settings, and saved-searches is Saved searches. Each feature's name is its own. A reach
script whose name another feature already has, in any case, doesn't read.
A feature's proofs are the test files in its folder. A test file is one whose name ends with a suffix in the
config's tests, which are .test.ts and .test.tsx unless it says otherwise.
Reach scripts
Section titled “Reach scripts”A reach script is reach.ts in the feature's folder. Its default export is { name, steps }, and it imports
only types. Node loads it as it is, so it imports no component and runs nothing.
Each step does one thing:
| Step | What it does |
|---|---|
{ click: 'Save' } |
Clicks the one element with that accessible name. |
{ click: 'Save', role: 'button' } |
Clicks the one button with that name, when more than one element has it. |
{ type: 'Buy bread' } |
Types the text into what has focus. |
{ key: 'Meta+k' } |
Presses a key, named as Playwright names it, such as Enter, Escape or ControlOrMeta+j. |
{ snapshot: 'Buy bread' } |
Reads the element with that name from the accessibility tree, and fails when there is none. It may take a role too. |
The last step is a snapshot of what the reach gets to, so a run proves it got there, and no other step is one. A reach has at most 40 steps, a feature's name at most 60 characters, and an element's name at most 120. Steps name elements by the words on screen, as a snapshot shows them.
A role is one of the ARIA roles drive knows, such as button, link, heading, listitem, dialog,
tab or textbox.
ashlar map --json prints each step with the drive command line it runs. See
JSON outputs.
Drive a reach
Section titled “Drive a reach”Reach scripts are Ashlar's data, and Rehearse runs them: from its 0.3.0 it reads each one
as a flow, runs it on the base and on your work, and compares them. When the project has a rehearse.yaml
and names no drive command, ashlar drive starts Rehearse's drive and walks a reach through it, one step at a
time.
A project without Rehearse names its own drive command in the config instead:
import { defineConfig } from '@kurvball/ashlar';
export default defineConfig({ include: ['desktop'], apps: [{ root: 'desktop', stack: 'tauri' }], drive: 'pnpm drive',});$ pnpm exec ashlar drive notesNotes: reached in 5 steps.Ashlar stops any app left running, runs each step through the drive command, and stops the app again after. It stops at the first step that fails and says which and why:
$ pnpm exec ashlar drive notesNotes: its reach stopped at “New note”, step 2 of 5. Nothing on screen is named “New note”.--all walks every feature, and --scheme dark walks in the dark colour scheme:
$ pnpm exec ashlar drive --allNotes: reached in 5 steps.Settings has no reach script yet: write desktop/src/features/settings/reach.ts.1 of 2 features reached.drive exits with 0 when every reach got there, and 1 when one didn't.
The drive command is the project's own. It starts the app on a scratch home with a seeded scenario, and it
takes click --name <name> [--role <role>], type <text>, key <key>, snapshot [--name <name>],
screenshot <file.png>, record <file.webm> and stop. With --json, each prints its result as one JSON
object. A project with no drive command still has a map: its reach scripts are data the map shows, and
nothing walks them.
Related
Section titled “Related”- Write a reach script
- Use Ashlar with Rehearse: each reach becomes a flow Rehearse runs.
- Agent skills: the verify skill drives the map.
- Kurvball's reach scripts, for a project with no drive command yet.
- CLI reference