@warlock.js/grimoire 5.63.0 → 5.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/esm/book/build.d.mts.map +1 -1
  3. package/esm/book/build.mjs +24 -2
  4. package/esm/book/build.mjs.map +1 -1
  5. package/esm/check/check-grimoire.d.mts.map +1 -1
  6. package/esm/check/check-grimoire.mjs +11 -1
  7. package/esm/check/check-grimoire.mjs.map +1 -1
  8. package/esm/check/rules/api-snapshot.mjs +39 -0
  9. package/esm/check/rules/api-snapshot.mjs.map +1 -0
  10. package/esm/check/rules/code-rules.mjs +45 -0
  11. package/esm/check/rules/code-rules.mjs.map +1 -0
  12. package/esm/check/rules/drift.mjs +54 -0
  13. package/esm/check/rules/drift.mjs.map +1 -0
  14. package/esm/check/rules/focused-tests.mjs +39 -0
  15. package/esm/check/rules/focused-tests.mjs.map +1 -0
  16. package/esm/check/rules/shows.mjs +52 -0
  17. package/esm/check/rules/shows.mjs.map +1 -0
  18. package/esm/codes/codes.d.mts +48 -0
  19. package/esm/codes/codes.d.mts.map +1 -1
  20. package/esm/codes/codes.mjs +26 -1
  21. package/esm/codes/codes.mjs.map +1 -1
  22. package/esm/contracts/adapter.d.mts +6 -0
  23. package/esm/contracts/adapter.d.mts.map +1 -1
  24. package/esm/contracts/guard.d.mts +104 -0
  25. package/esm/contracts/guard.d.mts.map +1 -0
  26. package/esm/contracts/index.mjs +5 -0
  27. package/esm/contracts/matrix.d.mts +75 -0
  28. package/esm/contracts/matrix.d.mts.map +1 -0
  29. package/esm/contracts/scry.d.mts +21 -0
  30. package/esm/contracts/scry.d.mts.map +1 -1
  31. package/esm/contracts/settings.d.mts +71 -0
  32. package/esm/contracts/settings.d.mts.map +1 -0
  33. package/esm/contracts/settings.mjs +67 -0
  34. package/esm/contracts/settings.mjs.map +1 -0
  35. package/esm/contracts/shots.d.mts +146 -0
  36. package/esm/contracts/shots.d.mts.map +1 -0
  37. package/esm/contracts/snapshot.d.mts +10 -0
  38. package/esm/contracts/snapshot.d.mts.map +1 -1
  39. package/esm/contracts/written.d.mts +13 -0
  40. package/esm/contracts/written.d.mts.map +1 -1
  41. package/esm/contracts/written.mjs +7 -1
  42. package/esm/contracts/written.mjs.map +1 -1
  43. package/esm/devtools/approvals.mjs +59 -0
  44. package/esm/devtools/approvals.mjs.map +1 -0
  45. package/esm/devtools/data.mjs +2 -0
  46. package/esm/devtools/data.mjs.map +1 -1
  47. package/esm/devtools/graphs.mjs +13 -3
  48. package/esm/devtools/graphs.mjs.map +1 -1
  49. package/esm/devtools/index.d.mts.map +1 -1
  50. package/esm/devtools/index.mjs +32 -2
  51. package/esm/devtools/index.mjs.map +1 -1
  52. package/esm/devtools/matrix.mjs +207 -0
  53. package/esm/devtools/matrix.mjs.map +1 -0
  54. package/esm/devtools/product-map.d.mts.map +1 -1
  55. package/esm/devtools/product-map.mjs +87 -1
  56. package/esm/devtools/product-map.mjs.map +1 -1
  57. package/esm/devtools/site.d.mts.map +1 -1
  58. package/esm/devtools/site.mjs +12 -3
  59. package/esm/devtools/site.mjs.map +1 -1
  60. package/esm/devtools/snapshot-source.mjs +5 -1
  61. package/esm/devtools/snapshot-source.mjs.map +1 -1
  62. package/esm/git/index.d.mts +20 -0
  63. package/esm/git/index.d.mts.map +1 -0
  64. package/esm/git/index.mjs +280 -0
  65. package/esm/git/index.mjs.map +1 -0
  66. package/esm/guard/api.mjs +70 -0
  67. package/esm/guard/api.mjs.map +1 -0
  68. package/esm/guard/assertions.mjs +18 -0
  69. package/esm/guard/assertions.mjs.map +1 -0
  70. package/esm/guard/collect.mjs +139 -0
  71. package/esm/guard/collect.mjs.map +1 -0
  72. package/esm/guard/format.mjs +27 -0
  73. package/esm/guard/format.mjs.map +1 -0
  74. package/esm/guard/glob.mjs +79 -0
  75. package/esm/guard/glob.mjs.map +1 -0
  76. package/esm/guard/index.mjs +9 -0
  77. package/esm/guard/rules.mjs +310 -0
  78. package/esm/guard/rules.mjs.map +1 -0
  79. package/esm/guard/scope.mjs +95 -0
  80. package/esm/guard/scope.mjs.map +1 -0
  81. package/esm/index.d.mts +10 -3
  82. package/esm/index.mjs +6 -2
  83. package/esm/paths/index.d.mts +15 -1
  84. package/esm/paths/index.d.mts.map +1 -1
  85. package/esm/paths/index.mjs +27 -3
  86. package/esm/paths/index.mjs.map +1 -1
  87. package/esm/proves/index.mjs +2 -1
  88. package/esm/proves/scan-proofs.mjs +1 -1
  89. package/esm/proves/scan-proofs.mjs.map +1 -1
  90. package/esm/proves/scan-shows.d.mts +21 -0
  91. package/esm/proves/scan-shows.d.mts.map +1 -0
  92. package/esm/proves/scan-shows.mjs +168 -0
  93. package/esm/proves/scan-shows.mjs.map +1 -0
  94. package/esm/releases/index.d.mts.map +1 -1
  95. package/esm/releases/index.mjs +5 -3
  96. package/esm/releases/index.mjs.map +1 -1
  97. package/esm/releases/stamp.mjs +121 -0
  98. package/esm/releases/stamp.mjs.map +1 -0
  99. package/esm/rules/focused.mjs +26 -0
  100. package/esm/rules/focused.mjs.map +1 -0
  101. package/esm/rules/index.mjs +88 -0
  102. package/esm/rules/index.mjs.map +1 -0
  103. package/esm/rules/logical-css.mjs +112 -0
  104. package/esm/rules/logical-css.mjs.map +1 -0
  105. package/esm/rules/no-js-imports.mjs +22 -0
  106. package/esm/rules/no-js-imports.mjs.map +1 -0
  107. package/esm/rules/scan.mjs +196 -0
  108. package/esm/rules/scan.mjs.map +1 -0
  109. package/esm/rules/specific-errors.mjs +51 -0
  110. package/esm/rules/specific-errors.mjs.map +1 -0
  111. package/esm/rules/type-discriminator.mjs +27 -0
  112. package/esm/rules/type-discriminator.mjs.map +1 -0
  113. package/esm/scry/also-changes.mjs +106 -0
  114. package/esm/scry/also-changes.mjs.map +1 -0
  115. package/esm/scry/format.d.mts.map +1 -1
  116. package/esm/scry/format.mjs +22 -0
  117. package/esm/scry/format.mjs.map +1 -1
  118. package/esm/scry/query.d.mts.map +1 -1
  119. package/esm/scry/query.mjs +7 -2
  120. package/esm/scry/query.mjs.map +1 -1
  121. package/esm/scry/search.d.mts.map +1 -1
  122. package/esm/scry/search.mjs +43 -11
  123. package/esm/scry/search.mjs.map +1 -1
  124. package/esm/shots/approve.mjs +195 -0
  125. package/esm/shots/approve.mjs.map +1 -0
  126. package/esm/shots/drift.mjs +174 -0
  127. package/esm/shots/drift.mjs.map +1 -0
  128. package/esm/shots/png.mjs +166 -0
  129. package/esm/shots/png.mjs.map +1 -0
  130. package/esm/shots/state.mjs +43 -0
  131. package/esm/shots/state.mjs.map +1 -0
  132. package/esm/shots/store.mjs +66 -0
  133. package/esm/shots/store.mjs.map +1 -0
  134. package/esm/shots/touched.mjs +38 -0
  135. package/esm/shots/touched.mjs.map +1 -0
  136. package/esm/warlock/adapter.d.mts.map +1 -1
  137. package/esm/warlock/adapter.mjs +15 -2
  138. package/esm/warlock/adapter.mjs.map +1 -1
  139. package/esm/warlock/api-command.mjs +41 -0
  140. package/esm/warlock/api-command.mjs.map +1 -0
  141. package/esm/warlock/approve-command.mjs +80 -0
  142. package/esm/warlock/approve-command.mjs.map +1 -0
  143. package/esm/warlock/commands.d.mts +1 -1
  144. package/esm/warlock/commands.d.mts.map +1 -1
  145. package/esm/warlock/commands.mjs +61 -8
  146. package/esm/warlock/commands.mjs.map +1 -1
  147. package/esm/warlock/guard-command.mjs +116 -0
  148. package/esm/warlock/guard-command.mjs.map +1 -0
  149. package/esm/warlock/index.d.mts +2 -1
  150. package/esm/warlock/index.mjs +2 -1
  151. package/esm/warlock/languages.mjs +75 -0
  152. package/esm/warlock/languages.mjs.map +1 -0
  153. package/esm/warlock/mcp-tools.mjs +2 -2
  154. package/esm/warlock/mcp-tools.mjs.map +1 -1
  155. package/esm/warlock/release-command.mjs +65 -0
  156. package/esm/warlock/release-command.mjs.map +1 -0
  157. package/esm/warlock/shows.d.mts +35 -0
  158. package/esm/warlock/shows.d.mts.map +1 -0
  159. package/esm/warlock/shows.mjs +195 -0
  160. package/esm/warlock/shows.mjs.map +1 -0
  161. package/esm/workspace/cache.mjs +4 -1
  162. package/esm/workspace/cache.mjs.map +1 -1
  163. package/esm/workspace/derived.mjs +11 -6
  164. package/esm/workspace/derived.mjs.map +1 -1
  165. package/esm/workspace/index.d.mts.map +1 -1
  166. package/esm/workspace/index.mjs +8 -1
  167. package/esm/workspace/index.mjs.map +1 -1
  168. package/esm/workspace/stored.mjs +4 -1
  169. package/esm/workspace/stored.mjs.map +1 -1
  170. package/esm/written/features.mjs +21 -5
  171. package/esm/written/features.mjs.map +1 -1
  172. package/esm/written/index.mjs +2 -1
  173. package/esm/written/parse-grimoire.d.mts.map +1 -1
  174. package/esm/written/parse-grimoire.mjs +16 -3
  175. package/esm/written/parse-grimoire.mjs.map +1 -1
  176. package/esm/written/settings.d.mts +11 -0
  177. package/esm/written/settings.d.mts.map +1 -0
  178. package/esm/written/settings.mjs +88 -0
  179. package/esm/written/settings.mjs.map +1 -0
  180. package/llms-full.txt +276 -39
  181. package/llms.txt +2 -0
  182. package/package.json +3 -3
  183. package/skills/backfill-a-grimoire/SKILL.md +4 -0
  184. package/skills/describe-an-app/SKILL.md +4 -1
  185. package/skills/guard-a-change/SKILL.md +85 -0
  186. package/skills/index.md +7 -3
  187. package/skills/record-a-change/SKILL.md +52 -16
  188. package/skills/review-a-change/SKILL.md +53 -0
  189. package/skills/use-the-grimoire/SKILL.md +21 -18
  190. package/skills/write-a-feature/SKILL.md +42 -1
  191. package/ui/grimoire-view.js +756 -40
  192. package/ui/grimoire.css +303 -28
  193. package/ui/product-map.css +43 -7
  194. package/ui/product-map.js +212 -37
