Skip to content

The devtools tab

The Grimoire tab shows the book and the written files in the devtools dashboard at /__warlock. It reads the agent-written files and keeps the generated book up to date, with cached routes.

List the panel in src/config/devtools.ts:

src/config/devtools.ts
export default {
panels: ["@warlock.js/grimoire/devtools"],
};

Devtools imports it in development only. See Registering a panel for how panels load.

With the devtools production monitor enabled, the Grimoire tab also shows in the production dashboard, behind its sign-in. It is read-only there: it opens the book without writing any file, and it still never boots your app.

The tab opens with a bar of nine views: Product map, Bird view, Overview, Features, Apps, Tasks, Releases, Check and Modules. The Product map is the view for readers who do not read code; see the product map. The Bird view is described below. The one you are in is marked, and small counts show how much each holds. Detail views (a feature, a flow, a page, a task, a release, a file) belong to the view they came from and show a breadcrumb back to it, such as Features, then auth, then the flow.

One search box sits above every view. Press / anywhere outside a text field to jump to it and Escape to clear it. It looks across flows, blocks, pages, routes, files, exports and tasks and ranks them the way warlock scry --search does, so a whole sentence works; the hits are grouped by type, the group with the best hit first. Move through them with the arrow keys and press Enter to open one. Views link to each other with hash links such as #grimoire/flow/catalog/new-arrivals, so you can copy the address of what you are looking at.

Under the Warlock.js adapter, the header shows the Warlock logo with the installed framework version, and the bottom of the tab shows your app’s own name and version (from its package.json), for example shop 1.4.0. Another adapter shows these only when it supplies a host() (see below); with none, nothing is shown. The static export and the shared Product map show the same.

A large book can take a few seconds to open the first time. The tab shows an “Opening the book” state at once, and a failed view says what failed, why and what to do next, with a button to try again.

ViewWhat it shows
Bird viewEvery criterion against every language: test status, screenshots and approval. See The Bird view.
OverviewCards for the features by status, flows, apps, pages and screens, every open task (with how many of them wait for approval), check errors and warnings, and the size of the book; the route facts with the build hint when they are old or missing; recent releases and the top check problems.
FeaturesEvery feature as a card with its status, version, flow count and flow names. Filter by status or text, sort by name, status, flows or last update; the count reads “12 of 30 features”.
FeatureA page of tabs: see The feature page.
FlowSee The flow page.
AppsOne card per written app (site or mobile) with its root and counts. Pages and screens are grouped by the first segment of their route (a group of more than 6 pages starts closed), with a text filter and a confirmed, inferred or unmarked status per row.
Page or screenIts blocks (with the layout’s), who sees each, what each changes with, the files in the book, and a graph of the page and its blocks.
Tasks, ReleasesThe open, waiting and done tasks from the index (a task waiting for approval is listed only under waiting) with a filter, and each release with what it collected, grouped by feature.
CheckThe findings of warlock grimoire check, grouped by code. See The Check tab.
File, routeThe book entry: exports, imports, importers, owner, flows, routes, and a graph of the file’s neighbours; or a route with the files behind it.
ModulesModule coupling, with the modules listed by how many imports tie them to others. See The Modules view.

The graphs are plain SVG with at most 60 nodes. Click a node to open it.

With no features written, the tab still works from the book: search, files, routes and the module graph. The overview says that no features are written yet.

The feature page has a header (breadcrumb, title, status, version, origin) and five tabs. The counts on the tabs read from the answer, and a tab’s content is built only when it opens, so a feature with thousands of files stays light. Each tab has its own address, and an address without a tab opens the first one.

TabAddressWhat it shows
Overview#grimoire/feature/<id>The summary, a health strip (flows, criteria proven, findings, own files), the feature map, the flows as cards, a graph of the feature and its neighbours, open tasks and recent changes.
Flows#grimoire/feature/<id>/flowsOne row per flow: status, steps, cases, criteria tested out of written and findings.
Files#grimoire/feature/<id>/filesThe feature’s own files grouped by module, every group closed until opened, with a filter box and a count on each group. Routes, pages and screens, borrowed files and files no flow reaches are groups too.
Findings#grimoire/feature/<id>/findingsThe feature’s findings grouped by code, every group closed, with the severity, the check’s title and a count. The tab count leaves out expected findings.
Tests#grimoire/feature/<id>/testsEach flow’s criteria with the tests that prove them (file, line, name, result).

