@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,98 @@
1
+ import { checkApps } from "../apps/check-apps.mjs";
2
+ import "../apps/index.mjs";
3
+ import { checkTestResults } from "../test-results/index.mjs";
4
+ import { checkReleases } from "../releases/index.mjs";
5
+ import { checkTasks } from "../tasks/index.mjs";
6
+ import { checkBookNotes } from "./rules/book-notes.mjs";
7
+ import { checkCriteriaTests, checkProofTargets } from "./rules/criteria.mjs";
8
+ import { checkAppNames, checkChangelogLinks, checkRelations, checkSteps } from "./rules/links.mjs";
9
+ import { checkFolders, checkHeaders, checkOwners, checkUnreached } from "./rules/source-files.mjs";
10
+ import { checkChangeWords, checkFlowVersions, checkReadmeDates } from "./rules/versions.mjs";
11
+
12
+ //#region ../../packages/grimoire/src/check/check-grimoire.ts
13
+ /** The check's own rules, in report order before sorting. */
14
+ const CHECK_RULES = [
15
+ checkSteps,
16
+ checkAppNames,
17
+ checkChangelogLinks,
18
+ checkRelations,
19
+ checkHeaders,
20
+ checkOwners,
21
+ checkFolders,
22
+ checkUnreached,
23
+ checkCriteriaTests,
24
+ checkProofTargets,
25
+ checkReadmeDates,
26
+ checkChangeWords,
27
+ checkFlowVersions
28
+ ];
29
+ /** Run every rule over a snapshot. Pure; never writes. */
30
+ function checkGrimoire(snapshot) {
31
+ return finishReport(snapshot, [
32
+ ...snapshot.structure,
33
+ ...snapshot.proofFindings,
34
+ ...CHECK_RULES.flatMap((rule) => rule(snapshot)),
35
+ ...checkApps(snapshot),
36
+ ...checkReleases(snapshot),
37
+ ...checkTasks(snapshot),
38
+ ...checkTestResults(snapshot),
39
+ ...checkBookNotes(snapshot)
40
+ ]);
41
+ }
42
+ /**
43
+ * Mark the findings on proposed features and flows as expected, sort them
44
+ * and count them. The findings of the snapshot are copied, never changed.
45
+ */
46
+ function finishReport(snapshot, findings) {
47
+ const proposed = proposedWork(snapshot);
48
+ const marked = findings.map((finding) => ({
49
+ ...finding,
50
+ expected: finding.expected || isProposed(finding, proposed)
51
+ })).sort(compareFindings);
52
+ const unexpected = marked.filter((finding) => !finding.expected);
53
+ const errors = unexpected.filter((finding) => finding.severity === "error").length;
54
+ return {
55
+ schemaVersion: 1,
56
+ root: snapshot.root,
57
+ findings: marked,
58
+ counts: {
59
+ errors,
60
+ warnings: unexpected.length - errors,
61
+ expected: marked.length - unexpected.length
62
+ },
63
+ ok: errors === 0,
64
+ routes: snapshot.routes
65
+ };
66
+ }
67
+ /** Feature ids and `<feature>/<flow>` refs whose status is `proposed`. */
68
+ function proposedWork(snapshot) {
69
+ const proposed = /* @__PURE__ */ new Set();
70
+ for (const feature of snapshot.written.features) {
71
+ if (feature.readme?.status.value === "proposed") proposed.add(feature.id);
72
+ for (const flow of feature.flows) if (flow.status.value === "proposed") proposed.add(flow.ref);
73
+ }
74
+ return proposed;
75
+ }
76
+ function isProposed(finding, proposed) {
77
+ const { feature, flow } = finding.subject;
78
+ return [
79
+ feature,
80
+ flow,
81
+ flow?.split("/")[0] ?? null
82
+ ].some((id) => id !== null && proposed.has(id));
83
+ }
84
+ /** Unexpected findings first, then expected; within each, errors before warnings, then by file, line and code. */
85
+ function compareFindings(left, right) {
86
+ return Number(left.expected) - Number(right.expected) || severityRank(left) - severityRank(right) || compareText(left.at?.file ?? left.subject.file ?? "", right.at?.file ?? right.subject.file ?? "") || (left.at?.line ?? 0) - (right.at?.line ?? 0) || compareText(left.code, right.code) || compareText(left.message, right.message);
87
+ }
88
+ function severityRank(finding) {
89
+ return finding.severity === "error" ? 0 : 1;
90
+ }
91
+ /** Locale-free comparison, so the order is the same on every machine. */
92
+ function compareText(left, right) {
93
+ return left < right ? -1 : left > right ? 1 : 0;
94
+ }
95
+
96
+ //#endregion
97
+ export { CHECK_RULES, checkGrimoire, finishReport };
98
+ //# sourceMappingURL=check-grimoire.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-grimoire.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/check/check-grimoire.ts"],"sourcesContent":["import { checkApps } from \"../apps\";\nimport type { GrimoireCheckReport, GrimoireFinding } from \"../contracts/findings\";\nimport type { GrimoireRule, GrimoireSnapshot } from \"../contracts/snapshot\";\nimport { checkReleases } from \"../releases\";\nimport { checkTasks } from \"../tasks\";\nimport { checkTestResults } from \"../test-results\";\nimport { checkBookNotes } from \"./rules/book-notes\";\nimport { checkCriteriaTests, checkProofTargets } from \"./rules/criteria\";\nimport { checkAppNames, checkChangelogLinks, checkRelations, checkSteps } from \"./rules/links\";\nimport { checkFolders, checkHeaders, checkOwners, checkUnreached } from \"./rules/source-files\";\nimport { checkChangeWords, checkFlowVersions, checkReadmeDates } from \"./rules/versions\";\n\n/** The check's own rules, in report order before sorting. */\nexport const CHECK_RULES: readonly GrimoireRule[] = [\n checkSteps,\n checkAppNames,\n checkChangelogLinks,\n checkRelations,\n checkHeaders,\n checkOwners,\n checkFolders,\n checkUnreached,\n checkCriteriaTests,\n checkProofTargets,\n checkReadmeDates,\n checkChangeWords,\n checkFlowVersions,\n];\n\n/** Run every rule over a snapshot. Pure; never writes. */\nexport function checkGrimoire(snapshot: GrimoireSnapshot): GrimoireCheckReport {\n const findings = [\n ...snapshot.structure,\n ...snapshot.proofFindings,\n ...CHECK_RULES.flatMap((rule) => rule(snapshot)),\n ...checkApps(snapshot),\n ...checkReleases(snapshot),\n ...checkTasks(snapshot),\n ...checkTestResults(snapshot),\n ...checkBookNotes(snapshot),\n ];\n\n return finishReport(snapshot, findings);\n}\n\n/**\n * Mark the findings on proposed features and flows as expected, sort them\n * and count them. The findings of the snapshot are copied, never changed.\n */\nexport function finishReport(\n snapshot: GrimoireSnapshot,\n findings: readonly GrimoireFinding[],\n): GrimoireCheckReport {\n const proposed = proposedWork(snapshot);\n const marked = findings\n .map((finding) => ({ ...finding, expected: finding.expected || isProposed(finding, proposed) }))\n .sort(compareFindings);\n const unexpected = marked.filter((finding) => !finding.expected);\n const errors = unexpected.filter((finding) => finding.severity === \"error\").length;\n\n return {\n schemaVersion: 1,\n root: snapshot.root,\n findings: marked,\n counts: {\n errors,\n warnings: unexpected.length - errors,\n expected: marked.length - unexpected.length,\n },\n ok: errors === 0,\n routes: snapshot.routes,\n };\n}\n\n/** Feature ids and `<feature>/<flow>` refs whose status is `proposed`. */\nfunction proposedWork(snapshot: GrimoireSnapshot): Set<string> {\n const proposed = new Set<string>();\n\n for (const feature of snapshot.written.features) {\n if (feature.readme?.status.value === \"proposed\") proposed.add(feature.id);\n\n for (const flow of feature.flows) {\n if (flow.status.value === \"proposed\") proposed.add(flow.ref);\n }\n }\n\n return proposed;\n}\n\nfunction isProposed(finding: GrimoireFinding, proposed: ReadonlySet<string>): boolean {\n const { feature, flow } = finding.subject;\n const flowFeature = flow?.split(\"/\")[0] ?? null;\n\n return [feature, flow, flowFeature].some((id) => id !== null && proposed.has(id));\n}\n\n/** Unexpected findings first, then expected; within each, errors before warnings, then by file, line and code. */\nfunction compareFindings(left: GrimoireFinding, right: GrimoireFinding): number {\n return (\n Number(left.expected) - Number(right.expected) ||\n severityRank(left) - severityRank(right) ||\n compareText(\n left.at?.file ?? left.subject.file ?? \"\",\n right.at?.file ?? right.subject.file ?? \"\",\n ) ||\n (left.at?.line ?? 0) - (right.at?.line ?? 0) ||\n compareText(left.code, right.code) ||\n compareText(left.message, right.message)\n );\n}\n\nfunction severityRank(finding: GrimoireFinding): number {\n return finding.severity === \"error\" ? 0 : 1;\n}\n\n/** Locale-free comparison, so the order is the same on every machine. */\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,cAAuC;CAClD;C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;EAFG,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM;CAET,CAAC,CAAC,MAAM,OAAO,OAAO,QAAQ,SAAS,IAAI,EAAE,CAAC;AAClF;;AAGA,SAAS,gBAAgB,MAAuB,OAAgC;CAC9E,OACE,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,QAAQ,KAC7C,aAAa,IAAI,IAAI,aAAa,KAAK,KACvC,YACE,KAAK,IAAI,QAAQ,KAAK,QAAQ,QAAQ,IACtC,MAAM,IAAI,QAAQ,MAAM,QAAQ,QAAQ,EAC1C,MACC,KAAK,IAAI,QAAQ,MAAM,MAAM,IAAI,QAAQ,MAC1C,YAAY,KAAK,MAAM,MAAM,IAAI,KACjC,YAAY,KAAK,SAAS,MAAM,OAAO;AAE3C;AAEA,SAAS,aAAa,SAAkC;CACtD,OAAO,QAAQ,aAAa,UAAU,IAAI;AAC5C;;AAGA,SAAS,YAAY,MAAc,OAAuB;CACxD,OAAO,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI;AAChD"}
@@ -0,0 +1,20 @@
1
+ import { GrimoireCheckReport } from "../contracts/findings.mjs";
2
+ //#region ../../packages/grimoire/src/check/format-check-report.d.ts
3
+ /** What the text formatter may be told. */
4
+ export type FormatCheckOptions = {
5
+ /** List every finding, not only the first few warnings of each code. */
6
+ all?: boolean;
7
+ };
8
+ /**
9
+ * The compact text of a report: one line per finding,
10
+ * `<file>:<line> <code> <severity> <message>[ (expected)]` (`-` when the
11
+ * finding has no location), ` fix: <hint>` under each unexpected error, and
12
+ * a last line with the counts and the route freshness.
13
+ *
14
+ * Errors always print in full. Warnings of a code that has more than five
15
+ * findings print the first five, then a line with the count of the rest and a
16
+ * last hint to run with `--all`. `options.all` prints every finding.
17
+ */
18
+ export declare function formatCheckReport(report: GrimoireCheckReport, options?: FormatCheckOptions): string[];
19
+ //#endregion
20
+ //# sourceMappingURL=format-check-report.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-check-report.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/check/format-check-report.ts"],"mappings":";;;YAMY;;EAEV;;;;;;;;;;;;wBAac,kBACd,QAAQ,qBACR,UAAS"}
@@ -0,0 +1,55 @@
1
+ //#region ../../packages/grimoire/src/check/format-check-report.ts
2
+ /** Warnings of one code shown before the rest are counted ("… and N more"). */
3
+ const EXAMPLES_PER_CODE = 5;
4
+ /**
5
+ * The compact text of a report: one line per finding,
6
+ * `<file>:<line> <code> <severity> <message>[ (expected)]` (`-` when the
7
+ * finding has no location), ` fix: <hint>` under each unexpected error, and
8
+ * a last line with the counts and the route freshness.
9
+ *
10
+ * Errors always print in full. Warnings of a code that has more than five
11
+ * findings print the first five, then a line with the count of the rest and a
12
+ * last hint to run with `--all`. `options.all` prints every finding.
13
+ */
14
+ function formatCheckReport(report, options = {}) {
15
+ const lines = [];
16
+ const perCode = /* @__PURE__ */ new Map();
17
+ const shown = /* @__PURE__ */ new Map();
18
+ let hidden = 0;
19
+ for (const finding of report.findings) if (finding.severity !== "error") perCode.set(finding.code, (perCode.get(finding.code) ?? 0) + 1);
20
+ for (const finding of report.findings) {
21
+ if (finding.severity !== "error" && options.all !== true) {
22
+ const total = perCode.get(finding.code) ?? 0;
23
+ const count = (shown.get(finding.code) ?? 0) + 1;
24
+ shown.set(finding.code, count);
25
+ if (total > EXAMPLES_PER_CODE && count > EXAMPLES_PER_CODE) {
26
+ hidden++;
27
+ continue;
28
+ }
29
+ }
30
+ lines.push([
31
+ location(finding),
32
+ finding.code,
33
+ finding.severity,
34
+ finding.message,
35
+ ...finding.expected ? ["(expected)"] : []
36
+ ].join(" "));
37
+ if (finding.severity === "error" && !finding.expected) lines.push(` fix: ${finding.hint}`);
38
+ const total = perCode.get(finding.code) ?? 0;
39
+ if (finding.severity !== "error" && options.all !== true && total > EXAMPLES_PER_CODE && shown.get(finding.code) === EXAMPLES_PER_CODE) lines.push(` … ${finding.code}: ${total} findings in all, ${total - EXAMPLES_PER_CODE} not shown`);
40
+ }
41
+ const { errors, warnings, expected } = report.counts;
42
+ if (hidden > 0) lines.push(`${plural(hidden, "finding")} not listed; run with --all to list every finding.`);
43
+ lines.push(`${plural(errors, "error")}, ${plural(warnings, "warning")}, ${expected} expected (routes: ${report.routes})`);
44
+ return lines;
45
+ }
46
+ function location(finding) {
47
+ return finding.at ? `${finding.at.file}:${finding.at.line}` : "-";
48
+ }
49
+ function plural(count, word) {
50
+ return `${count} ${word}${count === 1 ? "" : "s"}`;
51
+ }
52
+
53
+ //#endregion
54
+ export { formatCheckReport };
55
+ //# sourceMappingURL=format-check-report.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-check-report.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/check/format-check-report.ts"],"sourcesContent":["import type { GrimoireCheckReport, GrimoireFinding } from \"../contracts/findings\";\n\n/** Warnings of one code shown before the rest are counted (\"… and N more\"). */\nconst EXAMPLES_PER_CODE = 5;\n\n/** What the text formatter may be told. */\nexport type FormatCheckOptions = {\n /** List every finding, not only the first few warnings of each code. */\n all?: boolean;\n};\n\n/**\n * The compact text of a report: one line per finding,\n * `<file>:<line> <code> <severity> <message>[ (expected)]` (`-` when the\n * finding has no location), ` fix: <hint>` under each unexpected error, and\n * a last line with the counts and the route freshness.\n *\n * Errors always print in full. Warnings of a code that has more than five\n * findings print the first five, then a line with the count of the rest and a\n * last hint to run with `--all`. `options.all` prints every finding.\n */\nexport function formatCheckReport(\n report: GrimoireCheckReport,\n options: FormatCheckOptions = {},\n): string[] {\n const lines: string[] = [];\n const perCode = new Map<string, number>();\n const shown = new Map<string, number>();\n let hidden = 0;\n\n for (const finding of report.findings) {\n if (finding.severity !== \"error\") {\n perCode.set(finding.code, (perCode.get(finding.code) ?? 0) + 1);\n }\n }\n\n for (const finding of report.findings) {\n if (finding.severity !== \"error\" && options.all !== true) {\n const total = perCode.get(finding.code) ?? 0;\n const count = (shown.get(finding.code) ?? 0) + 1;\n\n shown.set(finding.code, count);\n\n if (total > EXAMPLES_PER_CODE && count > EXAMPLES_PER_CODE) {\n hidden++;\n\n continue;\n }\n }\n\n lines.push(\n [\n location(finding),\n finding.code,\n finding.severity,\n finding.message,\n ...(finding.expected ? [\"(expected)\"] : []),\n ].join(\" \"),\n );\n\n if (finding.severity === \"error\" && !finding.expected) lines.push(` fix: ${finding.hint}`);\n\n const total = perCode.get(finding.code) ?? 0;\n\n if (\n finding.severity !== \"error\" &&\n options.all !== true &&\n total > EXAMPLES_PER_CODE &&\n shown.get(finding.code) === EXAMPLES_PER_CODE\n ) {\n lines.push(\n ` … ${finding.code}: ${total} findings in all, ${total - EXAMPLES_PER_CODE} not shown`,\n );\n }\n }\n\n const { errors, warnings, expected } = report.counts;\n\n if (hidden > 0)\n lines.push(`${plural(hidden, \"finding\")} not listed; run with --all to list every finding.`);\n\n lines.push(\n `${plural(errors, \"error\")}, ${plural(warnings, \"warning\")}, ${expected} expected (routes: ${report.routes})`,\n );\n\n return lines;\n}\n\nfunction location(finding: GrimoireFinding): string {\n return finding.at ? `${finding.at.file}:${finding.at.line}` : \"-\";\n}\n\nfunction plural(count: number, word: string): string {\n return `${count} ${word}${count === 1 ? \"\" : \"s\"}`;\n}\n"],"mappings":";;AAGA,MAAM,oBAAoB;;;;;;;;;;;AAkB1B,SAAgB,kBACd,QACA,UAA8B,CAAC,GACrB;CACV,MAAM,QAAkB,CAAC;CACzB,MAAM,0BAAU,IAAI,IAAoB;CACxC,MAAM,wBAAQ,IAAI,IAAoB;CACtC,IAAI,SAAS;CAEb,KAAK,MAAM,WAAW,OAAO,UAC3B,IAAI,QAAQ,aAAa,SACvB,QAAQ,IAAI,QAAQ,OAAO,QAAQ,IAAI,QAAQ,IAAI,KAAK,KAAK,CAAC;CAIlE,KAAK,MAAM,WAAW,OAAO,UAAU;EACrC,IAAI,QAAQ,aAAa,WAAW,QAAQ,QAAQ,MAAM;GACxD,MAAM,QAAQ,QAAQ,IAAI,QAAQ,IAAI,KAAK;GAC3C,MAAM,SAAS,MAAM,IAAI,QAAQ,IAAI,KAAK,KAAK;GAE/C,MAAM,IAAI,QAAQ,MAAM,KAAK;GAE7B,IAAI,QAAQ,qBAAqB,QAAQ,mBAAmB;IAC1D;IAEA;GACF;EACF;EAEA,MAAM,KACJ;GACE,SAAS,OAAO;GAChB,QAAQ;GACR,QAAQ;GACR,QAAQ;GACR,GAAI,QAAQ,WAAW,CAAC,YAAY,IAAI,CAAC;EAC3C,CAAC,CAAC,KAAK,IAAI,CACb;EAEA,IAAI,QAAQ,aAAa,WAAW,CAAC,QAAQ,UAAU,MAAM,KAAK,YAAY,QAAQ,MAAM;EAE5F,MAAM,QAAQ,QAAQ,IAAI,QAAQ,IAAI,KAAK;EAE3C,IACE,QAAQ,aAAa,WACrB,QAAQ,QAAQ,QAChB,QAAQ,qBACR,MAAM,IAAI,QAAQ,IAAI,MAAM,mBAE5B,MAAM,KACJ,SAAS,QAAQ,KAAK,IAAI,MAAM,oBAAoB,QAAQ,kBAAkB,WAChF;CAEJ;CAEA,MAAM,EAAE,QAAQ,UAAU,aAAa,OAAO;CAE9C,IAAI,SAAS,GACX,MAAM,KAAK,GAAG,OAAO,QAAQ,SAAS,EAAE,mDAAmD;CAE7F,MAAM,KACJ,GAAG,OAAO,QAAQ,OAAO,EAAE,IAAI,OAAO,UAAU,SAAS,EAAE,IAAI,SAAS,sBAAsB,OAAO,OAAO,EAC9G;CAEA,OAAO;AACT;AAEA,SAAS,SAAS,SAAkC;CAClD,OAAO,QAAQ,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS;AAChE;AAEA,SAAS,OAAO,OAAe,MAAsB;CACnD,OAAO,GAAG,MAAM,GAAG,OAAO,UAAU,IAAI,KAAK;AAC/C"}
@@ -0,0 +1,4 @@
1
+ import { checkGrimoire } from "./check-grimoire.mjs";
2
+ import { formatCheckReport } from "./format-check-report.mjs";
3
+
4
+ export { checkGrimoire, formatCheckReport };
@@ -0,0 +1,18 @@
1
+ import { createFinding } from "../../codes/index.mjs";
2
+
3
+ //#region ../../packages/grimoire/src/check/rules/book-notes.ts
4
+ /**
5
+ * GR8003: notes about the book the check read.
6
+ */
7
+ /** GR8003: route steps were checked against cached route facts whose inputs changed. */
8
+ function checkBookNotes(snapshot) {
9
+ if (snapshot.routes !== "stale") return [];
10
+ return [createFinding({
11
+ code: "GR8003",
12
+ message: "route facts are stale; route steps were checked against the cached routes"
13
+ })];
14
+ }
15
+
16
+ //#endregion
17
+ export { checkBookNotes };
18
+ //# sourceMappingURL=book-notes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"book-notes.mjs","names":[],"sources":["../../../../../../../../../packages/grimoire/src/check/rules/book-notes.ts"],"sourcesContent":["/**\n * GR8003: notes about the book the check read.\n */\nimport { createFinding } from \"../../codes\";\nimport type { GrimoireFinding } from \"../../contracts/findings\";\nimport type { GrimoireSnapshot } from \"../../contracts/snapshot\";\n\n/** GR8003: route steps were checked against cached route facts whose inputs changed. */\nexport function checkBookNotes(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n if (snapshot.routes !== \"stale\") return [];\n\n return [\n createFinding({\n code: \"GR8003\",\n message: \"route facts are stale; route steps were checked against the cached routes\",\n }),\n ];\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,eAAe,UAA+C;CAC5E,IAAI,SAAS,WAAW,SAAS,OAAO,CAAC;CAEzC,OAAO,CACL,cAAc;EACZ,MAAM;EACN,SAAS;CACX,CAAC,CACH;AACF"}
@@ -0,0 +1,48 @@
1
+ import { createFinding } from "../../codes/index.mjs";
2
+ import { isRetired, writtenLookup } from "./lookup.mjs";
3
+
4
+ //#region ../../packages/grimoire/src/check/rules/criteria.ts
5
+ /**
6
+ * GR4001–GR4002: criteria and the `@proves` lines that name them.
7
+ */
8
+ /** GR4001: a criterion of a flow (not retired) that no `@proves` line names. */
9
+ function checkCriteriaTests(snapshot) {
10
+ const proven = new Set(snapshot.proofs.map((proof) => `${proof.ref} ${proof.criterion}`));
11
+ const findings = [];
12
+ for (const feature of snapshot.written.features) for (const flow of feature.flows) {
13
+ if (isRetired(feature, flow)) continue;
14
+ for (const criterion of flow.criteria) {
15
+ if (proven.has(`${flow.ref} ${criterion.id}`)) continue;
16
+ findings.push(createFinding({
17
+ code: "GR4001",
18
+ message: `${flow.ref} ${criterion.id} has no test`,
19
+ at: criterion.at,
20
+ feature: feature.id,
21
+ flow: flow.ref
22
+ }));
23
+ }
24
+ }
25
+ return findings;
26
+ }
27
+ /** GR4002: a `@proves` line naming a flow or criterion that does not exist. */
28
+ function checkProofTargets(snapshot) {
29
+ const { flows } = writtenLookup(snapshot);
30
+ const findings = [];
31
+ for (const proof of snapshot.proofs) {
32
+ const flow = flows.get(proof.ref);
33
+ const missing = !flow ? `no flow ${proof.ref}` : flow.criteria.some((criterion) => criterion.id === proof.criterion) ? null : `no ${proof.criterion} in ${proof.ref}`;
34
+ if (missing === null) continue;
35
+ findings.push(createFinding({
36
+ code: "GR4002",
37
+ message: `"@proves ${proof.ref} ${proof.criterion}" names ${missing}`,
38
+ at: proof.at,
39
+ feature: proof.feature,
40
+ flow: proof.ref
41
+ }));
42
+ }
43
+ return findings;
44
+ }
45
+
46
+ //#endregion
47
+ export { checkCriteriaTests, checkProofTargets };
48
+ //# sourceMappingURL=criteria.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"criteria.mjs","names":[],"sources":["../../../../../../../../../packages/grimoire/src/check/rules/criteria.ts"],"sourcesContent":["/**\n * GR4001–GR4002: criteria and the `@proves` lines that name them.\n */\nimport { createFinding } from \"../../codes\";\nimport type { GrimoireFinding } from \"../../contracts/findings\";\nimport type { GrimoireSnapshot } from \"../../contracts/snapshot\";\nimport { isRetired, writtenLookup } from \"./lookup\";\n\n/** GR4001: a criterion of a flow (not retired) that no `@proves` line names. */\nexport function checkCriteriaTests(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const proven = new Set(snapshot.proofs.map((proof) => `${proof.ref} ${proof.criterion}`));\n const findings: GrimoireFinding[] = [];\n\n for (const feature of snapshot.written.features) {\n for (const flow of feature.flows) {\n if (isRetired(feature, flow)) continue;\n\n for (const criterion of flow.criteria) {\n if (proven.has(`${flow.ref} ${criterion.id}`)) continue;\n\n findings.push(\n createFinding({\n code: \"GR4001\",\n message: `${flow.ref} ${criterion.id} has no test`,\n at: criterion.at,\n feature: feature.id,\n flow: flow.ref,\n }),\n );\n }\n }\n }\n\n return findings;\n}\n\n/** GR4002: a `@proves` line naming a flow or criterion that does not exist. */\nexport function checkProofTargets(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const { flows } = writtenLookup(snapshot);\n const findings: GrimoireFinding[] = [];\n\n for (const proof of snapshot.proofs) {\n const flow = flows.get(proof.ref);\n const missing = !flow\n ? `no flow ${proof.ref}`\n : flow.criteria.some((criterion) => criterion.id === proof.criterion)\n ? null\n : `no ${proof.criterion} in ${proof.ref}`;\n\n if (missing === null) continue;\n\n findings.push(\n createFinding({\n code: \"GR4002\",\n message: `\"@proves ${proof.ref} ${proof.criterion}\" names ${missing}`,\n at: proof.at,\n feature: proof.feature,\n flow: proof.ref,\n }),\n );\n }\n\n return findings;\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,mBAAmB,UAA+C;CAChF,MAAM,SAAS,IAAI,IAAI,SAAS,OAAO,KAAK,UAAU,GAAG,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;CACxF,MAAM,WAA8B,CAAC;CAErC,KAAK,MAAM,WAAW,SAAS,QAAQ,UACrC,KAAK,MAAM,QAAQ,QAAQ,OAAO;EAChC,IAAI,UAAU,SAAS,IAAI,GAAG;EAE9B,KAAK,MAAM,aAAa,KAAK,UAAU;GACrC,IAAI,OAAO,IAAI,GAAG,KAAK,IAAI,GAAG,UAAU,IAAI,GAAG;GAE/C,SAAS,KACP,cAAc;IACZ,MAAM;IACN,SAAS,GAAG,KAAK,IAAI,GAAG,UAAU,GAAG;IACrC,IAAI,UAAU;IACd,SAAS,QAAQ;IACjB,MAAM,KAAK;GACb,CAAC,CACH;EACF;CACF;CAGF,OAAO;AACT;;AAGA,SAAgB,kBAAkB,UAA+C;CAC/E,MAAM,EAAE,UAAU,cAAc,QAAQ;CACxC,MAAM,WAA8B,CAAC;CAErC,KAAK,MAAM,SAAS,SAAS,QAAQ;EACnC,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG;EAChC,MAAM,UAAU,CAAC,OACb,WAAW,MAAM,QACjB,KAAK,SAAS,MAAM,cAAc,UAAU,OAAO,MAAM,SAAS,IAChE,OACA,MAAM,MAAM,UAAU,MAAM,MAAM;EAExC,IAAI,YAAY,MAAM;EAEtB,SAAS,KACP,cAAc;GACZ,MAAM;GACN,SAAS,YAAY,MAAM,IAAI,GAAG,MAAM,UAAU,UAAU;GAC5D,IAAI,MAAM;GACV,SAAS,MAAM;GACf,MAAM,MAAM;EACd,CAAC,CACH;CACF;CAEA,OAAO;AACT"}
@@ -0,0 +1,196 @@
1
+ import { createFinding } from "../../codes/index.mjs";
2
+ import { isRetired, writtenLookup } from "./lookup.mjs";
3
+
4
+ //#region ../../packages/grimoire/src/check/rules/links.ts
5
+ /**
6
+ * GR2001–GR2012: a name in a written file that points at nothing.
7
+ */
8
+ /** Code and wording of a step that matched nothing, by step kind. */
9
+ const STEP_CODES = {
10
+ route: {
11
+ code: "GR2001",
12
+ missing: "matches no route"
13
+ },
14
+ page: {
15
+ code: "GR2002",
16
+ missing: "matches no page or screen of the feature's apps"
17
+ },
18
+ mail: {
19
+ code: "GR2003",
20
+ missing: "matches no mail"
21
+ },
22
+ notification: {
23
+ code: "GR2004",
24
+ missing: "matches no notification"
25
+ },
26
+ job: {
27
+ code: "GR2005",
28
+ missing: "matches no job"
29
+ },
30
+ event: {
31
+ code: "GR2006",
32
+ missing: "matches no event"
33
+ },
34
+ affects: {
35
+ code: "GR2007",
36
+ missing: "names no feature or flow"
37
+ }
38
+ };
39
+ /** Step kinds whose names come from the facts read with the routes (a booted app). */
40
+ const BOOT_TYPES = /* @__PURE__ */ new Set([
41
+ "route",
42
+ "mail",
43
+ "notification",
44
+ "job",
45
+ "event"
46
+ ]);
47
+ /**
48
+ * GR2001–GR2007: steps whose name matched nothing in the book. The matching
49
+ * is the flow book map's (`FlowBookmapStep.found`), so `scry` and the check
50
+ * agree. Retired flows are skipped. Without route facts (`routes: missing`)
51
+ * the route and named-thing steps are not checked.
52
+ */
53
+ function checkSteps(snapshot) {
54
+ const findings = [];
55
+ const skipBootTypes = snapshot.routes === "missing";
56
+ for (const feature of snapshot.written.features) for (const flow of feature.flows) {
57
+ if (isRetired(feature, flow)) continue;
58
+ const bookmap = snapshot.collected.flows[flow.ref];
59
+ if (!bookmap) continue;
60
+ flow.steps.forEach((step, position) => {
61
+ const rule = STEP_CODES[step.type];
62
+ if (!rule || skipBootTypes && BOOT_TYPES.has(step.type)) return;
63
+ if ((bookmap.steps.find((item) => item.index === step.index && item.type === step.type) ?? bookmap.steps[position])?.found !== false) return;
64
+ findings.push(createFinding({
65
+ code: rule.code,
66
+ message: `${step.type} step "${step.target}${step.app === null ? "" : ` [${step.app}]`}" ${step.app === null ? rule.missing : "matches no page or screen of that app"}`,
67
+ at: step.at,
68
+ feature: feature.id,
69
+ flow: flow.ref
70
+ }));
71
+ });
72
+ }
73
+ return findings;
74
+ }
75
+ /**
76
+ * GR2008: a feature, flow, criterion or task names an app with no folder.
77
+ * GR2009: a flow (Differs by app, a criterion's `[app]`) names an app that
78
+ * has a folder but is not in its feature's `apps`.
79
+ */
80
+ function checkAppNames(snapshot) {
81
+ const { apps } = writtenLookup(snapshot);
82
+ const findings = [];
83
+ for (const feature of snapshot.written.features) {
84
+ const readme = feature.readme;
85
+ for (const app of readme?.apps ?? []) {
86
+ if (apps.has(app.value)) continue;
87
+ findings.push(createFinding({
88
+ code: "GR2008",
89
+ message: `feature ${feature.id} lists app "${app.value}", which has no folder in grimoire/apps`,
90
+ at: app.at,
91
+ feature: feature.id,
92
+ app: app.value
93
+ }));
94
+ }
95
+ const listed = new Set((readme?.apps ?? []).map((app) => app.value));
96
+ for (const flow of feature.flows) {
97
+ const named = [
98
+ ...flow.differs.map((line) => ({
99
+ app: line.name,
100
+ at: line.at,
101
+ where: "Differs by app"
102
+ })),
103
+ ...flow.criteria.filter((criterion) => criterion.app !== null).map((criterion) => ({
104
+ app: criterion.app ?? "",
105
+ at: criterion.at,
106
+ where: criterion.id
107
+ })),
108
+ ...flow.steps.filter((step) => step.app !== null).map((step) => ({
109
+ app: step.app ?? "",
110
+ at: step.at,
111
+ where: `step ${step.index}`
112
+ }))
113
+ ];
114
+ for (const { app, at, where } of named) if (!apps.has(app)) findings.push(createFinding({
115
+ code: "GR2008",
116
+ message: `${flow.ref} ${where} names app "${app}", which has no folder in grimoire/apps`,
117
+ at,
118
+ feature: feature.id,
119
+ flow: flow.ref,
120
+ app
121
+ }));
122
+ else if (readme && !listed.has(app)) findings.push(createFinding({
123
+ code: "GR2009",
124
+ message: `${flow.ref} ${where} names app "${app}", which feature ${feature.id} does not list in apps`,
125
+ at,
126
+ feature: feature.id,
127
+ flow: flow.ref,
128
+ app
129
+ }));
130
+ }
131
+ }
132
+ for (const task of snapshot.written.tasks) for (const app of task.apps) {
133
+ if (apps.has(app.value)) continue;
134
+ findings.push(createFinding({
135
+ code: "GR2008",
136
+ message: `task ${task.id.value} names app "${app.value}", which has no folder in grimoire/apps`,
137
+ at: app.at,
138
+ app: app.value,
139
+ task: task.id.value
140
+ }));
141
+ }
142
+ return findings;
143
+ }
144
+ /**
145
+ * GR2010: a changelog entry names a flow its feature does not have.
146
+ * GR2011: it names a criterion that flow does not have.
147
+ */
148
+ function checkChangelogLinks(snapshot) {
149
+ const { flows } = writtenLookup(snapshot);
150
+ const findings = [];
151
+ for (const feature of snapshot.written.features) for (const entry of feature.changelog?.entries ?? []) {
152
+ if (entry.flow === null) continue;
153
+ const ref = `${feature.id}/${entry.flow}`;
154
+ const flow = flows.get(ref);
155
+ if (!flow) {
156
+ findings.push(createFinding({
157
+ code: "GR2010",
158
+ message: `changelog entry ${entry.version.value} ${entry.word} names flow "${entry.flow}", which ${feature.id} does not have`,
159
+ at: entry.at,
160
+ feature: feature.id
161
+ }));
162
+ continue;
163
+ }
164
+ const criteria = new Set(flow.criteria.map((criterion) => criterion.id));
165
+ for (const criterion of entry.criteria) {
166
+ if (criteria.has(criterion)) continue;
167
+ findings.push(createFinding({
168
+ code: "GR2011",
169
+ message: `changelog entry ${entry.version.value} ${entry.word} names ${criterion}, which ${ref} does not have`,
170
+ at: entry.at,
171
+ feature: feature.id,
172
+ flow: ref
173
+ }));
174
+ }
175
+ }
176
+ return findings;
177
+ }
178
+ /** GR2012: a README "Affects and affected by" line names a feature or flow that does not exist. */
179
+ function checkRelations(snapshot) {
180
+ const { features, flows } = writtenLookup(snapshot);
181
+ const findings = [];
182
+ for (const feature of snapshot.written.features) for (const relation of feature.readme?.relations ?? []) for (const ref of relation.refs) {
183
+ if (ref.includes("/") ? flows.has(ref) : features.has(ref)) continue;
184
+ findings.push(createFinding({
185
+ code: "GR2012",
186
+ message: `README of ${feature.id} names "${ref}", which is no ${ref.includes("/") ? "flow" : "feature"}`,
187
+ at: relation.at,
188
+ feature: feature.id
189
+ }));
190
+ }
191
+ return findings;
192
+ }
193
+
194
+ //#endregion
195
+ export { checkAppNames, checkChangelogLinks, checkRelations, checkSteps };
196
+ //# sourceMappingURL=links.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"links.mjs","names":[],"sources":["../../../../../../../../../packages/grimoire/src/check/rules/links.ts"],"sourcesContent":["/**\n * GR2001–GR2012: a name in a written file that points at nothing.\n */\nimport { createFinding } from \"../../codes\";\nimport type { GrimoireFinding } from \"../../contracts/findings\";\nimport type { GrimoireSnapshot } from \"../../contracts/snapshot\";\nimport type { StepType, WrittenStep } from \"../../contracts/written\";\nimport { isRetired, writtenLookup } from \"./lookup\";\n\n/** Code and wording of a step that matched nothing, by step kind. */\nconst STEP_CODES: Partial<Record<StepType, { code: string; missing: string }>> = {\n route: { code: \"GR2001\", missing: \"matches no route\" },\n page: { code: \"GR2002\", missing: \"matches no page or screen of the feature's apps\" },\n mail: { code: \"GR2003\", missing: \"matches no mail\" },\n notification: { code: \"GR2004\", missing: \"matches no notification\" },\n job: { code: \"GR2005\", missing: \"matches no job\" },\n event: { code: \"GR2006\", missing: \"matches no event\" },\n affects: { code: \"GR2007\", missing: \"names no feature or flow\" },\n};\n\n/** Step kinds whose names come from the facts read with the routes (a booted app). */\nconst BOOT_TYPES: ReadonlySet<StepType> = new Set([\n \"route\",\n \"mail\",\n \"notification\",\n \"job\",\n \"event\",\n]);\n\n/**\n * GR2001–GR2007: steps whose name matched nothing in the book. The matching\n * is the flow book map's (`FlowBookmapStep.found`), so `scry` and the check\n * agree. Retired flows are skipped. Without route facts (`routes: missing`)\n * the route and named-thing steps are not checked.\n */\nexport function checkSteps(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const findings: GrimoireFinding[] = [];\n const skipBootTypes = snapshot.routes === \"missing\";\n\n for (const feature of snapshot.written.features) {\n for (const flow of feature.flows) {\n if (isRetired(feature, flow)) continue;\n\n const bookmap = snapshot.collected.flows[flow.ref];\n\n if (!bookmap) continue;\n\n flow.steps.forEach((step: WrittenStep, position) => {\n const rule = STEP_CODES[step.type];\n\n if (!rule || (skipBootTypes && BOOT_TYPES.has(step.type))) return;\n\n const mapped =\n bookmap.steps.find((item) => item.index === step.index && item.type === step.type) ??\n bookmap.steps[position];\n\n if (mapped?.found !== false) return;\n\n findings.push(\n createFinding({\n code: rule.code,\n message: `${step.type} step \"${step.target}${step.app === null ? \"\" : ` [${step.app}]`}\" ${\n step.app === null ? rule.missing : \"matches no page or screen of that app\"\n }`,\n at: step.at,\n feature: feature.id,\n flow: flow.ref,\n }),\n );\n });\n }\n }\n\n return findings;\n}\n\n/**\n * GR2008: a feature, flow, criterion or task names an app with no folder.\n * GR2009: a flow (Differs by app, a criterion's `[app]`) names an app that\n * has a folder but is not in its feature's `apps`.\n */\nexport function checkAppNames(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const { apps } = writtenLookup(snapshot);\n const findings: GrimoireFinding[] = [];\n\n for (const feature of snapshot.written.features) {\n const readme = feature.readme;\n\n for (const app of readme?.apps ?? []) {\n if (apps.has(app.value)) continue;\n\n findings.push(\n createFinding({\n code: \"GR2008\",\n message: `feature ${feature.id} lists app \"${app.value}\", which has no folder in grimoire/apps`,\n at: app.at,\n feature: feature.id,\n app: app.value,\n }),\n );\n }\n\n const listed = new Set((readme?.apps ?? []).map((app) => app.value));\n\n for (const flow of feature.flows) {\n const named = [\n ...flow.differs.map((line) => ({ app: line.name, at: line.at, where: \"Differs by app\" })),\n ...flow.criteria\n .filter((criterion) => criterion.app !== null)\n .map((criterion) => ({\n app: criterion.app ?? \"\",\n at: criterion.at,\n where: criterion.id,\n })),\n ...flow.steps\n .filter((step) => step.app !== null)\n .map((step) => ({\n app: step.app ?? \"\",\n at: step.at,\n where: `step ${step.index}`,\n })),\n ];\n\n for (const { app, at, where } of named) {\n if (!apps.has(app)) {\n findings.push(\n createFinding({\n code: \"GR2008\",\n message: `${flow.ref} ${where} names app \"${app}\", which has no folder in grimoire/apps`,\n at,\n feature: feature.id,\n flow: flow.ref,\n app,\n }),\n );\n } else if (readme && !listed.has(app)) {\n findings.push(\n createFinding({\n code: \"GR2009\",\n message: `${flow.ref} ${where} names app \"${app}\", which feature ${feature.id} does not list in apps`,\n at,\n feature: feature.id,\n flow: flow.ref,\n app,\n }),\n );\n }\n }\n }\n }\n\n for (const task of snapshot.written.tasks) {\n for (const app of task.apps) {\n if (apps.has(app.value)) continue;\n\n findings.push(\n createFinding({\n code: \"GR2008\",\n message: `task ${task.id.value} names app \"${app.value}\", which has no folder in grimoire/apps`,\n at: app.at,\n app: app.value,\n task: task.id.value,\n }),\n );\n }\n }\n\n return findings;\n}\n\n/**\n * GR2010: a changelog entry names a flow its feature does not have.\n * GR2011: it names a criterion that flow does not have.\n */\nexport function checkChangelogLinks(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const { flows } = writtenLookup(snapshot);\n const findings: GrimoireFinding[] = [];\n\n for (const feature of snapshot.written.features) {\n for (const entry of feature.changelog?.entries ?? []) {\n if (entry.flow === null) continue;\n\n const ref = `${feature.id}/${entry.flow}`;\n const flow = flows.get(ref);\n\n if (!flow) {\n findings.push(\n createFinding({\n code: \"GR2010\",\n message: `changelog entry ${entry.version.value} ${entry.word} names flow \"${entry.flow}\", which ${feature.id} does not have`,\n at: entry.at,\n feature: feature.id,\n }),\n );\n continue;\n }\n\n const criteria = new Set(flow.criteria.map((criterion) => criterion.id));\n\n for (const criterion of entry.criteria) {\n if (criteria.has(criterion)) continue;\n\n findings.push(\n createFinding({\n code: \"GR2011\",\n message: `changelog entry ${entry.version.value} ${entry.word} names ${criterion}, which ${ref} does not have`,\n at: entry.at,\n feature: feature.id,\n flow: ref,\n }),\n );\n }\n }\n }\n\n return findings;\n}\n\n/** GR2012: a README \"Affects and affected by\" line names a feature or flow that does not exist. */\nexport function checkRelations(snapshot: GrimoireSnapshot): GrimoireFinding[] {\n const { features, flows } = writtenLookup(snapshot);\n const findings: GrimoireFinding[] = [];\n\n for (const feature of snapshot.written.features) {\n for (const relation of feature.readme?.relations ?? []) {\n for (const ref of relation.refs) {\n const exists = ref.includes(\"/\") ? flows.has(ref) : features.has(ref);\n\n if (exists) continue;\n\n findings.push(\n createFinding({\n code: \"GR2012\",\n message: `README of ${feature.id} names \"${ref}\", which is no ${ref.includes(\"/\") ? \"flow\" : \"feature\"}`,\n at: relation.at,\n feature: feature.id,\n }),\n );\n }\n }\n }\n\n return findings;\n}\n"],"mappings":";;;;;;;;AAUA,MAAM,aAA2E;CAC/E,OAAO;EAAE,MAAM;EAAU,SAAS;CAAmB;CACrD,MAAM;EAAE,MAAM;EAAU,SAAS;CAAkD;CACnF,MAAM;EAAE,MAAM;EAAU,SAAS;CAAkB;CACnD,cAAc;EAAE,MAAM;EAAU,SAAS;CAA0B;CACnE,KAAK;EAAE,MAAM;EAAU,SAAS;CAAiB;CACjD,OAAO;EA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W,SAAS,QAAQ,UACrC,KAAK,MAAM,YAAY,QAAQ,QAAQ,aAAa,CAAC,GACnD,KAAK,MAAM,OAAO,SAAS,MAAM;EAG/B,IAFe,IAAI,SAAS,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,GAExD;EAEZ,SAAS,KACP,cAAc;GACZ,MAAM;GACN,SAAS,aAAa,QAAQ,GAAG,UAAU,IAAI,iBAAiB,IAAI,SAAS,GAAG,IAAI,SAAS;GAC7F,IAAI,SAAS;GACb,SAAS,QAAQ;EACnB,CAAC,CACH;CACF;CAIJ,OAAO;AACT"}
@@ -0,0 +1,41 @@
1
+ //#region ../../packages/grimoire/src/check/rules/lookup.ts
2
+ /** Index the written files of a snapshot. */
3
+ function writtenLookup(snapshot) {
4
+ const features = /* @__PURE__ */ new Map();
5
+ const flows = /* @__PURE__ */ new Map();
6
+ for (const feature of snapshot.written.features) {
7
+ features.set(feature.id, feature);
8
+ for (const flow of feature.flows) flows.set(`${feature.id}/${flow.id.value}`, flow);
9
+ }
10
+ return {
11
+ features,
12
+ flows,
13
+ apps: new Set(snapshot.written.apps.map((app) => app.id.value))
14
+ };
15
+ }
16
+ /** The README status of a feature, or `null` without a README. */
17
+ function featureStatus(feature) {
18
+ return feature.readme?.status.value ?? null;
19
+ }
20
+ /**
21
+ * Whether the code of a flow is gone on purpose: the flow or its whole
22
+ * feature is `retired`. Rules that look a flow's names up in the code skip it.
23
+ */
24
+ function isRetired(feature, flow) {
25
+ return flow.status.value === "retired" || featureStatus(feature) === "retired";
26
+ }
27
+ /** `<whole>.<decimal>` as two numbers, or `null` for another form. */
28
+ function parseVersion(value) {
29
+ const match = /^(\d+)\.(\d+)$/.exec(value.trim());
30
+ return match ? [Number(match[1]), Number(match[2])] : null;
31
+ }
32
+ /** Negative when `left` is older, positive when newer, 0 when equal. Malformed versions sort first. */
33
+ function compareVersions(left, right) {
34
+ const a = parseVersion(left) ?? [-1, -1];
35
+ const b = parseVersion(right) ?? [-1, -1];
36
+ return a[0] - b[0] || a[1] - b[1];
37
+ }
38
+
39
+ //#endregion
40
+ export { compareVersions, featureStatus, isRetired, parseVersion, writtenLookup };
41
+ //# sourceMappingURL=lookup.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lookup.mjs","names":[],"sources":["../../../../../../../../../packages/grimoire/src/check/rules/lookup.ts"],"sourcesContent":["import type { GrimoireSnapshot } from \"../../contracts/snapshot\";\nimport type { WrittenFeature, WrittenFlow, WrittenStatus } from \"../../contracts/written\";\n\n/** Written features and flows by id, for the rules. */\nexport type WrittenLookup = {\n features: Map<string, WrittenFeature>;\n /** By `<feature>/<flow>`. */\n flows: Map<string, WrittenFlow>;\n /** App ids that have a folder under `grimoire/apps/`. */\n apps: Set<string>;\n};\n\n/** Index the written files of a snapshot. */\nexport function writtenLookup(snapshot: GrimoireSnapshot): WrittenLookup {\n const features = new Map<string, WrittenFeature>();\n const flows = new Map<string, WrittenFlow>();\n\n for (const feature of snapshot.written.features) {\n features.set(feature.id, feature);\n\n for (const flow of feature.flows) flows.set(`${feature.id}/${flow.id.value}`, flow);\n }\n\n return { features, flows, apps: new Set(snapshot.written.apps.map((app) => app.id.value)) };\n}\n\n/** The README status of a feature, or `null` without a README. */\nexport function featureStatus(feature: WrittenFeature): WrittenStatus | null {\n return feature.readme?.status.value ?? null;\n}\n\n/**\n * Whether the code of a flow is gone on purpose: the flow or its whole\n * feature is `retired`. Rules that look a flow's names up in the code skip it.\n */\nexport function isRetired(feature: WrittenFeature, flow: WrittenFlow): boolean {\n return flow.status.value === \"retired\" || featureStatus(feature) === \"retired\";\n}\n\n/** `<whole>.<decimal>` as two numbers, or `null` for another form. */\nexport function parseVersion(value: string): [number, number] | null {\n const match = /^(\\d+)\\.(\\d+)$/.exec(value.trim());\n\n return match ? [Number(match[1]), Number(match[2])] : null;\n}\n\n/** Negative when `left` is older, positive when newer, 0 when equal. Malformed versions sort first. */\nexport function compareVersions(left: string, right: string): number {\n const a = parseVersion(left) ?? [-1, -1];\n const b = parseVersion(right) ?? [-1, -1];\n\n return a[0] - b[0] || a[1] - b[1];\n}\n"],"mappings":";;AAaA,SAAgB,cAAc,UAA2C;CACvE,MAAM,2BAAW,IAAI,IAA4B;CACjD,MAAM,wBAAQ,IAAI,IAAyB;CAE3C,KAAK,MAAM,WAAW,SAAS,QAAQ,UAAU;EAC/C,SAAS,IAAI,QAAQ,IAAI,OAAO;EAEhC,KAAK,MAAM,QAAQ,QAAQ,OAAO,MAAM,IAAI,GAAG,QAAQ,GAAG,GAAG,KAAK,GAAG,SAAS,IAAI;CACpF;CAEA,OAAO;EAAE;EAAU;EAAO,MAAM,IAAI,IAAI,SAAS,QAAQ,KAAK,KAAK,QAAQ,IAAI,GAAG,KAAK,CAAC;CAAE;AAC5F;;AAGA,SAAgB,cAAc,SAA+C;CAC3E,OAAO,QAAQ,QAAQ,OAAO,SAAS;AACzC;;;;;AAMA,SAAgB,UAAU,SAAyB,MAA4B;CAC7E,OAAO,KAAK,OAAO,UAAU,aAAa,cAAc,OAAO,MAAM;AACvE;;AAGA,SAAgB,aAAa,OAAwC;CACnE,MAAM,QAAQ,iBAAiB,KAAK,MAAM,KAAK,CAAC;CAEhD,OAAO,QAAQ,CAAC,OAAO,MAAM,EAAE,GAAG,OAAO,MAAM,EAAE,CAAC,IAAI;AACxD;;AAGA,SAAgB,gBAAgB,MAAc,OAAuB;CACnE,MAAM,IAAI,aAAa,IAAI,KAAK,CAAC,IAAI,EAAE;CACvC,MAAM,IAAI,aAAa,KAAK,KAAK,CAAC,IAAI,EAAE;CAExC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;AACjC"}