package/skills/index.md CHANGED
@@ -6,21 +6,25 @@ description: "Grimoire (experimental), the project map for Warlock.js apps: `war
6
6
 
7
7
  The Grimoire is experimental: its file structure and commands may still change.
8
8
 
9
- `grimoire/` is the map of a Warlock.js project. Warlock writes the **book** (one entry per source file, the routes, the pages and the mobile screens, in `grimoire/book/`, not in git). Agents write what the product does (`grimoire/features/`), where users meet it (`grimoire/apps/`), the work (`grimoire/tasks/`) and the releases (`grimoire/releases/`). Warlock never edits a file an agent wrote.
9
+ `grimoire/` is the map of a Warlock.js project. Warlock writes the **book** (one entry per source file, the routes, the pages and the mobile screens, in `grimoire/book/`, not in git). Agents write what the product does (`grimoire/features/`), where users meet it (`grimoire/apps/`), the work (`grimoire/tasks/`) and the releases (`grimoire/releases/`). Warlock never edits a file an agent wrote, apart from the changelog stamp you ask for with `warlock grimoire release --stamp`.
10
10
 
11
11
  ## The 80% path
12
12
 
13
13
  1. Before searching the code, ask the map: `use-the-grimoire.md`.
14
14
  2. A new behaviour starts as a task, a brief, a feature README and a flow, before code: `write-a-feature.md`.