The feature map is a grid: one row per flow and one column per place the feature runs. The columns are each site and each mobile app the flows touch (named by the app’s title, or its id when none is written), then API (the route steps), then Background (mail, job, event and notification steps). A cell holds small chips for the pages, screens, routes and named steps that the flow’s steps resolve to; each chip links to the page, route or file view. A step the book could not find shows as a dashed chip. An empty cell is a dash, and a column no flow reaches is left out. On a phone each flow becomes a card that lists only the places it touches. The data comes with the feature answer (map), built from the steps the book already resolved; nothing is looked up twice.

On the Overview each flow is a card that links to the flow page: the heading as the title, the flow id under it, a status pill coloured by meaning, “since” version, and the counts it has (steps, cases, criteria tested out of written, and a warning pill when the flow has findings). The cards sit in a responsive grid and stack in one column on a phone.

The flow page has a header and a health strip above four tabs:

  1. Header: breadcrumb, title, the summary (the paragraph under the title, or a hint to add one), status, origin (inferred or confirmed), version, who, the apps, and links to the previous and next flow of the feature.
  2. Health strip: criteria proven, the last test run (or “no results recorded”), findings (a link to the Check tab filtered to this flow) and steps resolved.
TabAddressWhat it shows
Journey#grimoire/flow/<feature>/<flow>The ## Story when written, then the written steps drawn in order as connected nodes (a row that wraps; one column on a phone). A node has a glyph for its type (page, route, mail, job, event, notification, affects), the number and the name. A step the book could not find is dashed and tinted. Click a node to open its panel: the note, the linked flow of an affects step, the file it starts from and counts such as “6 direct · 8 in feature · 1192 reachable”; “Show files” opens tabs (direct imports, in this feature, all reachable, type-only) that load 200 files at a time. Under the drawing a What if… lane lists each handled case as a small card (the question, the answer and links to the criteria that prove it; “Does not apply” is collapsed). The cases are not tied to a step because the written files do not say which step a case belongs to. Then differs by app, not handled, unknowns, where users see it, and history.
Proof#grimoire/flow/<feature>/<flow>/proofFix next (the first failing criterion, else the first without a test, else one that has not run or is stale; for a criterion without a test, the // @proves <feature>/<flow> AC-n line with a Copy button), then one row per criterion with one status and its tests.
Files#grimoire/flow/<feature>/<flow>/filesOne closed group per step with its file count; opening a group loads that step’s files.
Findings#grimoire/flow/<feature>/<flow>/findingsThe flow’s findings grouped by code, every group closed. Missing tests (GR4001) are left out because the Proof tab shows them per criterion.

The tabs are real buttons (role="tab", aria-selected); the arrow keys, Home and End move between them. Collapsible groups are buttons with aria-expanded. Choosing a tab updates the address without reloading the page, so a copied address opens the same tab.

When the project has @proves lines but no test results were ever recorded, the page says “No test results recorded yet” once, with the fix (add grimoireReporter(), run the tests, or set the panel option testResultsFile), and tagged criteria read “tagged” instead of “not-run”. Text in `backticks` shows as code.

The Bird view is one table of the whole product: features, then flows, then acceptance criteria down the side, and one column per language of the app across the top. The design-system feature comes first. A feature and a flow are collapsible; the ones with a failing, changed or rejected cell open by themselves.

Each cell shows the state in words and a glyph (colour is never the only signal), and a small thumbnail of the captured screenshot when the criterion has a @shows scene in that language. The states, worst first:

StateMeaning
RejectedA change was rejected and is still in the code.
FailingA proving test failed, or the scene failed in this language.
Changed, not approvedThe screenshot, the criterion or its flow differs from the approved baseline.
Needs a new runA proving test changed since its last result.
Not run yetNo result yet for the test, or the scene has no capture in this language.
No testThe criterion has no @proves test.
PassingEverything that applies is green and approved.

A criterion written for one app (AC-2 [web]) shows the app as a chip, and a flow that differs by app lists those apps on its row. A criterion that was approved and is no longer written stays as a struck-through “removed” row, marked changed, until you approve the removal.

Open a cell for the side-by-side panel: the approved image on the left, the captured image on the right, the test status, and a plain sentence for each change not approved (for a changed criterion, its text before and after). In development the panel has Approve and Reject (with an optional reason). Both write grimoire/approved/ the same way warlock grimoire approve and reject do, then the view reloads. If the write fails, the panel stays open and says what failed and what to do. The buttons are not shown in a production dashboard, in the static export or through a share link. A flow’s own changes (a case that was added or removed) open from the “Review the flow’s changes” button on its row.

