@warlock.js/grimoire 0.0.0-stage → 5.55.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 +46 -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 +35 -0
  95. package/esm/devtools/index.d.mts.map +1 -0
  96. package/esm/devtools/index.mjs +102 -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
@@ -0,0 +1,119 @@
1
+ import { createFinding } from "../../codes/index.mjs";
2
+ import { isCodeFile, isInsideFolder, toPosixPath } from "../../paths/index.mjs";
3
+
4
+ //#region ../../packages/grimoire/src/check/rules/source-files.ts
5
+ /**
6
+ * GR3001–GR3006: source files without a header or an owner, owners in
7
+ * conflict, and own files that no flow reaches.
8
+ */
9
+ /** File types that need no header sentence (GR3001). */
10
+ const NO_HEADER_TYPES = /* @__PURE__ */ new Set([
11
+ "spec",
12
+ "type",
13
+ "locale",
14
+ "config"
15
+ ]);
16
+ /** File types that need no feature (GR3002). */
17
+ const NO_FEATURE_TYPES = /* @__PURE__ */ new Set([
18
+ "spec",
19
+ "type",
20
+ "locale",
21
+ "config",
22
+ "main"
23
+ ]);
24
+ /** The top of a source file: where a header or a tag is written. */
25
+ function top(file) {
26
+ return {
27
+ file,
28
+ line: 1,
29
+ column: null
30
+ };
31
+ }
32
+ /** GR3001: a code file with no header sentence. Specs, types, locales, configs and `.d.ts` files are left out. */
33
+ function checkHeaders(snapshot) {
34
+ return snapshot.book.facts.files.filter((file) => file.about === null && !NO_HEADER_TYPES.has(file.type) && !/\.d\.[cm]?ts$/.test(file.file)).map((file) => createFinding({
35
+ code: "GR3001",
36
+ message: `${file.file} has no header sentence`,
37
+ at: top(file.file),
38
+ feature: snapshot.ownership.files[file.file]?.owner ?? null
39
+ }));
40
+ }
41
+ /**
42
+ * GR3002: a file under `src/app/` (not `src/app/shared/`) that no feature owns.
43
+ * GR3003: a file two features claim. GR3004: a `@feature` tag naming no
44
+ * feature. Only when the project has written files.
45
+ */
46
+ function checkOwners(snapshot) {
47
+ if (!snapshot.written.exists) return [];
48
+ const features = new Set(snapshot.written.features.map((feature) => feature.id));
49
+ const findings = [];
50
+ for (const file of snapshot.book.facts.files) {
51
+ const ownership = snapshot.ownership.files[file.file];
52
+ if (ownership && ownership.conflicts.length > 0) {
53
+ const claims = ownership.conflicts.map((claim) => `${claim.feature} (${claim.via})`).join(", ");
54
+ findings.push(createFinding({
55
+ code: "GR3003",
56
+ message: `${file.file} is claimed by ${claims}`,
57
+ at: top(file.file)
58
+ }));
59
+ } else if (needsFeature(file) && !ownership?.owner) findings.push(createFinding({
60
+ code: "GR3002",
61
+ message: `${file.file} belongs to no feature`,
62
+ at: top(file.file)
63
+ }));
64
+ for (const tag of file.tags["feature"] ?? []) {
65
+ const id = tag.trim().split(/\s+/)[0] ?? "";
66
+ if (id === "" || features.has(id)) continue;
67
+ findings.push(createFinding({
68
+ code: "GR3004",
69
+ message: `${file.file} is tagged @feature ${id}, which is no feature`,
70
+ at: top(file.file)
71
+ }));
72
+ }
73
+ }
74
+ return findings;
75
+ }
76
+ function needsFeature(file) {
77
+ const path = toPosixPath(file.file);
78
+ return isInsideFolder(path, "src/app") && !isInsideFolder(path, "src/app/shared") && !NO_FEATURE_TYPES.has(file.type);
79
+ }
80
+ /**
81
+ * GR3005: a feature `folders` entry that holds no file the book knows (every
82
+ * file under the source roots, code or not).
83
+ */
84
+ function checkFolders(snapshot) {
85
+ const held = /* @__PURE__ */ new Set();
86
+ for (const file of [...Object.keys(snapshot.book.manifest.files), ...snapshot.book.facts.files.map((item) => item.file)]) {
87
+ const parts = toPosixPath(file).split("/");
88
+ for (let length = parts.length; length > 0; length--) {
89
+ const folder = parts.slice(0, length).join("/");
90
+ if (held.has(folder)) break;
91
+ held.add(folder);
92
+ }
93
+ }
94
+ const findings = [];
95
+ for (const feature of snapshot.written.features) for (const folder of feature.readme?.folders ?? []) {
96
+ const normalized = toPosixPath(folder.value.trim()).replace(/^(?:\.\/)+/, "").replace(/\/+$/, "");
97
+ if (held.has(normalized)) continue;
98
+ findings.push(createFinding({
99
+ code: "GR3005",
100
+ message: isCodeFile(normalized) ? `folders entry "${folder.value}" of ${feature.id} is not a source file of the project` : `folders entry "${folder.value}" of ${feature.id} holds no source file`,
101
+ at: folder.at,
102
+ feature: feature.id
103
+ }));
104
+ }
105
+ return findings;
106
+ }
107
+ /** GR3006: a file a feature owns that no step of its flows reaches (`FeatureBookmap.unreached`). */
108
+ function checkUnreached(snapshot) {
109
+ return Object.values(snapshot.collected.features).flatMap((bookmap) => bookmap.unreached.map((file) => createFinding({
110
+ code: "GR3006",
111
+ message: `${file} is owned by ${bookmap.feature}, but no flow of ${bookmap.feature} reaches it`,
112
+ at: top(file),
113
+ feature: bookmap.feature
114
+ })));
115
+ }
116
+
117
+ //#endregion
118
+ export { checkFolders, checkHeaders, checkOwners, checkUnreached };
119
+ //# sourceMappingURL=source-files.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-files.mjs","names":[],"sources":["../../../../../../../../../packages/grimoire/src/check/rules/source-files.ts"],"sourcesContent":["/**\n * GR3001–GR3006: source files without a header or an owner, owners in\n * conflict, and own files that no flow reaches.\n */\nimport { createFinding } from \"../../codes\";\nimport type { BookFile } from \"../../contracts/adapter\";\nimport type { GrimoireFinding } from \"../../contracts/findings\";\nimport type { GrimoireSnapshot } from \"../../contracts/snapshot\";\nimport { isCodeFile, isInsideFolder, toPosixPath } from \"../../paths\";\n\n/** File types that need no header sentence (GR3001). */\nconst NO_HEADER_TYPES: ReadonlySet<string> = new Set([\"spec\", \"type\", \"locale\", \"config\"]);\n/** File types that need no feature (GR3002). */\nconst NO_FEATURE_TYPES: ReadonlySet<string> = new Set([\"spec\", \"type\", \"locale\", \"config\", \"main\"]);\n\n/** The top of a source file: where a header or a tag is written. */\nfunction top(file: string): { file: string; line: number; column: null } {\n return { file, line: 1, column: null };\n}\n\n/** GR3001: a code file with no header sentence. Specs, types, locales, configs and `.d.ts` files are left out. */\nexport function checkHeaders(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n return snapshot.book.facts.files\n .filter(\n (file) =>\n file.about === null && !NO_HEADER_TYPES.has(file.type) && !/\\.d\\.[cm]?ts$/.test(file.file),\n )\n .map((file) =>\n createFinding({\n code: \"GR3001\",\n message: `${file.file} has no header sentence`,\n at: top(file.file),\n feature: snapshot.ownership.files[file.file]?.owner ?? null,\n }),\n );\n}\n\n/**\n * GR3002: a file under `src/app/` (not `src/app/shared/`) that no feature owns.\n * GR3003: a file two features claim. GR3004: a `@feature` tag naming no\n * feature. Only when the project has written files.\n */\nexport function checkOwners(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n if (!snapshot.written.exists) return [];\n\n const features = new Set(snapshot.written.features.map((feature) => feature.id));\n const findings: GrimoireFinding[] = [];\n\n for (const file of snapshot.book.facts.files) {\n const ownership = snapshot.ownership.files[file.file];\n\n if (ownership && ownership.conflicts.length > 0) {\n const claims = ownership.conflicts\n .map((claim) => `${claim.feature} (${claim.via})`)\n .join(\", \");\n\n findings.push(\n createFinding({\n code: \"GR3003\",\n message: `${file.file} is claimed by ${claims}`,\n at: top(file.file),\n }),\n );\n } else if (needsFeature(file) && !ownership?.owner) {\n findings.push(\n createFinding({\n code: \"GR3002\",\n message: `${file.file} belongs to no feature`,\n at: top(file.file),\n }),\n );\n }\n\n // The feature id is the tag's first word, as the owner rule reads it (`@feature catalog — …`).\n for (const tag of file.tags[\"feature\"] ?? []) {\n const id = tag.trim().split(/\\s+/)[0] ?? \"\";\n\n if (id === \"\" || features.has(id)) continue;\n\n findings.push(\n createFinding({\n code: \"GR3004\",\n message: `${file.file} is tagged @feature ${id}, which is no feature`,\n at: top(file.file),\n }),\n );\n }\n }\n\n return findings;\n}\n\nfunction needsFeature(file: BookFile): boolean {\n const path = toPosixPath(file.file);\n\n return (\n isInsideFolder(path, \"src/app\") &&\n !isInsideFolder(path, \"src/app/shared\") &&\n !NO_FEATURE_TYPES.has(file.type)\n );\n}\n\n/**\n * GR3005: a feature `folders` entry that holds no file the book knows (every\n * file under the source roots, code or not).\n */\nexport function checkFolders(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n // Every folder that holds a known file (and the files themselves), built once: one lookup per entry.\n const held = new Set<string>();\n\n for (const file of [\n ...Object.keys(snapshot.book.manifest.files),\n ...snapshot.book.facts.files.map((item) => item.file),\n ]) {\n const parts = toPosixPath(file).split(\"/\");\n\n for (let length = parts.length; length > 0; length--) {\n const folder = parts.slice(0, length).join(\"/\");\n\n if (held.has(folder)) break;\n\n held.add(folder);\n }\n }\n\n const findings: GrimoireFinding[] = [];\n\n for (const feature of snapshot.written.features) {\n for (const folder of feature.readme?.folders ?? []) {\n // Written the way the owner rule reads it: `./` and a trailing `/` do not matter.\n const normalized = toPosixPath(folder.value.trim())\n .replace(/^(?:\\.\\/)+/, \"\")\n .replace(/\\/+$/, \"\");\n\n if (held.has(normalized)) continue;\n\n findings.push(\n createFinding({\n code: \"GR3005\",\n message: isCodeFile(normalized)\n ? `folders entry \"${folder.value}\" of ${feature.id} is not a source file of the project`\n : `folders entry \"${folder.value}\" of ${feature.id} holds no source file`,\n at: folder.at,\n feature: feature.id,\n }),\n );\n }\n }\n\n return findings;\n}\n\n/** GR3006: a file a feature owns that no step of its flows reaches (`FeatureBookmap.unreached`). */\nexport function checkUnreached(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n return Object.values(snapshot.collected.features).flatMap((bookmap) =>\n bookmap.unreached.map((file) =>\n createFinding({\n code: \"GR3006\",\n message: `${file} is owned by ${bookmap.feature}, but no flow of ${bookmap.feature} reaches it`,\n at: top(file),\n feature: bookmap.feature,\n }),\n ),\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,92 @@
1
+ import { createFinding } from "../../codes/index.mjs";
2
+ import { compareVersions, parseVersion } from "./lookup.mjs";
3
+
4
+ //#region ../../packages/grimoire/src/check/rules/versions.ts
5
+ /**
6
+ * GR6004–GR6008: the feature version, the README date and the changelog
7
+ * agree, and a new whole-number version has its brief.
8
+ */
9
+ const DATE = /^\d{4}-\d{2}-\d{2}$/;
10
+ /**
11
+ * GR6004: README `updated` older than the newest dated changelog section that
12
+ * holds entries. GR6005: README `version` differs from the newest entry's
13
+ * version.
14
+ */
15
+ function checkReadmeDates(snapshot) {
16
+ const findings = [];
17
+ for (const feature of snapshot.written.features) {
18
+ const readme = feature.readme;
19
+ const entries = feature.changelog?.entries ?? [];
20
+ if (!readme || entries.length === 0) continue;
21
+ const newestDate = entries.map((entry) => entry.date).filter((date) => date !== null && DATE.test(date)).sort().at(-1);
22
+ if (newestDate !== void 0 && DATE.test(readme.updated.value) && readme.updated.value < newestDate) findings.push(createFinding({
23
+ code: "GR6004",
24
+ message: `README of ${feature.id} was updated ${readme.updated.value}, before its changelog entries of ${newestDate}`,
25
+ at: readme.updated.at,
26
+ feature: feature.id
27
+ }));
28
+ const newest = entries.map((entry) => entry.version.value).filter((version) => parseVersion(version) !== null).sort(compareVersions).at(-1);
29
+ if (newest !== void 0 && parseVersion(readme.version.value) && compareVersions(readme.version.value, newest) !== 0) findings.push(createFinding({
30
+ code: "GR6005",
31
+ message: `README of ${feature.id} says version ${readme.version.value}, the newest changelog entry is ${newest}`,
32
+ at: readme.version.at,
33
+ feature: feature.id
34
+ }));
35
+ }
36
+ return findings;
37
+ }
38
+ /** GR6006: `added`/`removed` on a decimal version, or `changed`/`fixed` on a whole-number one. */
39
+ function checkChangeWords(snapshot) {
40
+ const findings = [];
41
+ for (const feature of snapshot.written.features) for (const entry of feature.changelog?.entries ?? []) {
42
+ const version = parseVersion(entry.version.value);
43
+ if (!version) continue;
44
+ const whole = version[1] === 0;
45
+ const wantsWhole = entry.word === "added" || entry.word === "removed";
46
+ if (whole === wantsWhole) continue;
47
+ findings.push(createFinding({
48
+ code: "GR6006",
49
+ message: `changelog entry ${entry.version.value} ${entry.word} uses a ${whole ? "whole-number" : "decimal"} version; ${entry.word} takes a ${wantsWhole ? "whole-number" : "decimal"} one`,
50
+ at: entry.at,
51
+ feature: feature.id,
52
+ flow: entry.flow === null ? null : `${feature.id}/${entry.flow}`
53
+ }));
54
+ }
55
+ return findings;
56
+ }
57
+ /**
58
+ * GR6007: a flow's `since` is newer than its feature's `version`.
59
+ * GR6008: a proposed flow starts a new whole-number version that has no
60
+ * `versions/v<n>.md` brief.
61
+ */
62
+ function checkFlowVersions(snapshot) {
63
+ const findings = [];
64
+ for (const feature of snapshot.written.features) {
65
+ const current = feature.readme ? parseVersion(feature.readme.version.value) : null;
66
+ if (!feature.readme || !current) continue;
67
+ const briefs = new Set(feature.versions.map((brief) => brief.major));
68
+ for (const flow of feature.flows) {
69
+ const since = parseVersion(flow.since.value);
70
+ if (!since) continue;
71
+ if (compareVersions(flow.since.value, feature.readme.version.value) > 0) findings.push(createFinding({
72
+ code: "GR6007",
73
+ message: `${flow.ref} is since ${flow.since.value}, newer than ${feature.id} ${feature.readme.version.value}`,
74
+ at: flow.since.at,
75
+ feature: feature.id,
76
+ flow: flow.ref
77
+ }));
78
+ if (flow.status.value === "proposed" && since[1] === 0 && since[0] > current[0] && !briefs.has(since[0])) findings.push(createFinding({
79
+ code: "GR6008",
80
+ message: `${flow.ref} starts ${feature.id} ${flow.since.value}, which has no brief versions/v${since[0]}.md`,
81
+ at: flow.since.at,
82
+ feature: feature.id,
83
+ flow: flow.ref
84
+ }));
85
+ }
86
+ }
87
+ return findings;
88
+ }
89
+
90
+ //#endregion
91
+ export { checkChangeWords, checkFlowVersions, checkReadmeDates };
92
+ //# sourceMappingURL=versions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.mjs","names":[],"sources":["../../../../../../../../../packages/grimoire/src/check/rules/versions.ts"],"sourcesContent":["/**\n * GR6004–GR6008: the feature version, the README date and the changelog\n * agree, and a new whole-number version has its brief.\n */\nimport { createFinding } from \"../../codes\";\nimport type { GrimoireFinding } from \"../../contracts/findings\";\nimport type { GrimoireSnapshot } from \"../../contracts/snapshot\";\nimport { compareVersions, parseVersion } from \"./lookup\";\n\nconst DATE = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/**\n * GR6004: README `updated` older than the newest dated changelog section that\n * holds entries. GR6005: README `version` differs from the newest entry's\n * version.\n */\nexport function checkReadmeDates(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const findings: GrimoireFinding[] = [];\n\n for (const feature of snapshot.written.features) {\n const readme = feature.readme;\n const entries = feature.changelog?.entries ?? [];\n\n if (!readme || entries.length === 0) continue;\n\n const newestDate = entries\n .map((entry) => entry.date)\n .filter((date): date is string => date !== null && DATE.test(date))\n .sort()\n .at(-1);\n\n if (\n newestDate !== undefined &&\n DATE.test(readme.updated.value) &&\n readme.updated.value < newestDate\n ) {\n findings.push(\n createFinding({\n code: \"GR6004\",\n message: `README of ${feature.id} was updated ${readme.updated.value}, before its changelog entries of ${newestDate}`,\n at: readme.updated.at,\n feature: feature.id,\n }),\n );\n }\n\n const newest = entries\n .map((entry) => entry.version.value)\n .filter((version) => parseVersion(version) !== null)\n .sort(compareVersions)\n .at(-1);\n\n if (\n newest !== undefined &&\n parseVersion(readme.version.value) &&\n compareVersions(readme.version.value, newest) !== 0\n ) {\n findings.push(\n createFinding({\n code: \"GR6005\",\n message: `README of ${feature.id} says version ${readme.version.value}, the newest changelog entry is ${newest}`,\n at: readme.version.at,\n feature: feature.id,\n }),\n );\n }\n }\n\n return findings;\n}\n\n/** GR6006: `added`/`removed` on a decimal version, or `changed`/`fixed` on a whole-number one. */\nexport function checkChangeWords(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const findings: GrimoireFinding[] = [];\n\n for (const feature of snapshot.written.features) {\n for (const entry of feature.changelog?.entries ?? []) {\n const version = parseVersion(entry.version.value);\n\n if (!version) continue;\n\n const whole = version[1] === 0;\n const wantsWhole = entry.word === \"added\" || entry.word === \"removed\";\n\n if (whole === wantsWhole) continue;\n\n findings.push(\n createFinding({\n code: \"GR6006\",\n message: `changelog entry ${entry.version.value} ${entry.word} uses a ${whole ? \"whole-number\" : \"decimal\"} version; ${entry.word} takes a ${wantsWhole ? \"whole-number\" : \"decimal\"} one`,\n at: entry.at,\n feature: feature.id,\n flow: entry.flow === null ? null : `${feature.id}/${entry.flow}`,\n }),\n );\n }\n }\n\n return findings;\n}\n\n/**\n * GR6007: a flow's `since` is newer than its feature's `version`.\n * GR6008: a proposed flow starts a new whole-number version that has no\n * `versions/v<n>.md` brief.\n */\nexport function checkFlowVersions(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const findings: GrimoireFinding[] = [];\n\n for (const feature of snapshot.written.features) {\n const current = feature.readme ? parseVersion(feature.readme.version.value) : null;\n\n if (!feature.readme || !current) continue;\n\n const briefs = new Set(feature.versions.map((brief) => brief.major));\n\n for (const flow of feature.flows) {\n const since = parseVersion(flow.since.value);\n\n if (!since) continue;\n\n if (compareVersions(flow.since.value, feature.readme.version.value) > 0) {\n findings.push(\n createFinding({\n code: \"GR6007\",\n message: `${flow.ref} is since ${flow.since.value}, newer than ${feature.id} ${feature.readme.version.value}`,\n at: flow.since.at,\n feature: feature.id,\n flow: flow.ref,\n }),\n );\n }\n\n if (\n flow.status.value === \"proposed\" &&\n since[1] === 0 &&\n since[0] > current[0] &&\n !briefs.has(since[0])\n ) {\n findings.push(\n createFinding({\n code: \"GR6008\",\n message: `${flow.ref} starts ${feature.id} ${flow.since.value}, which has no brief versions/v${since[0]}.md`,\n at: flow.since.at,\n feature: feature.id,\n flow: flow.ref,\n }),\n );\n }\n }\n }\n\n return findings;\n}\n"],"mappings":"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"}
@@ -0,0 +1,182 @@
1
+ import { GrimoireCodeDefinition } from "../contracts/findings.mjs";
2
+ //#region ../../packages/grimoire/src/codes/codes.d.ts
3
+ /** Every code, in order. */
4
+ export declare const GRIMOIRE_CODE_LIST: readonly [GrimoireCodeDefinition & {
5
+ readonly code: "GR1001";
6
+ }, GrimoireCodeDefinition & {
7
+ readonly code: "GR1002";
8
+ }, GrimoireCodeDefinition & {
9
+ readonly code: "GR1003";
10
+ }, GrimoireCodeDefinition & {
11
+ readonly code: "GR1004";
12
+ }, GrimoireCodeDefinition & {
13
+ readonly code: "GR1005";
14
+ }, GrimoireCodeDefinition & {
15
+ readonly code: "GR1006";
16
+ }, GrimoireCodeDefinition & {
17
+ readonly code: "GR1007";
18
+ }, GrimoireCodeDefinition & {
19
+ readonly code: "GR1008";
20
+ }, GrimoireCodeDefinition & {
21
+ readonly code: "GR1009";
22
+ }, GrimoireCodeDefinition & {
23
+ readonly code: "GR1010";
24
+ }, GrimoireCodeDefinition & {
25
+ readonly code: "GR1011";
26
+ }, GrimoireCodeDefinition & {
27
+ readonly code: "GR1012";
28
+ }, GrimoireCodeDefinition & {
29
+ readonly code: "GR1013";
30
+ }, GrimoireCodeDefinition & {
31
+ readonly code: "GR1014";
32
+ }, GrimoireCodeDefinition & {
33
+ readonly code: "GR1015";
34
+ }, GrimoireCodeDefinition & {
35
+ readonly code: "GR1016";
36
+ }, GrimoireCodeDefinition & {
37
+ readonly code: "GR1017";
38
+ }, GrimoireCodeDefinition & {
39
+ readonly code: "GR1018";
40
+ }, GrimoireCodeDefinition & {
41
+ readonly code: "GR1019";
42
+ }, GrimoireCodeDefinition & {
43
+ readonly code: "GR1020";
44
+ }, GrimoireCodeDefinition & {
45
+ readonly code: "GR1021";
46
+ }, GrimoireCodeDefinition & {
47
+ readonly code: "GR1022";
48
+ }, GrimoireCodeDefinition & {
49
+ readonly code: "GR1023";
50
+ }, GrimoireCodeDefinition & {
51
+ readonly code: "GR1024";
52
+ }, GrimoireCodeDefinition & {
53
+ readonly code: "GR1025";
54
+ }, GrimoireCodeDefinition & {
55
+ readonly code: "GR1026";
56
+ }, GrimoireCodeDefinition & {
57
+ readonly code: "GR1027";
58
+ }, GrimoireCodeDefinition & {
59
+ readonly code: "GR1028";
60
+ }, GrimoireCodeDefinition & {
61
+ readonly code: "GR2001";
62
+ }, GrimoireCodeDefinition & {
63
+ readonly code: "GR2002";
64
+ }, GrimoireCodeDefinition & {
65
+ readonly code: "GR2003";
66
+ }, GrimoireCodeDefinition & {
67
+ readonly code: "GR2004";
68
+ }, GrimoireCodeDefinition & {
69
+ readonly code: "GR2005";
70
+ }, GrimoireCodeDefinition & {
71
+ readonly code: "GR2006";
72
+ }, GrimoireCodeDefinition & {
73
+ readonly code: "GR2007";
74
+ }, GrimoireCodeDefinition & {
75
+ readonly code: "GR2008";
76
+ }, GrimoireCodeDefinition & {
77
+ readonly code: "GR2009";
78
+ }, GrimoireCodeDefinition & {
79
+ readonly code: "GR2010";
80
+ }, GrimoireCodeDefinition & {
81
+ readonly code: "GR2011";
82
+ }, GrimoireCodeDefinition & {
83
+ readonly code: "GR2012";
84
+ }, GrimoireCodeDefinition & {
85
+ readonly code: "GR3001";
86
+ }, GrimoireCodeDefinition & {
87
+ readonly code: "GR3002";
88
+ }, GrimoireCodeDefinition & {
89
+ readonly code: "GR3003";
90
+ }, GrimoireCodeDefinition & {
91
+ readonly code: "GR3004";
92
+ }, GrimoireCodeDefinition & {
93
+ readonly code: "GR3005";
94
+ }, GrimoireCodeDefinition & {
95
+ readonly code: "GR3006";
96
+ }, GrimoireCodeDefinition & {
97
+ readonly code: "GR4001";
98
+ }, GrimoireCodeDefinition & {
99
+ readonly code: "GR4002";
100
+ }, GrimoireCodeDefinition & {
101
+ readonly code: "GR4003";
102
+ }, GrimoireCodeDefinition & {
103
+ readonly code: "GR4004";
104
+ }, GrimoireCodeDefinition & {
105
+ readonly code: "GR4005";
106
+ }, GrimoireCodeDefinition & {
107
+ readonly code: "GR4006";
108
+ }, GrimoireCodeDefinition & {
109
+ readonly code: "GR4007";
110
+ }, GrimoireCodeDefinition & {
111
+ readonly code: "GR4008";
112
+ }, GrimoireCodeDefinition & {
113
+ readonly code: "GR5001";
114
+ }, GrimoireCodeDefinition & {
115
+ readonly code: "GR5002";
116
+ }, GrimoireCodeDefinition & {
117
+ readonly code: "GR5003";
118
+ }, GrimoireCodeDefinition & {
119
+ readonly code: "GR5004";
120
+ }, GrimoireCodeDefinition & {
121
+ readonly code: "GR5005";
122
+ }, GrimoireCodeDefinition & {
123
+ readonly code: "GR5006";
124
+ }, GrimoireCodeDefinition & {
125
+ readonly code: "GR5007";
126
+ }, GrimoireCodeDefinition & {
127
+ readonly code: "GR5008";
128
+ }, GrimoireCodeDefinition & {
129
+ readonly code: "GR5009";
130
+ }, GrimoireCodeDefinition & {
131
+ readonly code: "GR6001";
132
+ }, GrimoireCodeDefinition & {
133
+ readonly code: "GR6002";
134
+ }, GrimoireCodeDefinition & {
135
+ readonly code: "GR6003";
136
+ }, GrimoireCodeDefinition & {
137
+ readonly code: "GR6004";
138
+ }, GrimoireCodeDefinition & {
139
+ readonly code: "GR6005";
140
+ }, GrimoireCodeDefinition & {
141
+ readonly code: "GR6006";
142
+ }, GrimoireCodeDefinition & {
143
+ readonly code: "GR6007";
144
+ }, GrimoireCodeDefinition & {
145
+ readonly code: "GR6008";
146
+ }, GrimoireCodeDefinition & {
147
+ readonly code: "GR7001";
148
+ }, GrimoireCodeDefinition & {
149
+ readonly code: "GR7002";
150
+ }, GrimoireCodeDefinition & {
151
+ readonly code: "GR7003";
152
+ }, GrimoireCodeDefinition & {
153
+ readonly code: "GR7004";
154
+ }, GrimoireCodeDefinition & {
155
+ readonly code: "GR7005";
156
+ }, GrimoireCodeDefinition & {
157
+ readonly code: "GR8001";
158
+ }, GrimoireCodeDefinition & {
159
+ readonly code: "GR8002";
160
+ }, GrimoireCodeDefinition & {
161
+ readonly code: "GR8003";
162
+ }, GrimoireCodeDefinition & {
163
+ readonly code: "GR8004";
164
+ }, GrimoireCodeDefinition & {
165
+ readonly code: "GR9001";
166
+ }, GrimoireCodeDefinition & {
167
+ readonly code: "GR9002";
168
+ }, GrimoireCodeDefinition & {
169
+ readonly code: "GR9003";
170
+ }, GrimoireCodeDefinition & {
171
+ readonly code: "GR9004";
172
+ }, GrimoireCodeDefinition & {
173
+ readonly code: "GR9005";
174
+ }, GrimoireCodeDefinition & {
175
+ readonly code: "GR9006";
176
+ }];
177
+ /** One registered code, as a union. */
178
+ export type GrimoireCode = (typeof GRIMOIRE_CODE_LIST)[number]["code"];
179
+ /** The catalog, keyed by code. */
180
+ export declare const GRIMOIRE_CODES: Readonly<Record<GrimoireCode, GrimoireCodeDefinition>>;
181
+ //#endregion
182
+ //# sourceMappingURL=codes.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/codes/codes.ts"],"mappings":";;;qBA0Ca,8BAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqsBnB,uBAAuB;;qBAGtB,gBAAgB,SAAS,OAAO,cAAc"}
@@ -0,0 +1,111 @@
1
+ //#region ../../packages/grimoire/src/codes/codes.ts
2
+ function define(code, area, severity, title, fix, skill) {
3
+ return {
4
+ code,
5
+ area,
6
+ severity,
7
+ title,
8
+ fix,
9
+ skill
10
+ };
11
+ }
12
+ const WRITE = "write-a-feature";
13
+ const RECORD = "record-a-change";
14
+ const APP = "describe-an-app";
15
+ const FILE = "document-a-file";
16
+ const USE = "use-the-grimoire";
17
+ /** Every code, in order. */
18
+ const GRIMOIRE_CODE_LIST = [
19
+ define("GR1001", "structure", "error", "A written file has no front matter", "Start the file with the front matter block its template shows, between two `---` lines.", WRITE),
20
+ define("GR1002", "structure", "error", "The front matter cannot be read", "Write one `key: value` per line; lists as `[a, b]` or as `- item` lines under the key; close the block with `---`.", WRITE),
21
+ define("GR1003", "structure", "error", "A required front matter key is missing", "Add the key named in the message; the template of that file lists every required key.", WRITE),
22
+ define("GR1004", "structure", "error", "A front matter value has the wrong form", "Use the form the message names: dates as yyyy-mm-dd, versions as 2.1, ids in lower-case-with-dashes, a status from the list (a task status is open, waiting for approval, approved, in progress, blocked, done or dropped; a question for the owner is waiting for approval).", WRITE),
23
+ define("GR1005", "structure", "warning", "A front matter key is not part of the template", "Remove the key, or move what it says into the body of the file.", WRITE),
24
+ define("GR1006", "structure", "error", "A required heading is missing", "Add the heading named in the message, spelled as in the template.", WRITE),
25
+ define("GR1007", "structure", "warning", "A heading is not part of the template", "Use the template's headings; put the text under one of them or remove it.", WRITE),
26
+ define("GR1008", "structure", "error", "A step line has the wrong form", "Write steps as `1. route POST /wishlist`: a number, a kind, then the name used in code.", WRITE),
27
+ define("GR1009", "structure", "error", "A step names an unknown kind", "Use one of: page, route, mail, notification, job, event, outside service, affects.", WRITE),
28
+ define("GR1010", "structure", "error", "Steps are not numbered 1, 2, 3 in order", "Number the steps from 1 without gaps, in the order a user meets them.", WRITE),
29
+ define("GR1011", "structure", "error", "A case line has the wrong form", "Write cases as `- double submit two taps save once`: the question, spaces, then the answer.", WRITE),
30
+ define("GR1012", "structure", "warning", "A case question is not answered", "Answer the question under Cases (or `does not apply` and why), or list it under Not handled.", WRITE),
31
+ define("GR1013", "structure", "error", "A criterion line has the wrong form", "Write criteria as `- AC-3 a guest is sent to sign in`, optionally `- AC-4 [mobile] …`.", WRITE),
32
+ define("GR1014", "structure", "error", "A criterion id is used twice in one flow", "Give the new criterion the next free number. Never renumber existing criteria.", WRITE),
33
+ define("GR1015", "structure", "error", "A changelog line has the wrong form", "Write entries as `- 2.1 fixed new-arrivals: what changed (AC-2)`.", RECORD),
34
+ define("GR1016", "structure", "error", "A changelog entry uses an unknown word", "Use one of: added, changed, fixed, removed.", RECORD),
35
+ define("GR1017", "structure", "error", "A changelog heading has the wrong form", "Use `## Unreleased`, or `## <release> (<yyyy-mm-dd>)` for entries of a release.", RECORD),
36
+ define("GR1018", "structure", "error", "A blocks table has the wrong form", "Use the columns Block, Flow, Who sees it, Changes with; one row per part of the page.", APP),
37
+ define("GR1019", "structure", "error", "An id does not match its folder or file name", "Make the front matter `id` (or `release`) equal the folder or file name.", WRITE),
38
+ define("GR1020", "structure", "warning", "A file in the grimoire folder is not part of the layout", "Move the file to where the layout expects it, or remove it.", USE),
39
+ define("GR1021", "structure", "error", "A feature, app, page or screen folder has no README.md", "Add README.md with the front matter of its template.", WRITE),
40
+ define("GR1022", "structure", "error", "Two files use the same id", "Give each feature, app or task its own id.", WRITE),
41
+ define("GR1023", "structure", "error", "A task file is misnamed or misplaced", "Name tasks `T-<n>-<slug>.md`, in `tasks/open/` or `tasks/done/<yyyy-mm>/`.", RECORD),
42
+ define("GR1024", "structure", "error", "The collected-list markers of a release file are broken", "Keep the start and end markers in pairs, or remove both and run `warlock grimoire release` again.", RECORD),
43
+ define("GR1025", "structure", "error", "A written file cannot be read", "Save the file as UTF-8 text.", USE),
44
+ define("GR1026", "structure", "error", "The feature README lists a flow that has no file", "Add `flows/<flow>.md`, or remove the flow from the README's Flows list.", WRITE),
45
+ define("GR1027", "structure", "warning", "A flow file is not listed in the feature README", "Add the flow to the README's Flows list.", WRITE),
46
+ define("GR1028", "structure", "error", "A list line has the wrong form", "Write list lines as `- name text`: the name, spaces, then the text.", WRITE),
47
+ define("GR2001", "links", "error", "A route step names a route that does not exist", "Fix the method and path in the flow, or add the route in code.", RECORD),
48
+ define("GR2002", "links", "error", "A page step names a page that does not exist", "Fix the route path in the flow, or add the page to one of the feature's apps. A step scoped like `page /support [web-admin]` looks only in that app.", RECORD),
49
+ define("GR2003", "links", "error", "A mail step names a mail that does not exist", "Use the mail's name as code defines it, or add the mail.", RECORD),
50
+ define("GR2004", "links", "error", "A notification step names a notification that does not exist", "Use the notification's name as code defines it, or add it.", RECORD),
51
+ define("GR2005", "links", "error", "A job step names a job that does not exist", "Use the job's name as code defines it, or add the job.", RECORD),
52
+ define("GR2006", "links", "error", "An event step names an event that does not exist", "Use the event's name as code emits it, or add the event.", RECORD),
53
+ define("GR2007", "links", "error", "An affects step names a feature or flow that does not exist", "Write `affects <feature>/<flow>` with an existing feature and flow.", WRITE),
54
+ define("GR2008", "links", "error", "A name refers to an app with no folder", "Add `grimoire/apps/<app>/README.md`, or fix the app id.", APP),
55
+ define("GR2009", "links", "warning", "A flow names an app its feature does not list", "Add the app to the feature's `apps`, or fix the app id in Differs by app or the criterion.", WRITE),
56
+ define("GR2010", "links", "error", "A changelog entry names a flow that does not exist", "Fix the flow id before the `:`, or add the flow.", RECORD),
57
+ define("GR2011", "links", "error", "A changelog entry names a criterion the flow does not have", "Fix the criterion id, or add the criterion to the flow.", RECORD),
58
+ define("GR2012", "links", "error", "A README relation names a flow that does not exist", "Fix the `<feature>/<flow>` reference in Affects and affected by.", WRITE),
59
+ define("GR3001", "files", "warning", "A source file has no header sentence", "Start the file with a one-sentence comment saying why it exists.", FILE),
60
+ define("GR3002", "files", "warning", "A source file belongs to no feature", "Add its folder to a feature's `folders`, or tag it `@feature <id>` in its header.", FILE),
61
+ define("GR3003", "files", "error", "A source file has two owners", "Keep one owner: remove the duplicate folder from one feature, or keep one `@feature` tag.", FILE),
62
+ define("GR3004", "files", "error", "A `@feature` tag names a feature that does not exist", "Fix the tag, or write the feature.", FILE),
63
+ define("GR3005", "files", "error", "A feature's `folders` entry does not exist", "Fix the folder or file path, or remove it from `folders`.", WRITE),
64
+ define("GR3006", "files", "warning", "A file in a feature's folders is reached by no flow", "Describe the behaviour in a flow, or delete dead code.", RECORD),
65
+ define("GR4001", "tests", "warning", "A criterion has no test", "Write a test with `// @proves <feature>/<flow> AC-<n>` above it, or say in the task why not.", RECORD),
66
+ define("GR4002", "tests", "error", "A `@proves` line names a flow or criterion that does not exist", "Fix the `@proves` line to name an existing `<feature>/<flow> AC-<n>`.", RECORD),
67
+ define("GR4003", "tests", "error", "A `@proves` line has the wrong form", "Write `// @proves <feature>/<flow> AC-<n>` on its own line.", RECORD),
68
+ define("GR4004", "tests", "error", "A `@proves` line is not directly above a test", "Move the line right above the `it(…)` or `test(…)` it describes.", RECORD),
69
+ define("GR4005", "tests", "warning", "One test proves two criteria", "Split the test so each proves one criterion.", RECORD),
70
+ define("GR4006", "tests", "error", "A test proving a criterion failed in its last run", "Fix the code or the test, then run the tests again.", RECORD),
71
+ define("GR4007", "tests", "warning", "A criterion's test result is older than the test file", "Run the tests again.", RECORD),
72
+ define("GR4008", "tests", "warning", "A criterion's test did not run in the last run", "Run the tests that prove the criterion.", RECORD),
73
+ define("GR5001", "apps", "error", "A block points to a flow that does not exist", "Fix the `<feature>/<flow>` in the Flow column or the block file.", APP),
74
+ define("GR5002", "apps", "error", "A condition is not declared in the app README", "Add the condition under Conditions in the app README, or use a declared one.", APP),
75
+ define("GR5003", "apps", "error", "A page's route does not exist in its site", "Fix the `route` of the page file, or remove the page file if the page is gone.", APP),
76
+ define("GR5004", "apps", "error", "A page names a layout with no file", "Add `layouts/<layout>.md` to the app, or fix the page's `layout`.", APP),
77
+ define("GR5005", "apps", "error", "An app's root matches no site or mobile app", "Set `root` to the site folder (`src/web/$sites/<site>`) or the mobile app folder.", APP),
78
+ define("GR5006", "apps", "error", "A screen's route does not exist in the mobile app", "Fix the `route` of the screen file, or remove it if the screen is gone.", APP),
79
+ define("GR5007", "apps", "warning", "A block file has no row in its page's Blocks table", "Add the block to the page's Blocks table, or remove the block file.", APP),
80
+ define("GR5008", "apps", "error", "An entry point in Also reached from does not exist", "Fix the mail, notification or page name.", APP),
81
+ define("GR5009", "apps", "warning", "A site or mobile app has no folder in grimoire/apps", "Add `grimoire/apps/<app>/README.md` for it.", APP),
82
+ define("GR6001", "changelog", "error", "A release lists a changelog entry that is not stamped with it", "Move the entry under `## <release> (<date>)` in the feature's CHANGELOG.md.", RECORD),
83
+ define("GR6002", "changelog", "error", "A changelog release section has no release file", "Write `grimoire/releases/<release>.md`, or fix the release in the heading.", RECORD),
84
+ define("GR6003", "changelog", "error", "A changelog release date differs from the release file", "Use the date in the release file's front matter.", RECORD),
85
+ define("GR6004", "changelog", "error", "The README `updated` is older than the newest changelog entry", "Reshape the README to describe the feature as it is now, and set `updated`.", RECORD),
86
+ define("GR6005", "changelog", "error", "The README `version` differs from the newest changelog entry", "Set `version` to the newest entry's version.", RECORD),
87
+ define("GR6006", "changelog", "warning", "A changelog word does not match its version step", "Use a whole-number version for added and removed, a decimal for changed and fixed.", RECORD),
88
+ define("GR6007", "changelog", "error", "A flow's `since` is newer than its feature's version", "Fix `since`, or the feature `version`.", WRITE),
89
+ define("GR6008", "changelog", "warning", "A new whole-number version has no brief", "Write `versions/v<n>.md` before building it.", WRITE),
90
+ define("GR7001", "tasks", "error", "A task names a feature that does not exist", "Fix the task's `feature`, or write the feature first.", WRITE),
91
+ define("GR7002", "tasks", "error", "A task names a flow that does not exist", "Fix the task's `flow`, or write the flow first.", WRITE),
92
+ define("GR7003", "tasks", "error", "A task's status does not match its folder", "Done tasks live in `tasks/done/<yyyy-mm>/` with `status: done` and `shipped`; open tasks in `tasks/open/`.", RECORD),
93
+ define("GR7004", "tasks", "error", "A task's `shipped` names a version the changelog does not have", "Fix `shipped: <feature> <version>`, or add the changelog entry.", RECORD),
94
+ define("GR7005", "tasks", "warning", "A task's brief does not exist", "Fix the `Brief:` path, or write the brief.", WRITE),
95
+ define("GR8001", "book", "error", "The project's source files could not be read", "Read the message; fix the file or folder it names, then build again.", USE),
96
+ define("GR8002", "book", "warning", "Route facts could not be read because the app did not boot", "Run `warlock doctor`, fix what stops the app from booting, then `warlock grimoire build`.", USE),
97
+ define("GR8003", "book", "warning", "Route facts are older than the routes files", "Run `warlock grimoire build` to refresh them.", USE),
98
+ define("GR8004", "book", "warning", "Pages or screens could not be read", "Read the message; fix the page file it names, then build again.", USE),
99
+ define("GR9001", "usage", "error", "The file is not in the book", "Pass a code file under the source roots, as a project-relative path.", USE),
100
+ define("GR9002", "usage", "error", "No route matches", "Pass `\"<METHOD> <path>\"` as the route is registered; `warlock routes` lists them.", USE),
101
+ define("GR9003", "usage", "error", "No feature has that id", "Use an id from `grimoire/features/`.", USE),
102
+ define("GR9004", "usage", "error", "No flow has that id", "Use `<feature>/<flow>` with a file in `grimoire/features/<feature>/flows/`.", USE),
103
+ define("GR9005", "usage", "error", "The release file has no brief yet", "Write `grimoire/releases/<release>.md` with `release` and `date` front matter and the brief, then run the command again.", RECORD),
104
+ define("GR9006", "usage", "error", "A query argument has the wrong form", "Read the command's help (`warlock scry --help`) and pass the argument in that form.", USE)
105
+ ];
106
+ /** The catalog, keyed by code. */
107
+ const GRIMOIRE_CODES = Object.fromEntries(GRIMOIRE_CODE_LIST.map((definition) => [definition.code, definition]));
108
+
109
+ //#endregion
110
+ export { GRIMOIRE_CODES, GRIMOIRE_CODE_LIST };
111
+ //# sourceMappingURL=codes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/codes/codes.ts"],"sourcesContent":["/**\n * The catalog of stable Grimoire finding codes.\n *\n * THE SCHEME: `GR` followed by four digits. The first digit is the area:\n *\n * | Range | Area | Meaning |\n * | ------ | --------- | ----------------------------------------------------------- |\n * | GR1xxx | structure | a written file does not follow its fixed structure |\n * | GR2xxx | links | a written name points at something that does not exist |\n * | GR3xxx | files | source files: headers, owners, files no flow reaches |\n * | GR4xxx | tests | criteria, `@proves` lines and test results |\n * | GR5xxx | apps | sites, mobile apps, pages, screens and blocks |\n * | GR6xxx | changelog | feature versions, changelogs and releases |\n * | GR7xxx | tasks | task files |\n * | GR8xxx | book | building the book from the framework's facts |\n * | GR9xxx | usage | a command or query was asked something it cannot answer |\n *\n * STABILITY: a released code keeps its meaning. Titles and fixes may be\n * reworded; a code is never reused or renumbered.\n *\n * This module imports nothing, so any entry can use it.\n */\nimport type { GrimoireCodeDefinition } from \"../contracts/findings\";\n\nfunction define<const Code extends string>(\n code: Code,\n area: GrimoireCodeDefinition[\"area\"],\n severity: GrimoireCodeDefinition[\"severity\"],\n title: string,\n fix: string,\n skill: string,\n): GrimoireCodeDefinition & { readonly code: Code } {\n return { code, area, severity, title, fix, skill };\n}\n\nconst WRITE = \"write-a-feature\";\nconst RECORD = \"record-a-change\";\nconst APP = \"describe-an-app\";\nconst FILE = \"document-a-file\";\nconst USE = \"use-the-grimoire\";\n\n/** Every code, in order. */\nexport const GRIMOIRE_CODE_LIST = [\n // ── GR1xxx structure ─────────────────────────────────────────────────────\n define(\n \"GR1001\",\n \"structure\",\n \"error\",\n \"A written file has no front matter\",\n \"Start the file with the front matter block its template shows, between two `---` lines.\",\n WRITE,\n ),\n define(\n \"GR1002\",\n \"structure\",\n \"error\",\n \"The front matter cannot be read\",\n \"Write one `key: value` per line; lists as `[a, b]` or as `- item` lines under the key; close the block with `---`.\",\n WRITE,\n ),\n define(\n \"GR1003\",\n \"structure\",\n \"error\",\n \"A required front matter key is missing\",\n \"Add the key named in the message; the template of that file lists every required key.\",\n WRITE,\n ),\n define(\n \"GR1004\",\n \"structure\",\n \"error\",\n \"A front matter value has the wrong form\",\n \"Use the form the message names: dates as yyyy-mm-dd, versions as 2.1, ids in lower-case-with-dashes, a status from the list (a task status is open, waiting for approval, approved, in progress, blocked, done or dropped; a question for the owner is waiting for approval).\",\n WRITE,\n ),\n define(\n \"GR1005\",\n \"structure\",\n \"warning\",\n \"A front matter key is not part of the template\",\n \"Remove the key, or move what it says into the body of the file.\",\n WRITE,\n ),\n define(\n \"GR1006\",\n \"structure\",\n \"error\",\n \"A required heading is missing\",\n \"Add the heading named in the message, spelled as in the template.\",\n WRITE,\n ),\n define(\n \"GR1007\",\n \"structure\",\n \"warning\",\n \"A heading is not part of the template\",\n \"Use the template's headings; put the text under one of them or remove it.\",\n WRITE,\n ),\n define(\n \"GR1008\",\n \"structure\",\n \"error\",\n \"A step line has the wrong form\",\n \"Write steps as `1. route POST /wishlist`: a number, a kind, then the name used in code.\",\n WRITE,\n ),\n define(\n \"GR1009\",\n \"structure\",\n \"error\",\n \"A step names an unknown kind\",\n \"Use one of: page, route, mail, notification, job, event, outside service, affects.\",\n WRITE,\n ),\n define(\n \"GR1010\",\n \"structure\",\n \"error\",\n \"Steps are not numbered 1, 2, 3 in order\",\n \"Number the steps from 1 without gaps, in the order a user meets them.\",\n WRITE,\n ),\n define(\n \"GR1011\",\n \"structure\",\n \"error\",\n \"A case line has the wrong form\",\n \"Write cases as `- double submit two taps save once`: the question, spaces, then the answer.\",\n WRITE,\n ),\n define(\n \"GR1012\",\n \"structure\",\n \"warning\",\n \"A case question is not answered\",\n \"Answer the question under Cases (or `does not apply` and why), or list it under Not handled.\",\n WRITE,\n ),\n define(\n \"GR1013\",\n \"structure\",\n \"error\",\n \"A criterion line has the wrong form\",\n \"Write criteria as `- AC-3 a guest is sent to sign in`, optionally `- AC-4 [mobile] …`.\",\n WRITE,\n ),\n define(\n \"GR1014\",\n \"structure\",\n \"error\",\n \"A criterion id is used twice in one flow\",\n \"Give the new criterion the next free number. Never renumber existing criteria.\",\n WRITE,\n ),\n define(\n \"GR1015\",\n \"structure\",\n \"error\",\n \"A changelog line has the wrong form\",\n \"Write entries as `- 2.1 fixed new-arrivals: what changed (AC-2)`.\",\n RECORD,\n ),\n define(\n \"GR1016\",\n \"structure\",\n \"error\",\n \"A changelog entry uses an unknown word\",\n \"Use one of: added, changed, fixed, removed.\",\n RECORD,\n ),\n define(\n \"GR1017\",\n \"structure\",\n \"error\",\n \"A changelog heading has the wrong form\",\n \"Use `## Unreleased`, or `## <release> (<yyyy-mm-dd>)` for entries of a release.\",\n RECORD,\n ),\n define(\n \"GR1018\",\n \"structure\",\n \"error\",\n \"A blocks table has the wrong form\",\n \"Use the columns Block, Flow, Who sees it, Changes with; one row per part of the page.\",\n APP,\n ),\n define(\n \"GR1019\",\n \"structure\",\n \"error\",\n \"An id does not match its folder or file name\",\n \"Make the front matter `id` (or `release`) equal the folder or file name.\",\n WRITE,\n ),\n define(\n \"GR1020\",\n \"structure\",\n \"warning\",\n \"A file in the grimoire folder is not part of the layout\",\n \"Move the file to where the layout expects it, or remove it.\",\n USE,\n ),\n define(\n \"GR1021\",\n \"structure\",\n \"error\",\n \"A feature, app, page or screen folder has no README.md\",\n \"Add README.md with the front matter of its template.\",\n WRITE,\n ),\n define(\n \"GR1022\",\n \"structure\",\n \"error\",\n \"Two files use the same id\",\n \"Give each feature, app or task its own id.\",\n WRITE,\n ),\n define(\n \"GR1023\",\n \"structure\",\n \"error\",\n \"A task file is misnamed or misplaced\",\n \"Name tasks `T-<n>-<slug>.md`, in `tasks/open/` or `tasks/done/<yyyy-mm>/`.\",\n RECORD,\n ),\n define(\n \"GR1024\",\n \"structure\",\n \"error\",\n \"The collected-list markers of a release file are broken\",\n \"Keep the start and end markers in pairs, or remove both and run `warlock grimoire release` again.\",\n RECORD,\n ),\n define(\n \"GR1025\",\n \"structure\",\n \"error\",\n \"A written file cannot be read\",\n \"Save the file as UTF-8 text.\",\n USE,\n ),\n define(\n \"GR1026\",\n \"structure\",\n \"error\",\n \"The feature README lists a flow that has no file\",\n \"Add `flows/<flow>.md`, or remove the flow from the README's Flows list.\",\n WRITE,\n ),\n define(\n \"GR1027\",\n \"structure\",\n \"warning\",\n \"A flow file is not listed in the feature README\",\n \"Add the flow to the README's Flows list.\",\n WRITE,\n ),\n define(\n \"GR1028\",\n \"structure\",\n \"error\",\n \"A list line has the wrong form\",\n \"Write list lines as `- name text`: the name, spaces, then the text.\",\n WRITE,\n ),\n\n // ── GR2xxx links ─────────────────────────────────────────────────────────\n define(\n \"GR2001\",\n \"links\",\n \"error\",\n \"A route step names a route that does not exist\",\n \"Fix the method and path in the flow, or add the route in code.\",\n RECORD,\n ),\n define(\n \"GR2002\",\n \"links\",\n \"error\",\n \"A page step names a page that does not exist\",\n \"Fix the route path in the flow, or add the page to one of the feature's apps. A step scoped like `page /support [web-admin]` looks only in that app.\",\n RECORD,\n ),\n define(\n \"GR2003\",\n \"links\",\n \"error\",\n \"A mail step names a mail that does not exist\",\n \"Use the mail's name as code defines it, or add the mail.\",\n RECORD,\n ),\n define(\n \"GR2004\",\n \"links\",\n \"error\",\n \"A notification step names a notification that does not exist\",\n \"Use the notification's name as code defines it, or add it.\",\n RECORD,\n ),\n define(\n \"GR2005\",\n \"links\",\n \"error\",\n \"A job step names a job that does not exist\",\n \"Use the job's name as code defines it, or add the job.\",\n RECORD,\n ),\n define(\n \"GR2006\",\n \"links\",\n \"error\",\n \"An event step names an event that does not exist\",\n \"Use the event's name as code emits it, or add the event.\",\n RECORD,\n ),\n define(\n \"GR2007\",\n \"links\",\n \"error\",\n \"An affects step names a feature or flow that does not exist\",\n \"Write `affects <feature>/<flow>` with an existing feature and flow.\",\n WRITE,\n ),\n define(\n \"GR2008\",\n \"links\",\n \"error\",\n \"A name refers to an app with no folder\",\n \"Add `grimoire/apps/<app>/README.md`, or fix the app id.\",\n APP,\n ),\n define(\n \"GR2009\",\n \"links\",\n \"warning\",\n \"A flow names an app its feature does not list\",\n \"Add the app to the feature's `apps`, or fix the app id in Differs by app or the criterion.\",\n WRITE,\n ),\n define(\n \"GR2010\",\n \"links\",\n \"error\",\n \"A changelog entry names a flow that does not exist\",\n \"Fix the flow id before the `:`, or add the flow.\",\n RECORD,\n ),\n define(\n \"GR2011\",\n \"links\",\n \"error\",\n \"A changelog entry names a criterion the flow does not have\",\n \"Fix the criterion id, or add the criterion to the flow.\",\n RECORD,\n ),\n define(\n \"GR2012\",\n \"links\",\n \"error\",\n \"A README relation names a flow that does not exist\",\n \"Fix the `<feature>/<flow>` reference in Affects and affected by.\",\n WRITE,\n ),\n\n // ── GR3xxx files ─────────────────────────────────────────────────────────\n define(\n \"GR3001\",\n \"files\",\n \"warning\",\n \"A source file has no header sentence\",\n \"Start the file with a one-sentence comment saying why it exists.\",\n FILE,\n ),\n define(\n \"GR3002\",\n \"files\",\n \"warning\",\n \"A source file belongs to no feature\",\n \"Add its folder to a feature's `folders`, or tag it `@feature <id>` in its header.\",\n FILE,\n ),\n define(\n \"GR3003\",\n \"files\",\n \"error\",\n \"A source file has two owners\",\n \"Keep one owner: remove the duplicate folder from one feature, or keep one `@feature` tag.\",\n FILE,\n ),\n define(\n \"GR3004\",\n \"files\",\n \"error\",\n \"A `@feature` tag names a feature that does not exist\",\n \"Fix the tag, or write the feature.\",\n FILE,\n ),\n define(\n \"GR3005\",\n \"files\",\n \"error\",\n \"A feature's `folders` entry does not exist\",\n \"Fix the folder or file path, or remove it from `folders`.\",\n WRITE,\n ),\n define(\n \"GR3006\",\n \"files\",\n \"warning\",\n \"A file in a feature's folders is reached by no flow\",\n \"Describe the behaviour in a flow, or delete dead code.\",\n RECORD,\n ),\n\n // ── GR4xxx tests ─────────────────────────────────────────────────────────\n define(\n \"GR4001\",\n \"tests\",\n \"warning\",\n \"A criterion has no test\",\n \"Write a test with `// @proves <feature>/<flow> AC-<n>` above it, or say in the task why not.\",\n RECORD,\n ),\n define(\n \"GR4002\",\n \"tests\",\n \"error\",\n \"A `@proves` line names a flow or criterion that does not exist\",\n \"Fix the `@proves` line to name an existing `<feature>/<flow> AC-<n>`.\",\n RECORD,\n ),\n define(\n \"GR4003\",\n \"tests\",\n \"error\",\n \"A `@proves` line has the wrong form\",\n \"Write `// @proves <feature>/<flow> AC-<n>` on its own line.\",\n RECORD,\n ),\n define(\n \"GR4004\",\n \"tests\",\n \"error\",\n \"A `@proves` line is not directly above a test\",\n \"Move the line right above the `it(…)` or `test(…)` it describes.\",\n RECORD,\n ),\n define(\n \"GR4005\",\n \"tests\",\n \"warning\",\n \"One test proves two criteria\",\n \"Split the test so each proves one criterion.\",\n RECORD,\n ),\n define(\n \"GR4006\",\n \"tests\",\n \"error\",\n \"A test proving a criterion failed in its last run\",\n \"Fix the code or the test, then run the tests again.\",\n RECORD,\n ),\n define(\n \"GR4007\",\n \"tests\",\n \"warning\",\n \"A criterion's test result is older than the test file\",\n \"Run the tests again.\",\n RECORD,\n ),\n define(\n \"GR4008\",\n \"tests\",\n \"warning\",\n \"A criterion's test did not run in the last run\",\n \"Run the tests that prove the criterion.\",\n RECORD,\n ),\n\n // ── GR5xxx apps ──────────────────────────────────────────────────────────\n define(\n \"GR5001\",\n \"apps\",\n \"error\",\n \"A block points to a flow that does not exist\",\n \"Fix the `<feature>/<flow>` in the Flow column or the block file.\",\n APP,\n ),\n define(\n \"GR5002\",\n \"apps\",\n \"error\",\n \"A condition is not declared in the app README\",\n \"Add the condition under Conditions in the app README, or use a declared one.\",\n APP,\n ),\n define(\n \"GR5003\",\n \"apps\",\n \"error\",\n \"A page's route does not exist in its site\",\n \"Fix the `route` of the page file, or remove the page file if the page is gone.\",\n APP,\n ),\n define(\n \"GR5004\",\n \"apps\",\n \"error\",\n \"A page names a layout with no file\",\n \"Add `layouts/<layout>.md` to the app, or fix the page's `layout`.\",\n APP,\n ),\n define(\n \"GR5005\",\n \"apps\",\n \"error\",\n \"An app's root matches no site or mobile app\",\n \"Set `root` to the site folder (`src/web/$sites/<site>`) or the mobile app folder.\",\n APP,\n ),\n define(\n \"GR5006\",\n \"apps\",\n \"error\",\n \"A screen's route does not exist in the mobile app\",\n \"Fix the `route` of the screen file, or remove it if the screen is gone.\",\n APP,\n ),\n define(\n \"GR5007\",\n \"apps\",\n \"warning\",\n \"A block file has no row in its page's Blocks table\",\n \"Add the block to the page's Blocks table, or remove the block file.\",\n APP,\n ),\n define(\n \"GR5008\",\n \"apps\",\n \"error\",\n \"An entry point in Also reached from does not exist\",\n \"Fix the mail, notification or page name.\",\n APP,\n ),\n define(\n \"GR5009\",\n \"apps\",\n \"warning\",\n \"A site or mobile app has no folder in grimoire/apps\",\n \"Add `grimoire/apps/<app>/README.md` for it.\",\n APP,\n ),\n\n // ── GR6xxx changelog ─────────────────────────────────────────────────────\n define(\n \"GR6001\",\n \"changelog\",\n \"error\",\n \"A release lists a changelog entry that is not stamped with it\",\n \"Move the entry under `## <release> (<date>)` in the feature's CHANGELOG.md.\",\n RECORD,\n ),\n define(\n \"GR6002\",\n \"changelog\",\n \"error\",\n \"A changelog release section has no release file\",\n \"Write `grimoire/releases/<release>.md`, or fix the release in the heading.\",\n RECORD,\n ),\n define(\n \"GR6003\",\n \"changelog\",\n \"error\",\n \"A changelog release date differs from the release file\",\n \"Use the date in the release file's front matter.\",\n RECORD,\n ),\n define(\n \"GR6004\",\n \"changelog\",\n \"error\",\n \"The README `updated` is older than the newest changelog entry\",\n \"Reshape the README to describe the feature as it is now, and set `updated`.\",\n RECORD,\n ),\n define(\n \"GR6005\",\n \"changelog\",\n \"error\",\n \"The README `version` differs from the newest changelog entry\",\n \"Set `version` to the newest entry's version.\",\n RECORD,\n ),\n define(\n \"GR6006\",\n \"changelog\",\n \"warning\",\n \"A changelog word does not match its version step\",\n \"Use a whole-number version for added and removed, a decimal for changed and fixed.\",\n RECORD,\n ),\n define(\n \"GR6007\",\n \"changelog\",\n \"error\",\n \"A flow's `since` is newer than its feature's version\",\n \"Fix `since`, or the feature `version`.\",\n WRITE,\n ),\n define(\n \"GR6008\",\n \"changelog\",\n \"warning\",\n \"A new whole-number version has no brief\",\n \"Write `versions/v<n>.md` before building it.\",\n WRITE,\n ),\n\n // ── GR7xxx tasks ─────────────────────────────────────────────────────────\n define(\n \"GR7001\",\n \"tasks\",\n \"error\",\n \"A task names a feature that does not exist\",\n \"Fix the task's `feature`, or write the feature first.\",\n WRITE,\n ),\n define(\n \"GR7002\",\n \"tasks\",\n \"error\",\n \"A task names a flow that does not exist\",\n \"Fix the task's `flow`, or write the flow first.\",\n WRITE,\n ),\n define(\n \"GR7003\",\n \"tasks\",\n \"error\",\n \"A task's status does not match its folder\",\n \"Done tasks live in `tasks/done/<yyyy-mm>/` with `status: done` and `shipped`; open tasks in `tasks/open/`.\",\n RECORD,\n ),\n define(\n \"GR7004\",\n \"tasks\",\n \"error\",\n \"A task's `shipped` names a version the changelog does not have\",\n \"Fix `shipped: <feature> <version>`, or add the changelog entry.\",\n RECORD,\n ),\n define(\n \"GR7005\",\n \"tasks\",\n \"warning\",\n \"A task's brief does not exist\",\n \"Fix the `Brief:` path, or write the brief.\",\n WRITE,\n ),\n\n // ── GR8xxx book ──────────────────────────────────────────────────────────\n define(\n \"GR8001\",\n \"book\",\n \"error\",\n \"The project's source files could not be read\",\n \"Read the message; fix the file or folder it names, then build again.\",\n USE,\n ),\n define(\n \"GR8002\",\n \"book\",\n \"warning\",\n \"Route facts could not be read because the app did not boot\",\n \"Run `warlock doctor`, fix what stops the app from booting, then `warlock grimoire build`.\",\n USE,\n ),\n define(\n \"GR8003\",\n \"book\",\n \"warning\",\n \"Route facts are older than the routes files\",\n \"Run `warlock grimoire build` to refresh them.\",\n USE,\n ),\n define(\n \"GR8004\",\n \"book\",\n \"warning\",\n \"Pages or screens could not be read\",\n \"Read the message; fix the page file it names, then build again.\",\n USE,\n ),\n\n // ── GR9xxx usage ─────────────────────────────────────────────────────────\n define(\n \"GR9001\",\n \"usage\",\n \"error\",\n \"The file is not in the book\",\n \"Pass a code file under the source roots, as a project-relative path.\",\n USE,\n ),\n define(\n \"GR9002\",\n \"usage\",\n \"error\",\n \"No route matches\",\n 'Pass `\"<METHOD> <path>\"` as the route is registered; `warlock routes` lists them.',\n USE,\n ),\n define(\n \"GR9003\",\n \"usage\",\n \"error\",\n \"No feature has that id\",\n \"Use an id from `grimoire/features/`.\",\n USE,\n ),\n define(\n \"GR9004\",\n \"usage\",\n \"error\",\n \"No flow has that id\",\n \"Use `<feature>/<flow>` with a file in `grimoire/features/<feature>/flows/`.\",\n USE,\n ),\n define(\n \"GR9005\",\n \"usage\",\n \"error\",\n \"The release file has no brief yet\",\n \"Write `grimoire/releases/<release>.md` with `release` and `date` front matter and the brief, then run the command again.\",\n RECORD,\n ),\n define(\n \"GR9006\",\n \"usage\",\n \"error\",\n \"A query argument has the wrong form\",\n \"Read the command's help (`warlock scry --help`) and pass the argument in that form.\",\n USE,\n ),\n] as const;\n\n/** One registered code, as a union. */\nexport type GrimoireCode = (typeof GRIMOIRE_CODE_LIST)[number][\"code\"];\n\n/** The catalog, keyed by code. */\nexport const GRIMOIRE_CODES: Readonly<Record<GrimoireCode, GrimoireCodeDefinition>> =\n Object.fromEntries(\n GRIMOIRE_CODE_LIST.map((definition) => [definition.code, definition]),\n ) as Record<GrimoireCode, GrimoireCodeDefinition>;\n"],"mappings":";AAwBA,SAAS,OACP,MACA,MACA,UACA,OACA,KACA,OACkD;CAClD,OAAO;EAAE;EAAM;EAAM;EAAU;EAAO;EAAK;CAAM;AACnD;AAEA,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,MAAM;;AAGZ,MAAa,qBAAqB;CAEhC,OACE,UACA,aACA,SACA,sCACA,2FACA,KACF;CACA,OACE,UACA,aACA,SACA,mCACA,sHACA,KACF;CACA,OACE,UACA,aACA,SACA,0CACA,yFACA,KACF;CACA,OACE,UACA,aACA,SACA,2CACA,iRACA,KACF;CACA,OACE,UACA,aACA,WACA,kDACA,mEACA,KACF;CACA,OACE,UACA,aACA,SACA,iCACA,qEACA,KACF;CACA,OACE,UACA,aACA,WACA,yCACA,6EACA,KACF;CACA,OACE,UACA,aACA,SACA,kCACA,6FACA,KACF;CACA,OACE,UACA,aACA,SACA,gCACA,sFACA,KACF;CACA,OACE,UACA,aACA,SACA,2CACA,yEACA,KACF;CACA,OACE,UACA,aACA,SACA,kCACA,iGACA,KACF;CACA,OACE,UACA,aACA,WACA,mCACA,gGACA,KACF;CACA,OACE,UACA,aACA,SACA,uCACA,8FACA,KACF;CACA,OACE,UACA,aACA,SACA,4CACA,kFACA,KACF;CACA,OACE,UACA,aACA,SACA,uCACA,wEACA,MACF;CACA,OACE,UACA,aACA,SACA,0CACA,+CACA,MACF;CACA,OACE,UACA,aACA,SACA,0CACA,mFACA,MACF;CACA,OACE,UACA,aACA,SACA,qCACA,yFACA,GACF;CACA,OACE,UACA,aACA,SACA,gDACA,4EACA,KACF;CACA,OACE,UACA,aACA,WACA,2DACA,+DACA,GACF;CACA,OACE,UACA,aACA,SACA,0DACA,wDACA,KACF;CACA,OACE,UACA,aACA,SACA,6BACA,8CACA,KACF;CACA,OACE,UACA,aACA,SACA,wCACA,8EACA,MACF;CACA,OACE,UACA,aACA,SACA,2DACA,qGACA,MACF;CACA,OACE,UACA,aACA,SACA,iCACA,gCACA,GACF;CACA,OACE,UACA,aACA,SACA,oDACA,2EACA,KACF;CACA,OACE,UACA,aACA,WACA,mDACA,4CACA,KACF;CACA,OACE,UACA,aACA,SACA,kCACA,yEACA,KACF;CAGA,OACE,UACA,SACA,SACA,kDACA,kEACA,MACF;CACA,OACE,UACA,SACA,SACA,gDACA,wJACA,MACF;CACA,OACE,UACA,SACA,SACA,gDACA,4DACA,MACF;CACA,OACE,UACA,SACA,SACA,gEACA,8DACA,MACF;CACA,OACE,UACA,SACA,SACA,8CACA,0DACA,MACF;CACA,OACE,UACA,SACA,SACA,oDACA,4DACA,MACF;CACA,OACE,UACA,SACA,SACA,+DACA,yEACA,KACF;CACA,OACE,UACA,SACA,SACA,0CACA,2DACA,GACF;CACA,OACE,UACA,SACA,WACA,iDACA,8FACA,KACF;CACA,OACE,UACA,SACA,SACA,sDACA,oDACA,MACF;CACA,OACE,UACA,SACA,SACA,8DACA,2DACA,MACF;CACA,OACE,UACA,SACA,SACA,sDACA,oEACA,KACF;CAGA,OACE,UACA,SACA,WACA,wCACA,oEACA,IACF;CACA,OACE,UACA,SACA,WACA,uCACA,qFACA,IACF;CACA,OACE,UACA,SACA,SACA,gCACA,6FACA,IACF;CACA,OACE,UACA,SACA,SACA,wDACA,sCACA,IACF;CACA,OACE,UACA,SACA,SACA,8CACA,6DACA,KACF;CACA,OACE,UACA,SACA,WACA,uDACA,0DACA,MACF;CAGA,OACE,UACA,SACA,WACA,2BACA,gGACA,MACF;CACA,OACE,UACA,SACA,SACA,kEACA,yEACA,MACF;CACA,OACE,UACA,SACA,SACA,uCACA,+DACA,MACF;CACA,OACE,UACA,SACA,SACA,iDACA,oEACA,MACF;CACA,OACE,UACA,SACA,WACA,gCACA,gDACA,MACF;CACA,OACE,UACA,SACA,SACA,qDACA,uDACA,MACF;CACA,OACE,UACA,SACA,WACA,yDACA,wBACA,MACF;CACA,OACE,UACA,SACA,WACA,kDACA,2CACA,MACF;CAGA,OACE,UACA,QACA,SACA,gDACA,oEACA,GACF;CACA,OACE,UACA,QACA,SACA,iDACA,gFACA,GACF;CACA,OACE,UACA,QACA,SACA,6CACA,kFACA,GACF;CACA,OACE,UACA,QACA,SACA,sCACA,qEACA,GACF;CACA,OACE,UACA,QACA,SACA,+CACA,qFACA,GACF;CACA,OACE,UACA,QACA,SACA,qDACA,2EACA,GACF;CACA,OACE,UACA,QACA,WACA,sDACA,uEACA,GACF;CACA,OACE,UACA,QACA,SACA,sDACA,4CACA,GACF;CACA,OACE,UACA,QACA,WACA,uDACA,+CACA,GACF;CAGA,OACE,UACA,aACA,SACA,iEACA,+EACA,MACF;CACA,OACE,UACA,aACA,SACA,mDACA,8EACA,MACF;CACA,OACE,UACA,aACA,SACA,0DACA,oDACA,MACF;CACA,OACE,UACA,aACA,SACA,iEACA,+EACA,MACF;CACA,OACE,UACA,aACA,SACA,gEACA,gDACA,MACF;CACA,OACE,UACA,aACA,WACA,oDACA,sFACA,MACF;CACA,OACE,UACA,aACA,SACA,wDACA,0CACA,KACF;CACA,OACE,UACA,aACA,WACA,2CACA,gDACA,KACF;CAGA,OACE,UACA,SACA,SACA,8CACA,yDACA,KACF;CACA,OACE,UACA,SACA,SACA,2CACA,mDACA,KACF;CACA,OACE,UACA,SACA,SACA,6CACA,8GACA,MACF;CACA,OACE,UACA,SACA,SACA,kEACA,mEACA,MACF;CACA,OACE,UACA,SACA,WACA,iCACA,8CACA,KACF;CAGA,OACE,UACA,QACA,SACA,gDACA,wEACA,GACF;CACA,OACE,UACA,QACA,WACA,8DACA,6FACA,GACF;CACA,OACE,UACA,QACA,WACA,+CACA,iDACA,GACF;CACA,OACE,UACA,QACA,WACA,sCACA,mEACA,GACF;CAGA,OACE,UACA,SACA,SACA,+BACA,wEACA,GACF;CACA,OACE,UACA,SACA,SACA,oBACA,uFACA,GACF;CACA,OACE,UACA,SACA,SACA,0BACA,wCACA,GACF;CACA,OACE,UACA,SACA,SACA,uBACA,+EACA,GACF;CACA,OACE,UACA,SACA,SACA,qCACA,4HACA,MACF;CACA,OACE,UACA,SACA,SACA,uCACA,uFACA,GACF;AACF;;AAMA,MAAa,iBACX,OAAO,YACL,mBAAmB,KAAK,eAAe,CAAC,WAAW,MAAM,UAAU,CAAC,CACtE"}