15
- 3. After the change, tie tests to criteria, reshape the README, add the changelog entry, close the task, run the check, and at release time stamp the changelogs and write the brief: `record-a-change.md`.
15
+ 3. After the change, tie tests to criteria (`@proves`, and `@shows` for what the user sees), reshape the README, add the changelog entry, close the task, run the check, and at release time stamp the changelogs and write the brief: `record-a-change.md`.
16
16
  4. Pages, blocks, conditions and mobile screens: `describe-an-app.md`.
17
17
  5. The header and export comments the book copies from a file: `document-a-file.md`.
18
18
  6. A project with code but no `grimoire/` folder: `backfill-a-grimoire.md`.
19
+ 7. Keep a change inside its task (features, `Files:`, locked tests, protected areas) and run `warlock grimoire guard` before you stop: `guard-a-change.md`.
20
+ 8. Review a change from its task and its diff only, never from the author's summary: `review-a-change.md`.
19
21
 
20
22
  ## Conventions and pitfalls
21
23
 
22
24
  - Never edit `grimoire/book/`, `index.json`, `bookmap.json` or `*.bookmap.json`.
23
- - You write release numbers and dates into changelogs and the release brief; `warlock grimoire release` only writes the collected list.
25
+ - `warlock grimoire release <version> --stamp` moves every `## Unreleased` entry under the release and writes a missing release file; without `--stamp` it only writes the collected list.
26
+ - Every project has a design-system feature first (`grimoire/features/design-system/`); flows with a page step name it in `affects`.
27
+ - Only the owner approves a changed screenshot or a removed criterion (`warlock grimoire approve`); list every change that is not approved in your report.
24
28
  - A finding marked `(expected)` belongs to `proposed` work and does not fail `warlock grimoire check`.
