@warlock.js/grimoire 0.0.0-stage → 5.56.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 (211) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/LICENSE +21 -0
  3. package/README.md +55 -2
  4. package/esm/apps/check-apps.mjs +207 -0
  5. package/esm/apps/check-apps.mjs.map +1 -0
  6. package/esm/apps/index.mjs +4 -0
  7. package/esm/apps/match-apps.d.mts +12 -0
  8. package/esm/apps/match-apps.d.mts.map +1 -0
  9. package/esm/apps/match-apps.mjs +30 -0
  10. package/esm/apps/match-apps.mjs.map +1 -0
  11. package/esm/book/build.d.mts +14 -0
  12. package/esm/book/build.d.mts.map +1 -0
  13. package/esm/book/build.mjs +300 -0
  14. package/esm/book/build.mjs.map +1 -0
  15. package/esm/book/index.mjs +5 -0
  16. package/esm/book/io.mjs +162 -0
  17. package/esm/book/io.mjs.map +1 -0
  18. package/esm/book/normalize.mjs +71 -0
  19. package/esm/book/normalize.mjs.map +1 -0
  20. package/esm/book/render.mjs +262 -0
  21. package/esm/book/render.mjs.map +1 -0
  22. package/esm/book/write.d.mts +12 -0
  23. package/esm/book/write.d.mts.map +1 -0
  24. package/esm/book/write.mjs +90 -0
  25. package/esm/book/write.mjs.map +1 -0
  26. package/esm/bookmap/build.d.mts +21 -0
  27. package/esm/bookmap/build.d.mts.map +1 -0
  28. package/esm/bookmap/build.mjs +272 -0
  29. package/esm/bookmap/build.mjs.map +1 -0
  30. package/esm/bookmap/index.mjs +5 -0
  31. package/esm/bookmap/steps.mjs +137 -0
  32. package/esm/bookmap/steps.mjs.map +1 -0
  33. package/esm/bookmap/write.d.mts +19 -0
  34. package/esm/bookmap/write.d.mts.map +1 -0
  35. package/esm/bookmap/write.mjs +118 -0
  36. package/esm/bookmap/write.mjs.map +1 -0
  37. package/esm/check/check-grimoire.d.mts +7 -0
  38. package/esm/check/check-grimoire.d.mts.map +1 -0
  39. package/esm/check/check-grimoire.mjs +98 -0
  40. package/esm/check/check-grimoire.mjs.map +1 -0
  41. package/esm/check/format-check-report.d.mts +20 -0
  42. package/esm/check/format-check-report.d.mts.map +1 -0
  43. package/esm/check/format-check-report.mjs +55 -0
  44. package/esm/check/format-check-report.mjs.map +1 -0
  45. package/esm/check/index.mjs +4 -0
  46. package/esm/check/rules/book-notes.mjs +18 -0
  47. package/esm/check/rules/book-notes.mjs.map +1 -0
  48. package/esm/check/rules/criteria.mjs +48 -0
  49. package/esm/check/rules/criteria.mjs.map +1 -0
  50. package/esm/check/rules/links.mjs +196 -0
  51. package/esm/check/rules/links.mjs.map +1 -0
  52. package/esm/check/rules/lookup.mjs +41 -0
  53. package/esm/check/rules/lookup.mjs.map +1 -0
  54. package/esm/check/rules/source-files.mjs +119 -0
  55. package/esm/check/rules/source-files.mjs.map +1 -0
  56. package/esm/check/rules/versions.mjs +92 -0
  57. package/esm/check/rules/versions.mjs.map +1 -0
  58. package/esm/codes/codes.d.mts +182 -0
  59. package/esm/codes/codes.d.mts.map +1 -0
  60. package/esm/codes/codes.mjs +111 -0
  61. package/esm/codes/codes.mjs.map +1 -0
  62. package/esm/codes/index.d.mts +33 -0
  63. package/esm/codes/index.d.mts.map +1 -0
  64. package/esm/codes/index.mjs +63 -0
  65. package/esm/codes/index.mjs.map +1 -0
  66. package/esm/contracts/adapter.d.mts +209 -0
  67. package/esm/contracts/adapter.d.mts.map +1 -0
  68. package/esm/contracts/book.d.mts +233 -0
  69. package/esm/contracts/book.d.mts.map +1 -0
  70. package/esm/contracts/book.mjs +7 -0
  71. package/esm/contracts/book.mjs.map +1 -0
  72. package/esm/contracts/bookmap.d.mts +175 -0
  73. package/esm/contracts/bookmap.d.mts.map +1 -0
  74. package/esm/contracts/findings.d.mts +79 -0
  75. package/esm/contracts/findings.d.mts.map +1 -0
  76. package/esm/contracts/location.d.mts +22 -0
  77. package/esm/contracts/location.d.mts.map +1 -0
  78. package/esm/contracts/releases.d.mts +53 -0
  79. package/esm/contracts/releases.d.mts.map +1 -0
  80. package/esm/contracts/scry.d.mts +143 -0
  81. package/esm/contracts/scry.d.mts.map +1 -0
  82. package/esm/contracts/snapshot.d.mts +52 -0
  83. package/esm/contracts/snapshot.d.mts.map +1 -0
  84. package/esm/contracts/test-results.d.mts +63 -0
  85. package/esm/contracts/test-results.d.mts.map +1 -0
  86. package/esm/contracts/written.d.mts +363 -0
  87. package/esm/contracts/written.d.mts.map +1 -0
  88. package/esm/contracts/written.mjs +19 -0
  89. package/esm/contracts/written.mjs.map +1 -0
  90. package/esm/devtools/data.mjs +171 -0
  91. package/esm/devtools/data.mjs.map +1 -0
  92. package/esm/devtools/graphs.mjs +142 -0
  93. package/esm/devtools/graphs.mjs.map +1 -0
  94. package/esm/devtools/index.d.mts +42 -0
  95. package/esm/devtools/index.d.mts.map +1 -0
  96. package/esm/devtools/index.mjs +103 -0
  97. package/esm/devtools/index.mjs.map +1 -0
  98. package/esm/devtools/site.d.mts +26 -0
  99. package/esm/devtools/site.d.mts.map +1 -0
  100. package/esm/devtools/site.mjs +190 -0
  101. package/esm/devtools/site.mjs.map +1 -0
  102. package/esm/devtools/snapshot-source.mjs +70 -0
  103. package/esm/devtools/snapshot-source.mjs.map +1 -0
  104. package/esm/front-matter/index.d.mts +33 -0
  105. package/esm/front-matter/index.d.mts.map +1 -0
  106. package/esm/front-matter/index.mjs +130 -0
  107. package/esm/front-matter/index.mjs.map +1 -0
  108. package/esm/graph/index.d.mts +15 -0
  109. package/esm/graph/index.d.mts.map +1 -0
  110. package/esm/graph/index.mjs +42 -0
  111. package/esm/graph/index.mjs.map +1 -0
  112. package/esm/index.d.mts +33 -0
  113. package/esm/index.mjs +33 -0
  114. package/esm/ownership/index.d.mts +8 -0
  115. package/esm/ownership/index.d.mts.map +1 -0
  116. package/esm/ownership/index.mjs +137 -0
  117. package/esm/ownership/index.mjs.map +1 -0
  118. package/esm/paths/index.d.mts +58 -0
  119. package/esm/paths/index.d.mts.map +1 -0
  120. package/esm/paths/index.mjs +137 -0
  121. package/esm/paths/index.mjs.map +1 -0
  122. package/esm/proves/index.mjs +3 -0
  123. package/esm/proves/scan-proofs.d.mts +22 -0
  124. package/esm/proves/scan-proofs.d.mts.map +1 -0
  125. package/esm/proves/scan-proofs.mjs +214 -0
  126. package/esm/proves/scan-proofs.mjs.map +1 -0
  127. package/esm/releases/index.d.mts +29 -0
  128. package/esm/releases/index.d.mts.map +1 -0
  129. package/esm/releases/index.mjs +157 -0
  130. package/esm/releases/index.mjs.map +1 -0
  131. package/esm/scry/format.d.mts +14 -0
  132. package/esm/scry/format.d.mts.map +1 -0
  133. package/esm/scry/format.mjs +193 -0
  134. package/esm/scry/format.mjs.map +1 -0
  135. package/esm/scry/index.mjs +5 -0
  136. package/esm/scry/parse.d.mts +10 -0
  137. package/esm/scry/parse.d.mts.map +1 -0
  138. package/esm/scry/parse.mjs +108 -0
  139. package/esm/scry/parse.mjs.map +1 -0
  140. package/esm/scry/query.d.mts +11 -0
  141. package/esm/scry/query.d.mts.map +1 -0
  142. package/esm/scry/query.mjs +457 -0
  143. package/esm/scry/query.mjs.map +1 -0
  144. package/esm/tasks/index.mjs +116 -0
  145. package/esm/tasks/index.mjs.map +1 -0
  146. package/esm/test-results/criterion-status.d.mts +15 -0
  147. package/esm/test-results/criterion-status.d.mts.map +1 -0
  148. package/esm/test-results/criterion-status.mjs +17 -0
  149. package/esm/test-results/criterion-status.mjs.map +1 -0
  150. package/esm/test-results/index.d.mts +8 -0
  151. package/esm/test-results/index.d.mts.map +1 -0
  152. package/esm/test-results/index.mjs +124 -0
  153. package/esm/test-results/index.mjs.map +1 -0
  154. package/esm/vitest/index.d.mts +15 -0
  155. package/esm/vitest/index.d.mts.map +1 -0
  156. package/esm/vitest/index.mjs +146 -0
  157. package/esm/vitest/index.mjs.map +1 -0
  158. package/esm/warlock/actions.mjs +265 -0
  159. package/esm/warlock/actions.mjs.map +1 -0
  160. package/esm/warlock/adapter.d.mts +28 -0
  161. package/esm/warlock/adapter.d.mts.map +1 -0
  162. package/esm/warlock/adapter.mjs +377 -0
  163. package/esm/warlock/adapter.mjs.map +1 -0
  164. package/esm/warlock/commands.d.mts +15 -0
  165. package/esm/warlock/commands.d.mts.map +1 -0
  166. package/esm/warlock/commands.mjs +199 -0
  167. package/esm/warlock/commands.mjs.map +1 -0
  168. package/esm/warlock/index.d.mts +4 -0
  169. package/esm/warlock/index.mjs +5 -0
  170. package/esm/warlock/mcp-tools.mjs +247 -0
  171. package/esm/warlock/mcp-tools.mjs.map +1 -0
  172. package/esm/warlock/mobile-facts.d.mts +32 -0
  173. package/esm/warlock/mobile-facts.d.mts.map +1 -0
  174. package/esm/warlock/mobile-facts.mjs +185 -0
  175. package/esm/warlock/mobile-facts.mjs.map +1 -0
  176. package/esm/workspace/index.d.mts +11 -0
  177. package/esm/workspace/index.d.mts.map +1 -0
  178. package/esm/workspace/index.mjs +122 -0
  179. package/esm/workspace/index.mjs.map +1 -0
  180. package/esm/written/apps.mjs +227 -0
  181. package/esm/written/apps.mjs.map +1 -0
  182. package/esm/written/features.mjs +400 -0
  183. package/esm/written/features.mjs.map +1 -0
  184. package/esm/written/fields.mjs +173 -0
  185. package/esm/written/fields.mjs.map +1 -0
  186. package/esm/written/index.mjs +3 -0
  187. package/esm/written/lists.mjs +68 -0
  188. package/esm/written/lists.mjs.map +1 -0
  189. package/esm/written/markdown.mjs +173 -0
  190. package/esm/written/markdown.mjs.map +1 -0
  191. package/esm/written/parse-grimoire.d.mts +20 -0
  192. package/esm/written/parse-grimoire.d.mts.map +1 -0
  193. package/esm/written/parse-grimoire.mjs +552 -0
  194. package/esm/written/parse-grimoire.mjs.map +1 -0
  195. package/esm/written/sink.mjs +65 -0
  196. package/esm/written/sink.mjs.map +1 -0
  197. package/esm/written/tasks-releases.mjs +166 -0
  198. package/esm/written/tasks-releases.mjs.map +1 -0
  199. package/llms-full.txt +869 -0
  200. package/llms.txt +15 -0
  201. package/package.json +66 -4
  202. package/skills/backfill-a-grimoire/SKILL.md +128 -0
  203. package/skills/describe-an-app/SKILL.md +162 -0
  204. package/skills/document-a-file/SKILL.md +75 -0
  205. package/skills/index.md +26 -0
  206. package/skills/record-a-change/SKILL.md +139 -0
  207. package/skills/use-the-grimoire/SKILL.md +137 -0
  208. package/skills/write-a-feature/SKILL.md +168 -0
  209. package/ui/grimoire-static.js +136 -0
  210. package/ui/grimoire-view.js +1005 -0
  211. package/ui/grimoire.css +88 -0