The box above the table jumps to a feature, a flow or a criterion: it matches a feature id or title, a flow reference or title, and an AC-n number (AC-1 does not match AC-10). A match opens its rows, and the filter stays in the address (#grimoire/bird-view?q=AC-3).

It works with no screenshots and no baseline: the cells then show the test status only. With no baseline a note says “Nothing approved yet” and, in development, offers Approve all, which creates the baseline from the current state. With the screenshot mode off a note says so. The tab’s count is the number of failing, changed and rejected cells plus the changes to whole flows.

The static export (warlock grimoire build --site) includes the Bird view and the images it shows, read-only. The business export (--site --product) and share links do not: the table names the test status of every criterion. A share link may load images from grimoire/screenshots/, the folder the Product map’s screenshots come from, and that folder also holds the approved images (in git) and, where browser tests ran, the captured ones. Anyone with a share link who knows a path such as approved/<feature>/<flow>/AC-1.en.png can load that image, so share only an app whose screens you would show anyway.

Module coupling is drawn as a graph while the app is small. Above 40 modules the view opens on a matrix of the 20 most connected modules instead, since a graph of that many names overlaps: each cell counts the imports from the module on its row to the module in its column, and a Graph button switches to the drawing. Labels are cut from the right and the full path is in each node’s tooltip. Sites, mobile apps and other roots outside src/app sit on an inner ring, apart from the src/app modules. A module with more than 500 files shows its file count in its label.

The tab shows the headline “0 errors · 12 warnings in 3 kinds”, then one card per code with its count, the fix written once, and its features with a count each. “Show” loads that feature’s findings a page at a time; “Show all” loads the whole code. Files no flow reaches (GR3006) are listed one row per feature, with “Show files” for the paths. Filter by severity, state (to fix or expected), code, feature or flow. The filters live in the address, for example #grimoire/check?code=GR3006&feature=cart, so you can share or bookmark a filtered view. The Overview’s “Top problems” ranks the codes (errors first, then the largest count) and links to the filtered tab.

At 390 px wide the tab has no horizontal page scroll. Under 640 px the tab bar wraps onto two rows, so every tab stays visible; tables become cards that name each column; ids never wrap; graphs scroll inside their card and label only small graphs (point at a node for its name); the flow page keeps a small header with its title in view, and the previous and next links sit at the bottom. It follows the dashboard’s light and dark colours.

The tab opens the book once and keeps that snapshot in memory; concurrent requests share one open.

  • In production the snapshot is reused with no time limit until the book changes. Creating the panel never scans the app: the book opens on the first view of the tab, from the stored book when it is current (no build) and built in memory otherwise. Set warm: true to open it ahead of the first view (after boot, never during it). A cheap change check (a few stat calls on the book manifest and the written folders, no directory walk) reopens the book when you rebuild it or an agent adds or removes a written file.
  • In development the snapshot is reused for 2 seconds, or five times as long as the last open took when that is longer. After that the tab serves the cached snapshot at once and refreshes it in the background, so a view never waits on a reopen once the first open is done. If a refresh fails, the old snapshot keeps being served. Editing a file the route facts were read from (a routes file or something it imports) ends that window at once: the next view reopens the book and reads the route facts again from the running dev server, so the edited routes show as fresh. A panel given your own adapter does not read them live; it reports them stale until you run warlock grimoire build.

Panel options: warm opens the book before the first view (default: on in development with the default adapter, off otherwise; the open starts after boot and its failure shows on the first request), and the source scan of a build runs in a worker thread when the framework’s tooling can be loaded there, so a large app keeps answering requests while the book builds.

Set ttlMs (milliseconds) to choose the reuse time yourself, in either mode, by listing the panel as a pair:

src/config/devtools.ts
export default {
panels: [["@warlock.js/grimoire/devtools", { ttlMs: 60_000 }]],
};

The tab opens the snapshot the way warlock grimoire build does, but it never boots the app: in development it reads the route facts from the running dev server (on the first open and after a route edit), and otherwise it uses the cached ones. It reads the agent-written files and never changes them. It does write Warlock’s own generated files (the book entries and manifest, the book maps and the indexes), so the next open only redoes what changed since the last one.

It keeps the snapshot in memory and opens it again when the book manifest changes, or once it is two seconds old (longer when an open took long), so edits to the written files show on the next view. Requests that arrive together share one open, so two views never rebuild the book at the same time. The Overview and the Check tab use the same words for the route facts (fresh, cached, stale or missing, with what each means). When they are missing, the route, mail and notification steps are not checked: a flow’s “Steps resolved” count leaves them out and says how many were not checked, and no GR5008 is reported. Run warlock grimoire build to refresh the facts.

Every route sits behind the devtools guard, so only a local browser reaches it.

Served at /__warlock/api/grimoire, all GET:

RouteAnswer
/summaryRoute freshness, the features and tasks indexes, the check counts, the size of the book, and how many apps, pages, screens and releases are written.
/search?q=&limit=Ranked hits, as warlock scry --search.
/file?path=, /impact?path=, /route?method=&path=Answers of warlock scry.
/featuresThe features listing: the index with each README summary and flow headings.
/features/:featureThe feature with its book map, changes and findings.
/apps, /apps/:app/pages/:pageWritten apps with a row per page and screen (route, title, layout, blocks, confirmed or inferred); one page (by id or route) with its layout and book facts.
/flows/:feature/:flowThe flow with counts per step (never every file), the first 50 direct imports, health, the test results state, and the previous and next flow.
/flows/:feature/:flow/steps/:index/files?set=&offset=&limit=One page (up to 200) of a step’s files; set is direct, feature, reachable (default) or type-only.
/checkThe whole report; with code, feature, flow, severity, state, offset or limit one page of matching findings.
/check/groupsThe check by code: count, expected count, title, fix and features.
/product, /product/whats-new, /product/features/:feature, /product/flows/:feature/:flowThe product map answers.
/tasks, /releases, /releases/:releaseTasks index, releases, one release.
/graph/file?path=, /graph/feature/:feature, /graph/page?app=&page=, /graph/modules{ nodes, edges }, at most 60 nodes. Module nodes carry title, group (modules or roots) and files.
/matrixThe Bird view: languages, mode, baseline, features, flows, criteria and cells, every drift item, and development (whether Approve and Reject work).
POST /approve, POST /rejectDevelopment only, never through a share link. Body { ids, note? }; answer { done }.

An unknown item answers 404 with a message, and a missing parameter 400.

In development the tab reads the route, event and job facts from the running dev server itself: the live router, the event listeners noted since the dev server started, and the registered jobs. Nothing is booted and no module is loaded a second time, so the app’s connectors start once. A fresh checkout shows routes: fresh after the first open, without running warlock grimoire build. The first open builds the book once and shares that build across the tab’s first requests; the dev server also starts that build in the background right after boot (never during it), so it is usually ready by the time you open the tab. A failed background build never stops the dev server; the next request tries again. Facts are read on the first open and then live in the book; after you change a routes file (the dev server reloads it on save), the next view reads them again, so a route edit shows without warlock grimoire build. A routes file that throws on reload keeps its previous routes in the dev server until it loads again. A panel given your own adapter reads the facts through that adapter and is not warmed early. In production the tab only reads the book as it is on disk.

For people without the app running, export the tab:

import { exportGrimoireSite } from "@warlock.js/grimoire/devtools";
const folder = await exportGrimoireSite(process.cwd());
// "grimoire/book/site"

The folder holds one index.html. The view, its styles and the answers (as JSON) are inside it, so it opens straight from disk or from any static host. The default folder, grimoire/book/site, is inside the book folder: the book writer leaves it alone, and git ignores it. Pass outDir (project-relative or absolute) to write elsewhere; the function returns the folder relative to the project.

The static page answers everything in the table above except impact and route views, which need the running app and say so in place. Search runs in the page over the exported names. The page carries its own light and dark colours (it follows the system setting), so it reads the same as the tab. Per-file answers cover the 3000 most imported files. The search reads the written text of features and flows too and groups hits by type. For a version without code detail, pass product: true (the CLI is warlock grimoire build --site --product): it exports the Product map only, with no file paths, test names or per-file answers. exportGrimoireSiteDetailed() also says whether the folder was already current (upToDate) and then writes nothing.

The export function takes the same adapter as the rest of the package; with no adapter option it uses the Warlock one.

An adapter may add an optional host(root) method. It returns { name, version, logo, app }: the framework name and installed version, a small logo as a data:image/... URI, and the app’s own { name, version }, or null. The tab passes it to the view in the summary answer (host), so the header and footer fill in. The Warlock adapter supplies the Warlock.js logo and the installed @warlock.js/core version; Grimoire itself stays framework-neutral.