25
29
  - Mobile screens are listed from file names only with file-based routing; declare them when navigation is in code.
26
30
  - Do not invent intent: write `Unknown:` and ask the owner.
@@ -20,6 +20,26 @@ it("returns the global list when the customer has no country", async () => {
20
20
  });
21
21
  ```
22
22
 
23
+ A criterion about what a user sees is shown instead, by a browser scene in `e2e/*.e2e.ts`. Put the
24
+ comment directly above a `shows()` call that repeats the same criterion:
25
+
26
+ ```ts
27
+ import { shows } from "@warlock.js/grimoire/warlock";
28
+
29
+ // @shows contact/send-message AC-3
30
+ await shows(context, "contact/send-message AC-3", async ({ page, language, path }) => {
31
+ await page.mockRequests([{ url: "/api/contact", fail: "unreachable" }]);
32
+ await page.goto(path("/"));
33
+ });
34
+ ```
35
+
36
+ `shows()` runs the scene once per language and saves a screenshot each (`GRIMOIRE_SHOTS=all`
37
+ captures every flow, not only the touched ones). A scene that throws fails that language. The owner
38
+ approves the images with `warlock grimoire approve`; list every `GR4017` (image changed), `GR4018`
39
+ (flow, criterion, case or proof changed) and `GR4019` (rejected change still there) of the check in
40
+ your report, and never edit `grimoire/approved/` yourself. From code, `scanShows` reads the `@shows`
41
+ lines of the test files and `resolveSettings` fills the defaults of `grimoire/settings.md`.
42
+
23
43
  - End-to-end tests prove a flow's steps. Unit tests prove a business rule ("a reset code expires
24
44
  after 10 minutes").
25
45
  - One test may prove one criterion. If it needs two tags, split the test.
@@ -68,6 +88,8 @@ Add two lines: how it was verified (which tests, which criteria) and anything le
68
88
  something is left open, open a new task for it; do not leave it only in the done file. A task
69
89
  that needs the owner's answer gets `status: waiting for approval` and a `Decision needed:` line.
70
90
 
91
+ Name the task id (`T-12`) in every commit message of the change; `warlock grimoire guard --commits <range>` fails a commit that names none.
92
+
71
93
  ## 5. Check
72
94
 
73
95
  ```bash
@@ -94,16 +116,30 @@ folder is not committed, so run the tests with the reporter in CI and ship the r
94
116
  deploy. To write it elsewhere, pass `grimoireReporter({ file })` and point the devtools panel at it
95
117
  with the `testResultsFile` option.
96
118
 
119
+ Then check the change against its task, before you stop:
120
+
121
+ ```bash
122
+ npx warlock grimoire guard T-12
123
+ ```
124
+
125
+ It lists files outside the task, deleted proving tests, removed criteria or cases, edited locked tests, protected areas the task does not name, and the code rules on the lines you added. Fix the code rather than widening the task; add a `Files:`, `Touches:` or `Removes:` line only when the owner agreed (`guard-a-change`).
126
+
97
127
  Fix every line it prints. Do not finish with problems you caused. Findings on a flow or feature
98
128
  with `status: proposed` print with `(expected)` and do not fail the check: leave them until the
99
129
  code exists.
100
130
 
101
131
  ## 6. At release time
102
132
 
103
- Warlock does not edit your files at release. You do three things, in this order:
133
+ Run the stamp from the app's release flow, after the version is set in `package.json`:
134
+
135
+ ```bash
136
+ npx warlock grimoire release --stamp
137
+ ```
138
+
139
+ It does three things, in this order, and prints what it did (`stamped catalog, orders → 1.4.1 (2026-11-20)`):
104
140
 
105
- 1. **Stamp the changelogs.** In each feature that changed, move the `## Unreleased` entries under a
106
- heading with the release number and date:
141
+ 1. **Stamps the changelogs.** In each feature that has entries under `## Unreleased`, it moves them under a
142
+ heading with the release number and date, and leaves an empty `## Unreleased` above:
107
143
 
108
144
  ```md
109
145
  ## Unreleased
@@ -114,7 +150,9 @@ Warlock does not edit your files at release. You do three things, in this order:
114
150
  instead of the global one (AC-2)
115
151
  ```
116
152
 
117
- 2. **Write the release brief.** Create `grimoire/releases/1.4.1.md`:
153
+ 2. **Writes the release file** `grimoire/releases/1.4.1.md` when it is missing, with its front matter, a
154
+ `# Release 1.4.1` heading and a one-line brief that names the changed features. An existing release file is kept.
155
+ **Rewrite the brief in the owner's words**: two or three sentences on what the release means to users.
118
156
 
119
157
  ```md
120
158
  ---
@@ -127,18 +165,14 @@ Warlock does not edit your files at release. You do three things, in this order:
127
165
  Customers with no country on their account see new arrivals again.
128
166
  ```
129
167
 
130
- Two or three sentences on what the release means to users.
131
-
132
- 3. **Collect the list.**
133
-
134
- ```bash
135
- npx warlock grimoire release 1.4.1
136
- ```
168
+ 3. **Collects the list** between the markers under your brief. Run `npx warlock grimoire release 1.4.1` again after
169
+ any change to a changelog or the brief: the result is the same every time. It also says how many entries are
170
+ still unreleased. Do not write that list yourself.
137
171
 
138
- It writes the entries you stamped with that release between the markers under your brief, and
139
- changes nothing else. It also says how many entries are still unreleased. Do not write that list
140
- yourself, and run the command again after any change to a changelog: the result is the same
141
- every time.
172
+ The version is the app's `package.json` version unless you pass one (`release 1.4.1 --stamp`); the date is today unless
173
+ the release file has one or you pass `--date yyyy-mm-dd`. The stamp is the only edit Warlock makes to your files, and
174
+ only with `--stamp`. Without it you move the entries and write the release file by hand, as above, and run
175
+ `npx warlock grimoire release 1.4.1`.
142
176
 
143
177
  `npx warlock grimoire check` reports a listed entry that has no changelog entry stamped with that
144
178
  release and date, and a release section with no release file.
@@ -146,4 +180,6 @@ release and date, and a release section with no release file.
146
180
  ## Report to the owner
147
181
 
148
182
  Say what changed in plain words, the feature version, which criteria are proven, what the check
149
- reported, and what is left open with its task id.
183
+ reported, and what is left open with its task id. Paste the result of `npx warlock grimoire guard`,
184
+ and list every change that is not approved (`warlock grimoire check` `GR4017`, `GR4018`, `GR4019`) by
185
+ its id; leave none out.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: review-a-change
3
+ description: "Review a change as an independent reviewer who sees only the task and the diff, never the author's summary, and answers one question: list every change the task did not ask for. Use when asked to review work an agent or a colleague finished, before a merge."
4
+ ---
5
+
6
+ # Review a change
7
+
8
+ The Grimoire is experimental: its file structure and commands may still change.
9
+
10
+ The reviewer is independent. It reads two things only: the task file and the diff. It does not read the author's summary, the commit messages' explanations or the author's report; they describe what the author meant, not what changed.
11
+
12
+ ## Input
13
+
14
+ 1. The task file (`grimoire/tasks/open/T-12-….md` or `grimoire/tasks/done/…`), including its `Files:`, `Features:`, `Locked:`, `Touches:` and `Removes:` lines.
15
+ 2. The diff: `git diff <base>...HEAD`, where `<base>` is the branch the change merges into (`origin/main`).
16
+
17
+ ## The question
18
+
19
+ Ask exactly this, and answer it before anything else:
20
+
21
+ > List every change the task did not ask for.
22
+
23
+ Go file by file through the diff. For each hunk say which sentence or acceptance criterion of the task asks for it. A hunk no sentence asks for goes on the list: an unasked file, a removed or reworded criterion, a deleted or weakened test, a renamed export, a changed dependency, a new behaviour, a refactor. "Harmless" and "an improvement" are not reasons to leave it out.
24
+
25
+ ## Then
26
+
27
+ 1. Run the guard and paste its output:
28
+
29
+ ```bash
30
+ npx warlock grimoire guard <task> --base <base>
31
+ ```
32
+
33
+ 2. List every drift item that is not approved, by id, from `npx warlock grimoire check` (`GR4017` capture differs, `GR4018` structure changed, `GR4019` rejected change still there). Leave none out and do not approve any: only the owner approves.
34
+ 3. Say whether the change is ready: yes only when the list of unasked changes is empty (or each item is named in the task and approved by the owner), the guard prints `guard: ok`, and no drift item is open.
35
+
36
+ ## Report shape
37
+
38
+ ```md
39
+ Unasked changes
40
+
41
+ - <file>: <what changed>, no sentence of the task asks for it
42
+
43
+ Guard
44
+ <the pasted output>
45
+
46
+ Not approved
47
+
48
+ - <drift item id>
49
+
50
+ Verdict: ready | not ready, because …
51
+ ```
52
+
53
+ An empty "Unasked changes" section says "none" and the reviewer says which files it read.
@@ -26,9 +26,7 @@ edits a file you wrote either.
26
26
 
27
27
  ## Start of every task
28
28
 
29
- 1. Find the feature and flow the task is about.
30
-
31
- Pass the whole task sentence (the commit title or the bug report), not two keywords:
29
+ 1. `scry --search "<the whole request>"`: pass the whole task sentence (the commit title or the bug report), not two keywords.
32
30
 
33
31
  ```bash
34
32
  npx warlock scry --search "new arrivals are empty for customers with no country"
@@ -36,22 +34,27 @@ edits a file you wrote either.
36
34
 
37
35
  ```text
38
36
  21.4 flow catalog/new-arrivals New arrivals
39
- 12.9 block web-client/home/new-arrivals catalog/new-arrivals
40
- 11.3 route GET /api/products/new-arrivals catalog.new-arrivals
41
37
  9.8 file src/app/catalog/services/new-arrivals.service.ts Lists the newest products sold in the customer's country.
38
+ changes with the top hits:
39
+ src/app/catalog/repositories/products.repository.ts imported by new-arrivals.service.ts
40
+ src/app/catalog/tests/new-arrivals.test.ts test
41
+ next: warlock scry --impact src/app/catalog/services/new-arrivals.service.ts
42
42
  ```
43
43
 
44
- The number in front is the score: hits are in score order, best first, whatever their type.
44
+ The number in front is the score: hits are in score order, best first, whatever the type.
45
45
 
46
- 2. Read the feature's `README.md`, then the flow file. They say what the behaviour should be.
47
- 3. Ask for the flow's book map. It lists the files behind each step, the tests that prove each
46
+ 2. `scry --impact <top file>` (the `next:` line) and read the `changes with` lines: they are the files that usually change
47
+ with it (what it imports and what imports it inside the same feature, and its tests).
48
+ 3. Use grep only for literal text, or when the answer says `weak match`.
49
+ 4. Read the feature's `README.md`, then the flow file. They say what the behaviour should be.
50
+ 5. Ask for the flow's book map. It lists the files behind each step, the tests that prove each
48
51
  criterion and the pages that show the flow.
49
52
 
50
53
  ```bash
51
54
  npx warlock scry --flow catalog/new-arrivals
52
55
  ```
53
56
 
54
- 4. Read only those files. Do not read a whole module to find one function.
57
+ 6. Read only those files. Do not read a whole module to find one function.
55
58
 
56
59
  ## Questions the book answers
57
60
 
@@ -74,7 +77,7 @@ build, then ask again. A project with no book stops with `GR9007`. A note
74
77
 
75
78
  Add `--json` for machine-readable output; a failed call then prints `{ "type": "error", "code", "message", "fix" }` on stdout and exits 1 (the scry MCP tools return the same JSON as their error text). `--impact` lists API routes, pages, flows and features,
76
79
  including features that only borrow the file; each list has a count and stops at 20 lines, and `--all`
77
- prints every line. `--search` takes the whole sentence (the commit title or the bug report, not two keywords): hits whose name or title holds the words come first, every other hit follows by score, and the list is printed in score order with the score in front. It also reads a flow's summary, story, cases and criteria (`AC-5` works); a hit found by written text shows the part that matched in brackets. Page, screen, block and file hits carry their app, and `--app <id>` keeps one app's hits. Read the flows it names and run their tests after
80
+ prints every line. `--search` takes the whole sentence (the commit title or the bug report, not two keywords): hits whose name or title holds the words come first, every other hit follows by score, and the list is printed in score order with the score in front. It also reads a flow's summary, story, cases and criteria (`AC-5` works); a hit found by written text shows the part that matched in brackets. Page, screen, block and file hits carry their app, and `--app <id>` keeps one app's hits. Specs, locale files and type files rank below code of an equal match. Search reads Arabic and accented Latin text too: accents, Arabic vowel marks, hamza forms and the leading article `ال` do not matter (`شحنة` finds `الشحنة`, `cafe` finds `café`). The answer's `alsoChanges` list (`changes with the top hits:`, at most 10 files) and `next` line come from the top three hits; `weak: true` (the line `weak match: …`) says no hit holds most of the request's words. Read the flows it names and run their tests after
78
81
  your change.
79
82
 
80
83
  A file's entry is also at a fixed path: `src/app/auth/controllers/login.controller.ts` is described
@@ -82,14 +85,14 @@ in `grimoire/book/app/auth/controllers/login.controller.json`.
82
85
 
83
86
  ## Commands
84
87
 
85
- | Command | Does |
86
- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
87
- | `warlock grimoire build` | Builds or refreshes the book (and its derived data). Run it after you finish editing; `scry` only reads and never builds |
88
- | `warlock grimoire build --site [--out dir]` | Also writes the book as a static site (default `grimoire/book/site`); skipped when the folder is already current (`--force` writes it) |
89
- | `warlock grimoire build --site --product` | Writes the business export: the Product map only, no file paths, test names or per-file answers |
90
- | `warlock grimoire check` | Reports broken names, untested criteria, files with no owner. Exit 1 on an error; `--all` lists every warning |
91
- | `warlock grimoire release <release>` | Writes the collected list into `grimoire/releases/<release>.md` |
92
- | `warlock explain GR2001` | Explains a finding code |
88
+ | Command | Does |
89
+ | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
90
+ | `warlock grimoire build` | Builds or refreshes the book (and its derived data). Run it after you finish editing; `scry` only reads and never builds |
91
+ | `warlock grimoire build --site [--out dir]` | Also writes the book as a static site (default `grimoire/book/site`); skipped when the folder is already current (`--force` writes it) |
92
+ | `warlock grimoire build --site --product` | Writes the business export: the Product map only, no file paths, test names or per-file answers |
93
+ | `warlock grimoire check` | Reports broken names, untested criteria, files with no owner. Exit 1 on an error; `--all` lists every warning |
94
+ | `warlock grimoire release <release>` | Writes the collected list into `grimoire/releases/<release>.md`; with `--stamp` it first moves `## Unreleased` entries under the version |
95
+ | `warlock explain GR2001` | Explains a finding code |
93
96
 
94
97
  Every finding has a code (`GR2001`) and a fix hint. A finding marked `(expected)` belongs to work
95
98
  that is still `proposed`; it does not fail the check.
@@ -42,6 +42,24 @@ status: waiting for approval
42
42
  - Decision needed: one wishlist per customer, or several named lists?
43
43
  ```
44
44
 
45
+ The guard (`warlock grimoire guard`, see `guard-a-change`) reads these optional body lines, comma-separated:
46
+
47
+ ```md
48
+ - Files: src/app/shared/utils/money.ts, src/config/catalog.ts
49
+ - Features: orders, catalog/wishlist
50
+ - Locked: src/app/catalog/tests/wishlist.test.ts
51
+ - Touches: migrations, dependencies
52
+ - Removes: catalog/wishlist AC-3, catalog/wishlist case duplicate
53
+ ```
54
+
55
+ - `Files:` lists files (globs allowed) outside the task's feature that the change must touch.
56
+ - `Features:` names more features (`orders`) or flows (`catalog/wishlist`) the change may touch.
57
+ - `Locked:` names the acceptance tests the planner wrote first. Whoever builds the task never edits them.
58
+ - `Touches:` names the protected areas the task may change: `migrations`, `auth`, `config`, `lockfile`, `dependencies`, `public-api`, or an area of `grimoire/settings.md`.
59
+ - `Removes:` names the flow, criterion or case that is allowed to go (`<feature>/<flow>`, `<feature>/<flow> AC-3`, `<feature>/<flow> case duplicate`).
60
+
61
+ Write the acceptance tests first, with their `@proves` lines, and list them in `Locked:` before handing the task to an implementer. The task's `feature` and `flow` already put that feature's files and the flow's files in scope; add `Files:` for the rest at the start, not after the guard fails.
62
+
45
63
  A task that waits for the owner's answer has `status: waiting for approval` and a `Decision needed:` line.
46
64
  The other statuses are `open`, `approved`, `in progress`, `blocked`, `done` and `dropped`; any other
47
65
  word is an error (`GR1004`).
@@ -51,6 +69,16 @@ word is an error (`GR1004`).
51
69
  `grimoire/features/catalog/versions/v3.md`: why, what changes (which flows are new or changed),
52
70
  and what is out of scope. Keep it to one screen.
53
71
 
72
+ ## Write `design-system` first
73
+
74
+ In a project that has a UI, create the `design-system` feature before any other. Its flows are the
75
+ rules every screen follows: `direction` (inputs and text follow the reading direction, a page is
76
+ mirrored in Arabic), `components` (every component renders in each language), `error-messages`
77
+ (every error says what failed and what to do next), plus spacing and colours (contrast) when the
78
+ project has rules for them. Every flow with a `page` step names `design-system` under
79
+ `## Affects and affected by` (`- affects design-system`), so a change to a screen is checked against it.
80
+ Its criteria are shown with `@shows` scenes (`record-a-change`).
81
+
54
82
  ## 3. Write or update the feature README
55
83
 
56
84
  ```md
@@ -138,6 +166,8 @@ A customer saves a product they like and finds it again later on their wishlist.
138
166
  - expiry does not apply: saved products do not expire
139
167
  - double submit two taps save once
140
168
  - outside service down does not apply: no outside service is called
169
+ - server unreachable the save button shows "Could not reach the server, check your connection" (AC-5)
170
+ - server error the product stays unsaved and the message says what failed (AC-5)
141
171
 
142
172
  ## Acceptance criteria
143
173
 
@@ -145,6 +175,7 @@ A customer saves a product they like and finds it again later on their wishlist.
145
175
  - AC-2 saving twice keeps one entry
146
176
  - AC-3 a guest is sent to sign in and returns to the product
147
177
  - AC-4 [mobile] the product card has a save button
178
+ - AC-5 a failed save says what failed and what to do next
148
179
  ```
149
180
 
150
181
  **Summary.** The paragraph under the `# Title`: one or two plain sentences saying who does what and
@@ -174,10 +205,20 @@ When two sites, or a site and the mobile app, have a page with the same path, na
174
205
  the path in brackets: `page /support [web-admin]`. The step then looks in that app only (its
175
206
  pages, or its screens for a mobile app). Without brackets it looks in the apps the feature lists.
176
207
 
208
+ **Screenshots of a flow.** Criteria about what a user sees are shown in each language of the app
209
+ (`languages` in `grimoire/settings.md`), so one criterion gives one screenshot per language. Write a
210
+ criterion once; do not write one per language. A flow with nothing to look at (no screen, or a
211
+ screen that cannot be captured) says `screenshots: false` in its front matter. `screenshots` is
212
+ `false` or absent; the modes `changed`, `all` and `off` live in the settings
213
+ (`SCREENSHOT_MODES`, default `DEFAULT_GRIMOIRE_SETTINGS.screenshots`, `changed`).
214
+
177
215
  **Cases.** End a case line with `(AC-n)` (or `(AC-1, AC-2)`) to link it to the criterion that
178
216
  proves it; a number the flow does not have is an error (`GR2013`). Answer all eight questions (invalid input, not allowed, not found, duplicate, limits,
179
217
  expiry, double submit, outside service down), each with a case or "does not apply" and the
180
- reason. A flow that skips one gets a finding, except that a flow with no writes (only pages and
218
+ reason. A flow with a `page` step also answers the two UI questions (`UI_CASE_QUESTIONS`):
219
+ `server unreachable` (what the user sees when the request never arrives) and `server error`
220
+ (when the server answers with a failure); the screen of each is shown with a scene that mocks
221
+ the request. A flow that skips one gets a finding, except that a flow with no writes (only pages and
181
222
  `GET` routes) may leave out `duplicate` and `double submit`. Do not invent cases beyond the questions unless the owner described one.
182
223
 
183
224
  **Criteria.** One per case that changes what the user gets. Number them `AC-1`, `AC-2`, … and