Apps, pages and blocks
grimoire/apps/ describes where people meet the product: one folder per site or mobile app. Each page or screen
lists its blocks, and each block points to a feature flow. The flow says what happens. The app folder says
where it is shown and to whom.
An app
Section titled “An app”---id: web-clienttype: siteroot: src/web/$sites/client---
# The shop website
## Conditions
- guest not signed in- customer signed in- vip customer with the vip membershiptypeissiteormobile.originis optional:inferredwhen you described the app from code,confirmedonce the owner agrees. Layouts, pages and screens take it too.rootis the project folder of the site (src/web/$sites/client, orsrc/webin a single-site app) or of the mobile app (mobile). Warlock matches the app to the site or mobile app the code reports by this folder.## Conditionsdeclares every named condition the app uses: who is looking (guest,customer), a membership (vip), or a setting (pref:personalised). A block’s Who sees it can name only declared conditions.
Layouts
Section titled “Layouts”layouts/<layout>.md holds the blocks that every page of a layout shares (a header, a footer). It has the same
## Blocks table as a page. A page names its layout in the front matter: layout: site.
Pages and the Blocks table
Section titled “Pages and the Blocks table”---route: /products/:idlayout: site---
# Product
One product with its price, stock and the order button.
## Blocks
| Block | Flow | Who sees it | Changes with || ------------ | ----------------------- | ----------- | ----------------- || Details | catalog/browse-products | everyone | vip: member price || Order button | orders/place-order | customer | — || Sign in hint | — | guest | — |
## Also reached from
- mail order-confirmation| Column | Meaning |
|---|---|
| Block | The name of the block on the page. |
| Flow | The <feature>/<flow> the block shows, or — when it belongs to no flow (a header). |
| Who sees it | everyone, or condition names of the app (checked against the app’s conditions). |
| Changes with | —, or items separated by ;. Free text; names in backticks are checked (GR5010). |
route is the route of the page in its site. A page whose route is not in the site any more is reported.
Block files
Section titled “Block files”Put a block in its own file, pages/<page>/blocks/<block>.md, when how it looks or where it sits differs by app.
The file name is the block name in lower case with dashes (new-arrivals for New arrivals). The file points to
its flow in the front matter (flow: catalog/new-arrivals) and lists details such as position and shows.
Every block file needs a row in the page’s Blocks table.
Screenshots
Section titled “Screenshots”Show what a page, screen or block looks like with Markdown image lines, anywhere in its file outside code fences:
The image files live in grimoire/screenshots/ (any subfolders; .png, .jpg, .jpeg, .webp, .gif). Write
the path relative to the Markdown file, or starting with /grimoire/screenshots/. The Product map shows them under
“Where you see it”. A path outside the folder is GR1029 and a missing file is GR2014; both are warnings.
Screens: file-based or declared
Section titled “Screens: file-based or declared”A mobile app has screens instead of pages, in screens/<screen>/README.md.
- File-based routing (Expo Router). Warlock lists the screens from the file names under
app/(orsrc/app/). A group folder such as(tabs)is not part of the route,indexis the route of its folder, and[id]stays as written._layout,+not-found,+htmland+apifiles are not screens. Write the route of the screen in the front matter (route: /products/[id]); Warlock reports a route that has no file. - Navigation defined in code. Warlock does not read your source, so it lists no screens. Declare each screen
in
screens/<screen>/README.mdwith its name:screen: Orders. Nothing is compared with files.
Differs by app
Section titled “Differs by app”What the user gets can differ by app (a phone uses the device location, a site uses the account’s country). Write
that difference in the flow, under ## Differs by app. How a block looks or where it sits differs by app too: write
that in the app’s block file. Never copy the flow into the app.
How a page is reached, and what it requires
Section titled “How a page is reached, and what it requires”Do not write these. The book lists how a page is reached (the links and redirects Warlock can read) and what it requires (middleware and permissions). Write an entry point yourself only when the book cannot see it, such as a link in an email:
## Also reached from
- mail order-confirmationKinds mail, notification, page and screen are checked against the code; other kinds are free text.
App codes
Section titled “App codes”The check reports these. Each code is described on the check page.
| Code | Severity | Meaning |
|---|---|---|
GR5001 | error | A block row or block file points to a flow that does not exist. |
GR5002 | error | A condition is used in a block but not declared in the app README. |
GR5003 | error | A page’s route is not a page of its site. |
GR5004 | error | A page names a layout with no file. |
GR5005 | error | An app’s root matches no site or mobile app. |
GR5006 | error | A screen has no route, or its route is not a screen of a file-routed app. |
GR5007 | warning | A block file has no row in its page’s Blocks table. |
GR5008 | error | An entry point in Also reached from names no mail, notification, page or screen. |
GR5009 | warning | A site or mobile app has no folder in grimoire/apps (only once the folder has apps). |
GR5010 | warning | A name in backticks in Changes with is not a condition declared in the app README. |
A finding about a block or page fills its flow, so a proposed flow’s findings are shown as expected.
A flow or feature that names an app with no folder is GR2008.