package/llms.txt ADDED
@@ -0,0 +1,15 @@
1
+ # Warlock Grimoire
2
+
3
+ > Package: `@warlock.js/grimoire`
4
+
5
+ > Experimental project map for Warlock.js apps: a generated book of the code, agent-written features, flows, apps, tasks and releases, a read-only check, and scry queries for agents.
6
+
7
+ ## Skills
8
+
9
+ - [Package orientation](@warlock.js/grimoire/skills/index.md): Grimoire (experimental), the project map for Warlock.js apps: `warlock scry` and `warlock grimoire build|check|release` over a `grimoire/` folder of generated book entries and agent-written features, flows, apps, tasks and releases. Topics: use the map before searching code, write a feature, record a change and release, describe sites and mobile screens, document a file, backfill an existing app. Use at the start of every task in a project that has `grimoire/`.
10
+ - [backfill-a-grimoire](@warlock.js/grimoire/skills/backfill-a-grimoire/SKILL.md): Write the Grimoire for a project that already has code but no `grimoire/` folder: build the book, propose features from the modules and routes, write them as inferred, and bring the owner the questions only they can answer. Use once per existing project, or when a large undescribed area is found.
11
+ - [describe-an-app](@warlock.js/grimoire/skills/describe-an-app/SKILL.md): Describe where users meet the product in `grimoire/apps/`: one folder per site or mobile app, its named conditions (guest, customer, membership, preferences), shared layouts, and the pages or screens whose blocks point to feature flows. Use when adding a page, a screen or a block, or when what a page shows depends on who is looking.
12
+ - [document-a-file](@warlock.js/grimoire/skills/document-a-file/SKILL.md): Write the one-sentence header and the public-export comments the Grimoire copies into its book, and tag a file with `@feature` when it lives outside its feature's folders. Use whenever you create a source file or change what one is for.
13
+ - [record-a-change](@warlock.js/grimoire/skills/record-a-change/SKILL.md): Finish a change the Grimoire way: tie each test to the acceptance criterion it proves, reshape the feature README, add the changelog entry with the right version, move the task to done, run `warlock grimoire check`, and write the release brief. Use after building any change, including a bug fix.
14
+ - [use-the-grimoire](@warlock.js/grimoire/skills/use-the-grimoire/SKILL.md): Find the right files before changing a Warlock.js project by asking the Grimoire (experimental): `warlock scry` for a file, a route, a feature, a flow or the impact of a change, and the `grimoire/` folder for what the product does. Use at the start of every task, before searching the code.
15
+ - [write-a-feature](@warlock.js/grimoire/skills/write-a-feature/SKILL.md): Describe a new feature, or a new version of one, in `grimoire/features/` before writing code: the task, the brief, the README front matter, each flow with its steps, cases and acceptance criteria. Use when the owner asks for something the product does not do yet.
package/package.json CHANGED
@@ -1,6 +1,68 @@
1
1
  {
2
2
  "name": "@warlock.js/grimoire",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Experimental project map for Warlock.js apps: a generated book of the code, agent-written features, flows, apps, tasks and releases, a read-only check, and scry queries for agents.",
4
+ "keywords": [
5
+ "warlock.js",
6
+ "grimoire",
7
+ "project map",
8
+ "agents",
9
+ "documentation"
10
+ ],
11
+ "author": "hassanzohdy",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/warlockjs/framework.git",
16
+ "directory": "packages/grimoire"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/warlockjs/framework/issues"
20
+ },
21
+ "homepage": "https://warlock.js.org",
22
+ "engines": {
23
+ "node": ">=22.15.0"
24
+ },
25
+ "warlock": {
26
+ "environment": "server"
27
+ },
28
+ "peerDependencies": {
29
+ "@warlock.js/core": "5.56.0",
30
+ "@warlock.js/web": "5.56.0"
31
+ },
32
+ "peerDependenciesMeta": {
33
+ "@warlock.js/web": {
34
+ "optional": true
35
+ }
36
+ },
37
+ "version": "5.56.0",
38
+ "type": "module",
39
+ "main": "./esm/index.mjs",
40
+ "module": "./esm/index.mjs",
41
+ "types": "./esm/index.d.mts",
42
+ "exports": {
43
+ ".": {
44
+ "import": {
45
+ "types": "./esm/index.d.mts",
46
+ "default": "./esm/index.mjs"
47
+ }
48
+ },
49
+ "./warlock": {
50
+ "import": {
51
+ "types": "./esm/warlock/index.d.mts",
52
+ "default": "./esm/warlock/index.mjs"
53
+ }
54
+ },
55
+ "./vitest": {
56
+ "import": {
57
+ "types": "./esm/vitest/index.d.mts",
58
+ "default": "./esm/vitest/index.mjs"
59
+ }
60
+ },
61
+ "./devtools": {
62
+ "import": {
63
+ "types": "./esm/devtools/index.d.mts",
64
+ "default": "./esm/devtools/index.mjs"
65
+ }
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: backfill-a-grimoire
3
+ description: "Write the Grimoire for a project that already has code but no `grimoire/` folder: build the book, propose features from the modules and routes, write them as inferred, and bring the owner the questions only they can answer. Use once per existing project, or when a large undescribed area is found."
4
+ ---
5
+
6
+ # Backfill a Grimoire
7
+
8
+ The Grimoire is experimental: its file structure and commands may still change.
9
+
10
+ The code exists; the description does not. You will infer intent from code, and inference can be
11
+ plausible and wrong. So everything you write here is marked **inferred** until the owner confirms
12
+ it, and you bring them questions instead of guessing.
13
+
14
+ ## 1. Build the book
15
+
16
+ ```bash
17
+ npx warlock grimoire build
18
+ ```
19
+
20
+ It needs no writing. Read the module summaries (`grimoire/book/app/<module>/index.md`), the
21
+ route list (`grimoire/book/app/routes.json`) and each site's page list.
22
+
23
+ ## 2. Propose the features
24
+
25
+ Start from the modules: a module is usually one feature. Then adjust.
26
+
27
+ - Two modules that cannot be described without each other → one feature with both `folders`.
28
+ - A module that does two unrelated things → two features; tag the files of the smaller one.
29
+ - A folder shared by several features (a `components` folder with files of each) → list the files
30
+ each feature owns in its `folders`, one entry per file (`folders: [src/app/auth, src/web/components/login-form.tsx]`),
31
+ instead of tagging them in the code. A file entry wins over a folder of another feature.
32
+ - Plumbing (config, shared utilities, the base layout) → no feature.
33
+ - Mail, notifications, search: the machinery is a feature; each mail or notification belongs to
34
+ the feature that sends it.
35
+
36
+ Write the proposal as a table for the owner **before** writing files:
37
+
38
+ | Feature | Folders | Flows you see | Apps | Unsure about |
39
+ | ------- | ------------ | ------------------------------ | ------------------ | -------------------------- |
40
+ | auth | src/app/auth | sign-up, login, reset-password | web-client, mobile | is phone login still used? |
41
+
42
+ Wait for the owner's answer on the list. Features are the frame for everything else; a wrong
43
+ frame costs the most to fix.
44
+
45
+ ## 3. Write each feature as inferred
46
+
47
+ Follow `write-a-feature` for the shapes, with these differences:
48
+
49
+ ```md
50
+ ---
51
+ id: auth
52
+ title: Accounts
53
+ status: shipped
54
+ origin: inferred
55
+ version: 1.0
56
+ updated: 2026-11-16
57
+ apps: [web-client, mobile]
58
+ folders: [src/app/auth]
59
+ ---
60
+ ```
61
+
62
+ - `origin: inferred` on the README and on each flow. The owner changes it to `confirmed`.
63
+ - Start every feature at `1.0`. Do not reconstruct history; the changelog gets one line under `## Unreleased`
64
+ in the feature's own `CHANGELOG.md` (`grimoire/features/auth/CHANGELOG.md`), never in the README:
65
+
66
+ ```md
67
+ ## Unreleased
68
+
69
+ - 1.0 added described from the existing code
70
+ ```
71
+
72
+ - **Steps:** take them from the routes and pages, in the order a user meets them. A mail is a
73
+ `*.mail.ts` or `*.email.ts` file (or a file in `mails/` or `emails/`), a job is a queue job or a
74
+ scheduled task. When two sites or apps have a page with one path, write the app after it:
75
+ `page /support [web-admin]`.
76
+ - **Flows:** a flow starts from a route, a page, a job or an event. Logic with no entry point of
77
+ its own (a guard, a calculation) is not a flow: write it in the cases or criteria of the flow
78
+ that reaches it.
79
+ - **Cases:** answer the eight questions from what the code does. When the code answers a
80
+ question by doing nothing, that is still what happens: write it as a case with the result
81
+ (`duplicate saved twice`, `double submit two accounts`). List a question under
82
+ `## Not handled` only when the behaviour is a gap the owner should decide, in the same form as a
83
+ case (the question, then what happens today):
84
+
85
+ ```md
86
+ ## Not handled
87
+
88
+ - double submit two quick taps create two accounts
89
+ ```
90
+
91
+ - **Read-only flows:** a flow that only reads answers the questions that cannot happen with one
92
+ line each, `does not apply: read-only`. That is expected, not a finding.
93
+ - **Criteria:** one per case. Tag the existing tests with `@proves` where a test clearly proves
94
+ one. Do not write new tests during a backfill.
95
+ - **Intent you cannot see:** write `Unknown: why does a VIP skip the stock check?` in the flow.
96
+ Never invent a reason.
97
+
98
+ ## 4. Describe the apps
99
+
100
+ One folder per site and mobile app (`describe-an-app`). Declare the conditions you find in the
101
+ code (roles, permissions, membership checks). Write page files only for pages that combine
102
+ several features or change with the user. When the mobile app defines navigation in code, declare
103
+ its screens yourself; they are listed from file names only with file-based routing.
104
+
105
+ ## 5. Check and hand over
106
+
107
+ ```bash
108
+ npx warlock grimoire check
109
+ ```
110
+
111
+ Fix what it reports about your own files. A backfilled project reports many warnings (criteria with
112
+ no test, files with no header); fix errors first and list the warnings for the owner. Then give the owner one list:
113
+
114
+ - features and flows written, all inferred;
115
+ - every `Unknown:` and `Not handled` line, as questions;
116
+ - files that belong to no feature;
117
+ - files inside a feature that no flow reaches (undescribed behaviour or dead code);
118
+ - criteria with no test.
119
+
120
+ Open one task per question that needs a decision, with `status: waiting for approval` and a
121
+ `Decision needed:` line (see `write-a-feature`; any other word is `GR1004`). Mark every task you open
122
+ for the owner this way, also when the owner is away. Do not fix code during a backfill; open a task
123
+ for each bug you notice.
124
+
125
+ ## Size
126
+
127
+ Work one feature at a time and finish it before starting the next. A large project takes several
128
+ sessions; the task list says where you stopped.
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: describe-an-app
3
+ description: "Describe where users meet the product in `grimoire/apps/`: one folder per site or mobile app, its named conditions (guest, customer, membership, preferences), shared layouts, and the pages or screens whose blocks point to feature flows. Use when adding a page, a screen or a block, or when what a page shows depends on who is looking."
4
+ ---
5
+
6
+ # Describe an app
7
+
8
+ The Grimoire is experimental: its file structure and commands may still change.
9
+
10
+ Features say what the product does. Apps say where a user sees it. One folder per site or mobile
11
+ app:
12
+
13
+ ```
14
+ grimoire/apps/
15
+ web-client/
16
+ README.md the app and its conditions
17
+ layouts/site.md blocks every page of this layout shares
18
+ pages/home/README.md purpose, layout, blocks
19
+ pages/home/blocks/new-arrivals.md only when the block has page-specific detail
20
+ web-admin/
21
+ mobile/
22
+ screens/home/README.md declared by you when navigation is in code
23
+ ```
24
+
25
+ Write a file only when it says something the code or a feature flow does not already say. A page
26
+ with one purpose, no variation and no blocks from other features needs no file.
27
+
28
+ ## The app README
29
+
30
+ ```md
31
+ ---
32
+ id: web-client
33
+ type: site
34
+ root: src/web/$sites/client
35
+ ---
36
+
37
+ # The shop website
38
+
39
+ ## Conditions
40
+
41
+ - guest not signed in
42
+ - customer signed in
43
+ - vip customer with the vip membership
44
+ - pref:personalised the customer left personalised content on
45
+ ```
46
+
47
+ `origin` is optional (`inferred` or `confirmed`), on the README and on layouts, pages and screens,
48
+ as on features. Mark files you wrote from the code `inferred`.
49
+
50
+ Every page and block of this app uses these names and no others in **Who sees it**. Add a condition here before
51
+ using it. Name roles and permissions exactly as the access configuration does, so a reader can
52
+ find them in the code.
53
+
54
+ A mobile app in the same repository is one more app: `type: mobile`, `root: mobile`.
55
+
56
+ ## Mobile screens
57
+
58
+ How a screen gets into the book depends on how the app navigates:
59
+
60
+ | The mobile app | Screens come from | You write |
61
+ | -------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
62
+ | File-based routing (Expo Router) | The route file names under its `app` folder (`collectMobileFacts`) | A screen file only when it says something the route does not |
63
+ | Navigation defined in code | Nowhere: the book cannot read it | One file per screen you describe, in `grimoire/apps/<app>/screens/<screen>/README.md` |
64
+
65
+ A declared screen has a `route` (or a `screen` name) in its front matter:
66
+
67
+ ```md
68
+ ---
69
+ screen: order-tracking
70
+ ---
71
+
72
+ # Order tracking
73
+
74
+ ## Blocks
75
+
76
+ | Block | Flow | Who sees it | Changes with |
77
+ | ------------- | ------------------ | ----------- | ------------ |
78
+ | Courier stage | orders/track-order | customer | — |
79
+ ```
80
+
81
+ When the app uses file-based routing, `warlock grimoire check` reports a screen whose route has no
82
+ file. When navigation is in code, declare every screen a flow names; the check cannot verify it.
83
+
84
+ ## A page or screen
85
+
86
+ ```md
87
+ ---
88
+ route: /
89
+ layout: site
90
+ ---
91
+
92
+ # Home
93
+
94
+ The first page a visitor sees.
95
+
96
+ ## Blocks
97
+
98
+ | Block | Flow | Who sees it | Changes with |
99
+ | ----------------- | ----------------------- | ----------- | ---------------------- |
100
+ | Featured products | catalog/browse-products | everyone | vip: member prices |
101
+ | New arrivals | catalog/new-arrivals | everyone | the customer's country |
102
+ | Recent orders | orders/place-order | customer | — |
103
+ ```
104
+
105
+ - **One row per part of the page**, not one description per kind of user. Three roles and two
106
+ preferences are a few rows, not six pages.
107
+ - **Flow** is `feature/flow`. The rule for what the block shows lives there. Do not restate it.
108
+ - **Who sees it** uses the app's condition names, and the check reports a name the README does
109
+ not declare (`GR5002`). **Changes with** is free text: it is not checked, but starting an item
110
+ with a condition name (`vip: member prices`) keeps it readable.
111
+ - Do not list blocks that come from the layout.
112
+
113
+ ## A layout
114
+
115
+ `layouts/site.md` has the same Blocks table for what every page of that layout shares (header,
116
+ cart count, notifications bell, footer). Write it once; pages inherit it.
117
+
118
+ ## A block file
119
+
120
+ Only when the block has something to say about this page in particular:
121
+
122
+ ```md
123
+ ---
124
+ flow: catalog/new-arrivals
125
+ ---
126
+
127
+ # New arrivals on the home page
128
+
129
+ - position second row, under Featured products
130
+ - shows a grid of up to 20 products
131
+ - phones one row that scrolls sideways
132
+ ```
133
+
134
+ ## Where a difference between apps goes
135
+
136
+ | The difference | Goes in |
137
+ | -------------------------------------------------------------- | ----------------------------------- |
138
+ | What the user gets (mobile uses the device location) | The flow, under `## Differs by app` |
139
+ | How it looks or where it sits (a row on mobile, a grid on web) | That app's block file |
140
+
141
+ ## How a page is reached, and what it requires
142
+
143
+ Do not write these. The book lists how a page is reached (links and redirects it can read) and
144
+ what it requires (middleware and permissions). Write an entry point yourself only when the book
145
+ cannot see it, such as a link in an email:
146
+
147
+ ```md
148
+ ## Also reached from
149
+
150
+ - mail order-confirmation
151
+ ```
152
+
153
+ ## Check
154
+
155
+ ```bash
156
+ npx warlock grimoire check
157
+ ```
158
+
159
+ It reports a block that points to a flow that does not exist, a condition that is not declared in
160
+ the app README, a page whose route is gone, a screen with no route (file-based apps), and a
161
+ feature that lists an app with no folder here. Its codes are `GR5001` to `GR5009`;
162
+ `npx warlock explain GR5003` describes one.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: document-a-file
3
+ description: "Write the one-sentence header and the public-export comments the Grimoire copies into its book, and tag a file with `@feature` when it lives outside its feature's folders. Use whenever you create a source file or change what one is for."
4
+ ---
5
+
6
+ # Document a file
7
+
8
+ The Grimoire is experimental: its file structure and commands may still change.
9
+
10
+ Warlock copies two things from each source file into the book: the sentence at the top, and the
11
+ comment above each public export. They are the only words in the book that you write, and they
12
+ are what another agent reads to decide whether to open the file.
13
+
14
+ ## The header: one sentence, first thing in the file
15
+
16
+ Say why the file exists, from the product's side.
17
+
18
+ ```ts
19
+ /** Lists the newest products sold in the customer's country. */
20
+
21
+ export const NEW_ARRIVALS_LIMIT = 20;
22
+ ```
23
+
24
+ - One sentence. If you need two, the file probably does two things.
25
+ - Say what it is for, not what kind of file it is. The book already knows it is a service.
26
+ - Change it when the file's purpose changes. A stale header misleads every reader after you.
27
+
28
+ | Write | Not |
29
+ | ------------------------------------------ | ------------------------------------ |
30
+ | `Creates a post for the signed-in author.` | `Controller for posts.` |
31
+ | `Sends the order confirmation email.` | `This file contains the mail class.` |
32
+ | `Decides the price a VIP customer pays.` | `Helper functions.` |
33
+
34
+ ## Public exports: one line each
35
+
36
+ ```ts
37
+ /** Returns up to 20 products, newest first. */
38
+ export async function listNewArrivals(country?: string) {
39
+ // …
40
+ }
41
+ ```
42
+
43
+ - Comment only what other files import. Private helpers need no comment.
44
+ - Say what the caller gets or what happens. Do not repeat the name ("Lists new arrivals").
45
+ - Put limits and units in the line when they exist ("up to 20", "in minutes").
46
+
47
+ ## The feature tag: only for exceptions
48
+
49
+ A file belongs to the feature whose `folders` contain it. Add a tag only when the file lives
50
+ somewhere else:
51
+
52
+ ```ts
53
+ /**
54
+ * Deletes accounts that were never verified, seven days after sign-up.
55
+ * @feature auth
56
+ */
57
+ ```
58
+
59
+ One feature per file. A file used by several features still has one owner; the book lists the
60
+ others as borrowing it. Do not tag shared plumbing (config, generic utilities, the base layout).
61
+
62
+ ## Check your work
63
+
64
+ ```bash
65
+ npx warlock scry src/app/catalog/services/new-arrivals.service.ts
66
+ ```
67
+
68
+ The `about` line and each export's line should read well on their own, without the code beside
69
+ them. `npx warlock grimoire check` reports a file with no header and a file with no feature.
70
+
71
+ ## Do not
72
+
73
+ - Do not write a comment on every function, field or parameter.
74
+ - Do not describe the implementation ("uses a loop to…").
75
+ - Do not copy the flow's text into the file. The flow lives in `grimoire/features/`.
@@ -0,0 +1,26 @@
1
+ ---
2
+ description: "Grimoire (experimental), the project map for Warlock.js apps: `warlock scry` and `warlock grimoire build|check|release` over a `grimoire/` folder of generated book entries and agent-written features, flows, apps, tasks and releases. Topics: use the map before searching code, write a feature, record a change and release, describe sites and mobile screens, document a file, backfill an existing app. Use at the start of every task in a project that has `grimoire/`."
3
+ ---
4
+
5
+ # @warlock.js/grimoire
6
+
7
+ The Grimoire is experimental: its file structure and commands may still change.
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.
10
+
11
+ ## The 80% path
12
+
13
+ 1. Before searching the code, ask the map: `use-the-grimoire.md`.
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`.
16
+ 4. Pages, blocks, conditions and mobile screens: `describe-an-app.md`.
17
+ 5. The header and export comments the book copies from a file: `document-a-file.md`.
18
+ 6. A project with code but no `grimoire/` folder: `backfill-a-grimoire.md`.
19
+
20
+ ## Conventions and pitfalls
21
+
22
+ - 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.
24
+ - A finding marked `(expected)` belongs to `proposed` work and does not fail `warlock grimoire check`.
25
+ - Mobile screens are listed from file names only with file-based routing; declare them when navigation is in code.
26
+ - Do not invent intent: write `Unknown:` and ask the owner.
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: record-a-change
3
+ description: "Finish a change the Grimoire way: tie each test to the acceptance criterion it proves, reshape the feature README, add the changelog entry with the right version, move the task to done, run `warlock grimoire check`, and write the release brief. Use after building any change, including a bug fix."
4
+ ---
5
+
6
+ # Record a change
7
+
8
+ The Grimoire is experimental: its file structure and commands may still change.
9
+
10
+ A change is finished when the code, the tests and the description agree. Do these in order.
11
+
12
+ ## 1. Tie tests to criteria
13
+
14
+ Put a line above each test that proves a criterion:
15
+
16
+ ```ts
17
+ // @proves catalog/new-arrivals AC-2
18
+ it("returns the global list when the customer has no country", async () => {
19
+ // …
20
+ });
21
+ ```
22
+
23
+ - End-to-end tests prove a flow's steps. Unit tests prove a business rule ("a reset code expires
24
+ after 10 minutes").
25
+ - One test may prove one criterion. If it needs two tags, split the test.
26
+ - A bug fix gets a test that fails without the fix. If no criterion covers the bug, the flow was
27
+ missing a case: add the case and the criterion first.
28
+
29
+ ## 2. Reshape the README and the flow
30
+
31
+ Edit them so they describe the feature **as it is now**, as if it had always been this way. Do
32
+ not append "Update:" notes; history goes in the changelog. Set `updated` to today and `version`
33
+ to the new version. Set a flow's `status` to `shipped` once its code and tests exist.
34
+
35
+ ## 3. Add the changelog entry
36
+
37
+ `grimoire/features/catalog/CHANGELOG.md`, newest first, under `## Unreleased`. Warlock never edits
38
+ this file; you write every line of it, including the release number and date when the release ships
39
+ (step 6):
40
+
41
+ ```md
42
+ ## Unreleased
43
+
44
+ - 2.1 fixed new-arrivals: a customer with no country saw an empty list
45
+ instead of the global one (AC-2)
46
+ ```
47
+
48
+ | The change | Version | Word |
49
+ | ------------------------------------- | ------------------------- | --------- |
50
+ | A new flow or a new capability | next whole number (`3.0`) | `added` |
51
+ | Behaviour of an existing flow changes | next decimal (`2.1`) | `changed` |
52
+ | The code did not match the flow | next decimal (`2.1`) | `fixed` |
53
+ | A flow is retired | next whole number | `removed` |
54
+
55
+ One line per change, written for someone who uses the product. Name the flow, and the criterion
56
+ when there is one. While the change is unreleased, write no date and no release number.
57
+
58
+ ## 4. Close the task
59
+
60
+ Move the file from `grimoire/tasks/open/` to `grimoire/tasks/done/<yyyy-mm>/` and set:
61
+
62
+ ```md
63
+ status: done
64
+ shipped: catalog 2.1
65
+ ```
66
+
67
+ Add two lines: how it was verified (which tests, which criteria) and anything left open. If
68
+ something is left open, open a new task for it; do not leave it only in the done file. A task
69
+ that needs the owner's answer gets `status: waiting for approval` and a `Decision needed:` line.
70
+
71
+ ## 5. Check
72
+
73
+ ```bash
74
+ npx warlock grimoire check
75
+ ```
76
+
77
+ | It reports | Do |
78
+ | ------------------------------------------------------------------- | ----------------------------------------------------- |
79
+ | A step names a route, page, mail or job that does not exist | Fix the name in the flow, or the code |
80
+ | A criterion has no test | Write the test, or say in the task why not |
81
+ | A test points at a criterion that does not exist | Fix the `@proves` line |
82
+ | A file has no header, or no feature | `document-a-file` |
83
+ | A file in the feature's folders that no flow reaches | Describe the behaviour in a flow, or delete dead code |
84
+ | A README `updated` older than its newest changelog entry | Reshape the README |
85
+ | A changelog version that does not fit the word (`added` with `2.1`) | Fix the version |
86
+
87
+ Fix every line it prints. Do not finish with problems you caused. Findings on a flow or feature
88
+ with `status: proposed` print with `(expected)` and do not fail the check: leave them until the
89
+ code exists.
90
+
91
+ ## 6. At release time
92
+
93
+ Warlock does not edit your files at release. You do three things, in this order:
94
+
95
+ 1. **Stamp the changelogs.** In each feature that changed, move the `## Unreleased` entries under a
96
+ heading with the release number and date:
97
+
98
+ ```md
99
+ ## Unreleased
100
+
101
+ ## 1.4.1 (2026-11-20)
102
+
103
+ - 2.1 fixed new-arrivals: a customer with no country saw an empty list
104
+ instead of the global one (AC-2)
105
+ ```
106
+
107
+ 2. **Write the release brief.** Create `grimoire/releases/1.4.1.md`:
108
+
109
+ ```md
110
+ ---
111
+ release: 1.4.1
112
+ date: 2026-11-20
113
+ ---
114
+
115
+ # Release 1.4.1
116
+
117
+ Customers with no country on their account see new arrivals again.
118
+ ```
119
+
120
+ Two or three sentences on what the release means to users.
121
+
122
+ 3. **Collect the list.**
123
+
124
+ ```bash
125
+ npx warlock grimoire release 1.4.1
126
+ ```
127
+
128
+ It writes the entries you stamped with that release between the markers under your brief, and
129
+ changes nothing else. It also says how many entries are still unreleased. Do not write that list
130
+ yourself, and run the command again after any change to a changelog: the result is the same
131
+ every time.
132
+
133
+ `npx warlock grimoire check` reports a listed entry that has no changelog entry stamped with that
134
+ release and date, and a release section with no release file.
135
+
136
+ ## Report to the owner
137
+
138
+ Say what changed in plain words, the feature version, which criteria are proven, what the check
139
+ reported, and what is left open with its task id.