@warlock.js/grimoire 0.0.0-stage → 5.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/LICENSE +21 -0
  3. package/README.md +55 -2
  4. package/esm/apps/check-apps.mjs +207 -0
  5. package/esm/apps/check-apps.mjs.map +1 -0
  6. package/esm/apps/index.mjs +4 -0
  7. package/esm/apps/match-apps.d.mts +12 -0
  8. package/esm/apps/match-apps.d.mts.map +1 -0
  9. package/esm/apps/match-apps.mjs +30 -0
  10. package/esm/apps/match-apps.mjs.map +1 -0
  11. package/esm/book/build.d.mts +14 -0
  12. package/esm/book/build.d.mts.map +1 -0
  13. package/esm/book/build.mjs +300 -0
  14. package/esm/book/build.mjs.map +1 -0
  15. package/esm/book/index.mjs +5 -0
  16. package/esm/book/io.mjs +162 -0
  17. package/esm/book/io.mjs.map +1 -0
  18. package/esm/book/normalize.mjs +71 -0
  19. package/esm/book/normalize.mjs.map +1 -0
  20. package/esm/book/render.mjs +262 -0
  21. package/esm/book/render.mjs.map +1 -0
  22. package/esm/book/write.d.mts +12 -0
  23. package/esm/book/write.d.mts.map +1 -0
  24. package/esm/book/write.mjs +90 -0
  25. package/esm/book/write.mjs.map +1 -0
  26. package/esm/bookmap/build.d.mts +21 -0
  27. package/esm/bookmap/build.d.mts.map +1 -0
  28. package/esm/bookmap/build.mjs +272 -0
  29. package/esm/bookmap/build.mjs.map +1 -0
  30. package/esm/bookmap/index.mjs +5 -0
  31. package/esm/bookmap/steps.mjs +137 -0
  32. package/esm/bookmap/steps.mjs.map +1 -0
  33. package/esm/bookmap/write.d.mts +19 -0
  34. package/esm/bookmap/write.d.mts.map +1 -0
  35. package/esm/bookmap/write.mjs +118 -0
  36. package/esm/bookmap/write.mjs.map +1 -0
  37. package/esm/check/check-grimoire.d.mts +7 -0
  38. package/esm/check/check-grimoire.d.mts.map +1 -0
  39. package/esm/check/check-grimoire.mjs +98 -0
  40. package/esm/check/check-grimoire.mjs.map +1 -0
  41. package/esm/check/format-check-report.d.mts +20 -0
  42. package/esm/check/format-check-report.d.mts.map +1 -0
  43. package/esm/check/format-check-report.mjs +55 -0
  44. package/esm/check/format-check-report.mjs.map +1 -0
  45. package/esm/check/index.mjs +4 -0
  46. package/esm/check/rules/book-notes.mjs +18 -0
  47. package/esm/check/rules/book-notes.mjs.map +1 -0
  48. package/esm/check/rules/criteria.mjs +48 -0
  49. package/esm/check/rules/criteria.mjs.map +1 -0
  50. package/esm/check/rules/links.mjs +196 -0
  51. package/esm/check/rules/links.mjs.map +1 -0
  52. package/esm/check/rules/lookup.mjs +41 -0
  53. package/esm/check/rules/lookup.mjs.map +1 -0
  54. package/esm/check/rules/source-files.mjs +119 -0
  55. package/esm/check/rules/source-files.mjs.map +1 -0
  56. package/esm/check/rules/versions.mjs +92 -0
  57. package/esm/check/rules/versions.mjs.map +1 -0
  58. package/esm/codes/codes.d.mts +182 -0
  59. package/esm/codes/codes.d.mts.map +1 -0
  60. package/esm/codes/codes.mjs +111 -0
  61. package/esm/codes/codes.mjs.map +1 -0
  62. package/esm/codes/index.d.mts +33 -0
  63. package/esm/codes/index.d.mts.map +1 -0
  64. package/esm/codes/index.mjs +63 -0
  65. package/esm/codes/index.mjs.map +1 -0
  66. package/esm/contracts/adapter.d.mts +209 -0
  67. package/esm/contracts/adapter.d.mts.map +1 -0
  68. package/esm/contracts/book.d.mts +233 -0
  69. package/esm/contracts/book.d.mts.map +1 -0
  70. package/esm/contracts/book.mjs +7 -0
  71. package/esm/contracts/book.mjs.map +1 -0
  72. package/esm/contracts/bookmap.d.mts +175 -0
  73. package/esm/contracts/bookmap.d.mts.map +1 -0
  74. package/esm/contracts/findings.d.mts +79 -0
  75. package/esm/contracts/findings.d.mts.map +1 -0
  76. package/esm/contracts/location.d.mts +22 -0
  77. package/esm/contracts/location.d.mts.map +1 -0
  78. package/esm/contracts/releases.d.mts +53 -0
  79. package/esm/contracts/releases.d.mts.map +1 -0
  80. package/esm/contracts/scry.d.mts +143 -0
  81. package/esm/contracts/scry.d.mts.map +1 -0
  82. package/esm/contracts/snapshot.d.mts +52 -0
  83. package/esm/contracts/snapshot.d.mts.map +1 -0
  84. package/esm/contracts/test-results.d.mts +63 -0
  85. package/esm/contracts/test-results.d.mts.map +1 -0
  86. package/esm/contracts/written.d.mts +363 -0
  87. package/esm/contracts/written.d.mts.map +1 -0
  88. package/esm/contracts/written.mjs +19 -0
  89. package/esm/contracts/written.mjs.map +1 -0
  90. package/esm/devtools/data.mjs +171 -0
  91. package/esm/devtools/data.mjs.map +1 -0
  92. package/esm/devtools/graphs.mjs +142 -0
  93. package/esm/devtools/graphs.mjs.map +1 -0
  94. package/esm/devtools/index.d.mts +42 -0
  95. package/esm/devtools/index.d.mts.map +1 -0
  96. package/esm/devtools/index.mjs +103 -0
  97. package/esm/devtools/index.mjs.map +1 -0
  98. package/esm/devtools/site.d.mts +26 -0
  99. package/esm/devtools/site.d.mts.map +1 -0
  100. package/esm/devtools/site.mjs +190 -0
  101. package/esm/devtools/site.mjs.map +1 -0
  102. package/esm/devtools/snapshot-source.mjs +70 -0
  103. package/esm/devtools/snapshot-source.mjs.map +1 -0
  104. package/esm/front-matter/index.d.mts +33 -0
  105. package/esm/front-matter/index.d.mts.map +1 -0
  106. package/esm/front-matter/index.mjs +130 -0
  107. package/esm/front-matter/index.mjs.map +1 -0
  108. package/esm/graph/index.d.mts +15 -0
  109. package/esm/graph/index.d.mts.map +1 -0
  110. package/esm/graph/index.mjs +42 -0
  111. package/esm/graph/index.mjs.map +1 -0
  112. package/esm/index.d.mts +33 -0
  113. package/esm/index.mjs +33 -0
  114. package/esm/ownership/index.d.mts +8 -0
  115. package/esm/ownership/index.d.mts.map +1 -0
  116. package/esm/ownership/index.mjs +137 -0
  117. package/esm/ownership/index.mjs.map +1 -0
  118. package/esm/paths/index.d.mts +58 -0
  119. package/esm/paths/index.d.mts.map +1 -0
  120. package/esm/paths/index.mjs +137 -0
  121. package/esm/paths/index.mjs.map +1 -0
  122. package/esm/proves/index.mjs +3 -0
  123. package/esm/proves/scan-proofs.d.mts +22 -0
  124. package/esm/proves/scan-proofs.d.mts.map +1 -0
  125. package/esm/proves/scan-proofs.mjs +214 -0
  126. package/esm/proves/scan-proofs.mjs.map +1 -0
  127. package/esm/releases/index.d.mts +29 -0
  128. package/esm/releases/index.d.mts.map +1 -0
  129. package/esm/releases/index.mjs +157 -0
  130. package/esm/releases/index.mjs.map +1 -0
  131. package/esm/scry/format.d.mts +14 -0
  132. package/esm/scry/format.d.mts.map +1 -0
  133. package/esm/scry/format.mjs +193 -0
  134. package/esm/scry/format.mjs.map +1 -0
  135. package/esm/scry/index.mjs +5 -0
  136. package/esm/scry/parse.d.mts +10 -0
  137. package/esm/scry/parse.d.mts.map +1 -0
  138. package/esm/scry/parse.mjs +108 -0
  139. package/esm/scry/parse.mjs.map +1 -0
  140. package/esm/scry/query.d.mts +11 -0
  141. package/esm/scry/query.d.mts.map +1 -0
  142. package/esm/scry/query.mjs +457 -0
  143. package/esm/scry/query.mjs.map +1 -0
  144. package/esm/tasks/index.mjs +116 -0
  145. package/esm/tasks/index.mjs.map +1 -0
  146. package/esm/test-results/criterion-status.d.mts +15 -0
  147. package/esm/test-results/criterion-status.d.mts.map +1 -0
  148. package/esm/test-results/criterion-status.mjs +17 -0
  149. package/esm/test-results/criterion-status.mjs.map +1 -0
  150. package/esm/test-results/index.d.mts +8 -0
  151. package/esm/test-results/index.d.mts.map +1 -0
  152. package/esm/test-results/index.mjs +124 -0
  153. package/esm/test-results/index.mjs.map +1 -0
  154. package/esm/vitest/index.d.mts +15 -0
  155. package/esm/vitest/index.d.mts.map +1 -0
  156. package/esm/vitest/index.mjs +146 -0
  157. package/esm/vitest/index.mjs.map +1 -0
  158. package/esm/warlock/actions.mjs +265 -0
  159. package/esm/warlock/actions.mjs.map +1 -0
  160. package/esm/warlock/adapter.d.mts +28 -0
  161. package/esm/warlock/adapter.d.mts.map +1 -0
  162. package/esm/warlock/adapter.mjs +377 -0
  163. package/esm/warlock/adapter.mjs.map +1 -0
  164. package/esm/warlock/commands.d.mts +15 -0
  165. package/esm/warlock/commands.d.mts.map +1 -0
  166. package/esm/warlock/commands.mjs +199 -0
  167. package/esm/warlock/commands.mjs.map +1 -0
  168. package/esm/warlock/index.d.mts +4 -0
  169. package/esm/warlock/index.mjs +5 -0
  170. package/esm/warlock/mcp-tools.mjs +247 -0
  171. package/esm/warlock/mcp-tools.mjs.map +1 -0
  172. package/esm/warlock/mobile-facts.d.mts +32 -0
  173. package/esm/warlock/mobile-facts.d.mts.map +1 -0
  174. package/esm/warlock/mobile-facts.mjs +185 -0
  175. package/esm/warlock/mobile-facts.mjs.map +1 -0
  176. package/esm/workspace/index.d.mts +11 -0
  177. package/esm/workspace/index.d.mts.map +1 -0
  178. package/esm/workspace/index.mjs +122 -0
  179. package/esm/workspace/index.mjs.map +1 -0
  180. package/esm/written/apps.mjs +227 -0
  181. package/esm/written/apps.mjs.map +1 -0
  182. package/esm/written/features.mjs +400 -0
  183. package/esm/written/features.mjs.map +1 -0
  184. package/esm/written/fields.mjs +173 -0
  185. package/esm/written/fields.mjs.map +1 -0
  186. package/esm/written/index.mjs +3 -0
  187. package/esm/written/lists.mjs +68 -0
  188. package/esm/written/lists.mjs.map +1 -0
  189. package/esm/written/markdown.mjs +173 -0
  190. package/esm/written/markdown.mjs.map +1 -0
  191. package/esm/written/parse-grimoire.d.mts +20 -0
  192. package/esm/written/parse-grimoire.d.mts.map +1 -0
  193. package/esm/written/parse-grimoire.mjs +552 -0
  194. package/esm/written/parse-grimoire.mjs.map +1 -0
  195. package/esm/written/sink.mjs +65 -0
  196. package/esm/written/sink.mjs.map +1 -0
  197. package/esm/written/tasks-releases.mjs +166 -0
  198. package/esm/written/tasks-releases.mjs.map +1 -0
  199. package/llms-full.txt +869 -0
  200. package/llms.txt +15 -0
  201. package/package.json +66 -4
  202. package/skills/backfill-a-grimoire/SKILL.md +128 -0
  203. package/skills/describe-an-app/SKILL.md +162 -0
  204. package/skills/document-a-file/SKILL.md +75 -0
  205. package/skills/index.md +26 -0
  206. package/skills/record-a-change/SKILL.md +139 -0
  207. package/skills/use-the-grimoire/SKILL.md +137 -0
  208. package/skills/write-a-feature/SKILL.md +168 -0
  209. package/ui/grimoire-static.js +136 -0
  210. package/ui/grimoire-view.js +1005 -0
  211. package/ui/grimoire.css +88 -0
@@ -0,0 +1,175 @@
1
+ import { BOOK_SCHEMA_VERSION, BookRouteRef } from "./book.mjs";
2
+ import { CriterionId, FeatureVersion, FlowRef, StepType, TaskStatus, TaskType, WrittenOrigin, WrittenStatus } from "./written.mjs";
3
+ import { CriterionStatus, TestOutcome } from "./test-results.mjs";
4
+ //#region ../../packages/grimoire/src/contracts/bookmap.d.ts
5
+ /**
6
+ * Who owns one source file.
7
+ *
8
+ * Rules: a `@feature <id>` header tag wins; then a `folders` entry that names
9
+ * the file itself; otherwise the feature whose `folders` entry is the deepest
10
+ * folder holding the file. Two different tags, or the same file or folder
11
+ * listed by two features, is a conflict (`GR3003`) and the
12
+ * file gets no owner. A feature borrows a file it does not own when one of its
13
+ * own files imports it.
14
+ */
15
+ export type FileOwnership = {
16
+ file: string;
17
+ owner: string | null;
18
+ /** How the owner was decided. */
19
+ via: "tag" | "folder" | "file" | null;
20
+ /** The `folders` entry that matched, when `via` is `folder`. */
21
+ folder: string | null;
22
+ /** Every feature that claimed the file when there was a conflict. Empty otherwise. */
23
+ conflicts: {
24
+ feature: string;
25
+ via: "tag" | "folder" | "file";
26
+ }[];
27
+ /** Features with an own file that imports this one, sorted. */
28
+ borrowedBy: string[];
29
+ };
30
+ /** Ownership of every code file in the book. */
31
+ export type Ownership = {
32
+ files: Record<string, FileOwnership>;
33
+ /** Feature id → its own and borrowed files, sorted. */
34
+ features: Record<string, {
35
+ own: string[];
36
+ borrowed: string[];
37
+ }>;
38
+ };
39
+ /** `grimoire/features/<feature>/bookmap.json`. */
40
+ export type FeatureBookmap = {
41
+ schemaVersion: typeof BOOK_SCHEMA_VERSION;
42
+ feature: string;
43
+ /** Files the feature owns. */
44
+ own: string[];
45
+ /** Files of other features (or of no feature) that its own files import directly. */
46
+ borrowed: {
47
+ file: string;
48
+ owner: string | null;
49
+ by: string[];
50
+ }[];
51
+ /** Routes whose handler file or routes file the feature owns. */
52
+ routes: (BookRouteRef & {
53
+ file: string;
54
+ })[];
55
+ /** App id → pages and screens whose page, setup or screen file the feature owns. */
56
+ pages: Record<string, {
57
+ route: string;
58
+ file: string;
59
+ type: "page" | "screen";
60
+ }[]>;
61
+ /** Own files that no step of any of its flows reaches. */
62
+ unreached: string[];
63
+ };
64
+ /** One step of a flow with the files behind it. */
65
+ export type FlowBookmapStep = {
66
+ index: number;
67
+ type: StepType;
68
+ target: string;
69
+ /**
70
+ * `true` when the step's name matched the book; `false` when it did not;
71
+ * `null` for kinds the book cannot check (`outside service`) and for
72
+ * route steps when no route facts exist.
73
+ */
74
+ found: boolean | null;
75
+ /** The file the step starts from (handler, page, mail file…), or `null`. */
76
+ entry: string | null;
77
+ /** The entry file and every project file it imports, transitively, sorted. */
78
+ files: string[];
79
+ };
80
+ /** One acceptance criterion with its tests and their last results. */
81
+ export type FlowBookmapCriterion = {
82
+ id: CriterionId;
83
+ app: string | null;
84
+ text: string;
85
+ tests: {
86
+ file: string;
87
+ line: number;
88
+ name: string | null;
89
+ /** `not-run` when the results store has no result for it. */
90
+ result: TestOutcome | "not-run";
91
+ stale: boolean;
92
+ }[];
93
+ status: CriterionStatus;
94
+ };
95
+ /** `grimoire/features/<feature>/flows/<flow>.bookmap.json`. */
96
+ export type FlowBookmap = {
97
+ schemaVersion: typeof BOOK_SCHEMA_VERSION;
98
+ feature: string;
99
+ flow: string;
100
+ ref: FlowRef;
101
+ steps: FlowBookmapStep[];
102
+ criteria: FlowBookmapCriterion[];
103
+ /** Pages, screens and layouts whose blocks show the flow. */
104
+ shownBy: {
105
+ app: string;
106
+ type: "page" | "screen" | "layout";
107
+ /** Page/screen folder or layout id. */
108
+ id: string;
109
+ block: string;
110
+ /** The written file holding the row. */
111
+ file: string;
112
+ }[];
113
+ };
114
+ /** `grimoire/features/index.json`. */
115
+ export type FeaturesIndex = {
116
+ schemaVersion: typeof BOOK_SCHEMA_VERSION;
117
+ features: {
118
+ id: string;
119
+ title: string;
120
+ status: WrittenStatus;
121
+ version: FeatureVersion;
122
+ /** README `updated`. */
123
+ updated: string;
124
+ apps: string[];
125
+ origin: WrittenOrigin | null;
126
+ flows: {
127
+ id: string;
128
+ status: WrittenStatus;
129
+ since: FeatureVersion;
130
+ }[];
131
+ /** Released versions from the changelog, newest first (dates come from the changelog). */
132
+ releases: {
133
+ version: FeatureVersion;
134
+ release: string;
135
+ date: string;
136
+ }[];
137
+ }[];
138
+ };
139
+ /** One task as the index lists it. */
140
+ export type TaskSummary = {
141
+ id: string;
142
+ title: string;
143
+ type: TaskType;
144
+ status: TaskStatus;
145
+ feature: string | null;
146
+ flow: string | null;
147
+ apps: string[];
148
+ file: string;
149
+ shipped: {
150
+ feature: string;
151
+ version: FeatureVersion;
152
+ } | null;
153
+ decisionNeeded: string | null;
154
+ };
155
+ /**
156
+ * `grimoire/tasks/index.json`. `waiting` holds the open tasks that wait for
157
+ * the owner: status `waiting for approval`, or a `Decision needed` line.
158
+ * Tasks are sorted by id number.
159
+ */
160
+ export type TasksIndex = {
161
+ schemaVersion: typeof BOOK_SCHEMA_VERSION;
162
+ open: TaskSummary[];
163
+ waiting: TaskSummary[];
164
+ done: TaskSummary[];
165
+ };
166
+ /** Every collected file `openGrimoire()` writes, in memory. */
167
+ export type CollectedFiles = {
168
+ features: Record<string, FeatureBookmap>;
169
+ /** By `<feature>/<flow>`. */
170
+ flows: Record<string, FlowBookmap>;
171
+ featuresIndex: FeaturesIndex;
172
+ tasksIndex: TasksIndex;
173
+ };
174
+ //#endregion
175
+ //# sourceMappingURL=bookmap.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bookmap.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/bookmap.ts"],"mappings":";;;;;;;;;;;;;;YA8BY;EACV;EACA;;EAEA;;EAEA;;EAEA;IAAa;IAAiB;;;EAE9B;;;YAIU;EACV,OAAO,eAAe;;EAEtB,UAAU;IAAiB;IAAe;;;;YAMhC;EACV,sBAAsB;EACtB;;EAEA;;EAEA;IAAY;IAAc;IAAsB;;;EAEhD,SAAS;IAAiB;;;EAE1B,OAAO;IAAiB;IAAe;IAAc;;;EAErD;;;YAIU;EACV;EACA,MAAM;EACN;;;;;;EAMA;;EAEA;;EAEA;;;YAIU;EACV,IAAI;EACJ;EACA;EACA;IACE;IACA;IACA;;IAEA,QAAQ;IACR;;EAEF,QAAQ;;;YAIE;EACV,sBAAsB;EACtB;EACA;EACA,KAAK;EACL,OAAO;EACP,UAAU;;EAEV;IACE;IACA;;IAEA;IACA;;IAEA;;;;YAOQ;EACV,sBAAsB;EACtB;IACE;IACA;IACA,QAAQ;IACR,SAAS;;IAET;IACA;IACA,QAAQ;IACR;MAAS;MAAY,QAAQ;MAAe,OAAO;;;IAEnD;MAAY,SAAS;MAAgB;MAAiB;;;;;YAK9C;EACV;EACA;EACA,MAAM;EACN,QAAQ;EACR;EACA;EACA;EACA;EACA;IAAW;IAAiB,SAAS;;EACrC;;;;;;;YAQU;EACV,sBAAsB;EACtB,MAAM;EACN,SAAS;EACT,MAAM;;;YAII;EACV,UAAU,eAAe;;EAEzB,OAAO,eAAe;EACtB,eAAe;EACf,YAAY"}
@@ -0,0 +1,79 @@
1
+ import { SourceLocation } from "./location.mjs";
2
+ //#region ../../packages/grimoire/src/contracts/findings.d.ts
3
+ /** `error` fails `warlock grimoire check` (exit 1); `warning` is reported and does not. */
4
+ export type GrimoireSeverity = "error" | "warning";
5
+ /** The area of a code, matching its first digit. */
6
+ export type GrimoireCodeArea = "structure" | "links" | "files" | "tests" | "apps" | "changelog" | "tasks" | "book" | "usage";
7
+ /** One entry of the code catalog. Same fields as core's error-code entries, plus a default severity. */
8
+ export type GrimoireCodeDefinition = {
9
+ /** `GR` + four digits. */
10
+ readonly code: string;
11
+ readonly area: GrimoireCodeArea;
12
+ /** The severity a finding gets unless the rule says otherwise. */
13
+ readonly severity: GrimoireSeverity;
14
+ /** One-line name of the problem. */
15
+ readonly title: string;
16
+ /** One-line "what to do". */
17
+ readonly fix: string;
18
+ /** Slug of the skill that explains the fix (`packages/grimoire/skills/<slug>/SKILL.md`). */
19
+ readonly skill: string;
20
+ };
21
+ /** One problem found in the written files, the source files or the book. */
22
+ export type GrimoireFinding = {
23
+ /** Stable code, `warlock explain <code>` describes it. */
24
+ code: string;
25
+ severity: GrimoireSeverity;
26
+ /** What is wrong, naming the value (`route step "POST /wishlist" matches no route`). */
27
+ message: string;
28
+ /** Where to fix it, or `null` when the finding has no single place. */
29
+ at: SourceLocation | null;
30
+ /**
31
+ * `true` when the finding concerns a feature or flow whose status is
32
+ * `proposed`: the code does not exist yet, so the finding is shown as
33
+ * expected and never fails the check.
34
+ */
35
+ expected: boolean;
36
+ /** The feature, flow (`<feature>/<flow>`), app and task the finding is about, when any. */
37
+ subject: {
38
+ feature: string | null;
39
+ flow: string | null;
40
+ app: string | null;
41
+ task: string | null;
42
+ file: string | null;
43
+ };
44
+ /** One line on what to do, from the catalog. */
45
+ hint: string;
46
+ };
47
+ /** What a rule passes to `createFinding()`; the rest comes from the catalog. */
48
+ export type GrimoireFindingInput = {
49
+ code: string;
50
+ message: string;
51
+ at?: SourceLocation | null;
52
+ severity?: GrimoireSeverity;
53
+ feature?: string | null;
54
+ flow?: string | null;
55
+ app?: string | null;
56
+ task?: string | null;
57
+ file?: string | null;
58
+ };
59
+ /** How fresh the route facts were when a report was made. */
60
+ export type RouteFreshness = "fresh" | "cached" | "stale" | "missing";
61
+ /** The result of `checkGrimoire()`, printed by `warlock grimoire check --json`. */
62
+ export type GrimoireCheckReport = {
63
+ schemaVersion: 1;
64
+ /** Absolute project root. */
65
+ root: string;
66
+ /** Unexpected findings first, expected ones last; within each, errors then warnings, then by file and line. */
67
+ findings: GrimoireFinding[];
68
+ counts: {
69
+ errors: number;
70
+ warnings: number;
71
+ expected: number;
72
+ };
73
+ /** `true` when no finding is an unexpected error. The command exits 1 otherwise. */
74
+ ok: boolean;
75
+ /** Route steps are checked against cached facts when `stale`, and skipped when `missing`. */
76
+ routes: RouteFreshness;
77
+ };
78
+ //#endregion
79
+ //# sourceMappingURL=findings.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findings.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/findings.ts"],"mappings":";;;YAUY;;YAGA;;YAYA;;WAED;WACA,MAAM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;;YAIC;;EAEV;EACA,UAAU;;EAEV;;EAEA,IAAI;;;;;;EAMJ;;EAEA;IACE;IACA;IACA;IACA;IACA;;;EAGF;;;YAIU;EACV;EACA;EACA,KAAK;EACL,WAAW;EACX;EACA;EACA;EACA;EACA;;;YAIU;;YAGA;EACV;;EAEA;;EAEA,UAAU;EACV;IAAU;IAAgB;IAAkB;;;EAE5C;;EAEA,QAAQ"}
@@ -0,0 +1,22 @@
1
+ //#region ../../packages/grimoire/src/contracts/location.d.ts
2
+ /**
3
+ * Where a value was read, so a finding can point at it.
4
+ *
5
+ * Every path in Grimoire data is project-relative and uses `/`, on every
6
+ * platform. Convert with `toPosixPath()` before comparing.
7
+ */
8
+ export type SourceLocation = {
9
+ /** Project-relative POSIX path (`grimoire/features/catalog/flows/wishlist.md`). */
10
+ file: string;
11
+ /** 1-based line. */
12
+ line: number;
13
+ /** 1-based column, or `null` when the whole line is meant. */
14
+ column: number | null;
15
+ };
16
+ /** A value with the place it was read from. */
17
+ export type Located<T> = {
18
+ value: T;
19
+ at: SourceLocation;
20
+ };
21
+ //#endregion
22
+ //# sourceMappingURL=location.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/location.ts"],"mappings":";;;;;;;YAMY;;EAEV;;EAEA;;EAEA;;;YAIU,QAAQ;EAClB,OAAO;EACP,IAAI"}
@@ -0,0 +1,53 @@
1
+ import { SourceLocation } from "./location.mjs";
2
+ import { ChangeWord, CriterionId, FeatureVersion } from "./written.mjs";
3
+ //#region ../../packages/grimoire/src/contracts/releases.d.ts
4
+ /** One entry of a collected release. */
5
+ export type ReleaseEntry = {
6
+ feature: string;
7
+ version: FeatureVersion;
8
+ word: ChangeWord;
9
+ flow: string | null;
10
+ criteria: CriterionId[];
11
+ text: string;
12
+ state: "stamped" | "unreleased";
13
+ /** The changelog line. */
14
+ source: SourceLocation;
15
+ };
16
+ /** The collected list of one release. */
17
+ export type ReleaseCollection = {
18
+ release: string;
19
+ /** The release file's `date`. */
20
+ date: string;
21
+ /** By feature id, then newest version first, in changelog order. */
22
+ entries: ReleaseEntry[];
23
+ };
24
+ /**
25
+ * The Markdown written between the markers (`renderCollectedList`):
26
+ *
27
+ * ```md
28
+ * <!-- grimoire:collected:start -->
29
+ * ## Changes
30
+ *
31
+ * ### catalog
32
+ * - 2.1 fixed new-arrivals: a customer with no country saw an empty list (AC-2)
33
+ *
34
+ * ### orders
35
+ * - 3.0 added pay-later: customers can pay within 14 days
36
+ * <!-- grimoire:collected:end -->
37
+ * ```
38
+ *
39
+ * The line grammar is the changelog entry grammar, so the check can read the
40
+ * list back (`WrittenRelease.collected`). With no entries the list says
41
+ * `No feature changes.`.
42
+ */
43
+ export type CollectedListText = string;
44
+ /** What `writeRelease()` did. */
45
+ export type WriteReleaseResult = {
46
+ /** `grimoire/releases/<release>.md`. */
47
+ file: string;
48
+ collection: ReleaseCollection;
49
+ /** `false` when the file already held this exact list. */
50
+ changed: boolean;
51
+ };
52
+ //#endregion
53
+ //# sourceMappingURL=releases.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"releases.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/releases.ts"],"mappings":";;;;YAiBY;EACV;EACA,SAAS;EACT,MAAM;EACN;EACA,UAAU;EACV;EACA;;EAEA,QAAQ;;;YAIE;EACV;;EAEA;;EAEA,SAAS;;;;;;;;;;;;;;;;;;;;;YAsBC;;YAGA;;EAEV;EACA,YAAY;;EAEZ"}
@@ -0,0 +1,143 @@
1
+ import { BookPage, BookRoute } from "./adapter.mjs";
2
+ import { GrimoireFinding, RouteFreshness } from "./findings.mjs";
3
+ import { BookEntry } from "./book.mjs";
4
+ import { WrittenChangelogEntry, WrittenFeatureReadme, WrittenFlow } from "./written.mjs";
5
+ import { FeatureBookmap, FlowBookmap, TaskSummary } from "./bookmap.mjs";
6
+ //#region ../../packages/grimoire/src/contracts/scry.d.ts
7
+ export type ScryQuery =
8
+ /** `warlock scry <file>` */
9
+ {
10
+ type: "file";
11
+ file: string;
12
+ } |
13
+ /** `warlock scry --impact <file>` */
14
+ {
15
+ type: "impact";
16
+ file: string;
17
+ } |
18
+ /** `warlock scry --route "<METHOD path>"` */
19
+ {
20
+ type: "route";
21
+ method: string;
22
+ path: string;
23
+ } |
24
+ /** `warlock scry --feature <id>` */
25
+ {
26
+ type: "feature";
27
+ feature: string;
28
+ } |
29
+ /** `warlock scry --flow <feature>/<flow>` */
30
+ {
31
+ type: "flow";
32
+ feature: string;
33
+ flow: string;
34
+ } |
35
+ /** `warlock scry --search "<text>"`; `limit` defaults to 20. */
36
+ {
37
+ type: "search";
38
+ text: string;
39
+ limit?: number;
40
+ };
41
+ /** Notes every result may carry (stale routes, a book rebuilt on the way). */
42
+ export type ScryNotes = {
43
+ routes: RouteFreshness;
44
+ notes: string[];
45
+ };
46
+ /** A page or screen an answer points at. */
47
+ export type ScryPageRef = {
48
+ app: string;
49
+ route: string;
50
+ file: string;
51
+ type: "page" | "screen";
52
+ };
53
+ export type ScryFileResult = ScryNotes & {
54
+ type: "file";
55
+ entry: BookEntry;
56
+ /** Where the book keeps the entry (`grimoire/book/….json`), or `null` when the file has none. */
57
+ bookEntry: string | null;
58
+ };
59
+ export type ScryImpactResult = Omit<ScryNotes, "routes"> & {
60
+ type: "impact";
61
+ file: string;
62
+ /** Files that import it, transitively, sorted; `direct` are the ones importing it directly. */
63
+ importers: {
64
+ direct: string[];
65
+ all: string[];
66
+ };
67
+ /**
68
+ * API routes (`isPage: false`) whose handler file reaches the file through
69
+ * imports; the routes file counts only when the handler file is unknown.
70
+ */
71
+ routes: Pick<BookRoute, "method" | "path" | "name" | "handlerFile">[];
72
+ pages: ScryPageRef[];
73
+ /** `<feature>/<flow>` whose step files include it. */
74
+ flows: string[];
75
+ /** Owner first, then borrowers: features whose files (not specs) import it, directly or through other files. */
76
+ features: {
77
+ id: string;
78
+ via: "owner" | "borrower";
79
+ }[];
80
+ /** Test files among the importers, plus tests proving the flows above. */
81
+ tests: string[];
82
+ };
83
+ export type ScryRouteResult = ScryNotes & {
84
+ type: "route";
85
+ route: BookRoute;
86
+ /** The handler file and everything it imports, transitively, sorted. */
87
+ files: string[];
88
+ /** Flow steps that name the route. */
89
+ steps: {
90
+ flow: string;
91
+ index: number;
92
+ }[];
93
+ /** Page whose route matches, for a page route. */
94
+ page: BookPage | null;
95
+ };
96
+ export type ScryFeatureResult = ScryNotes & {
97
+ type: "feature";
98
+ readme: WrittenFeatureReadme;
99
+ flows: {
100
+ id: string;
101
+ status: string;
102
+ since: string;
103
+ heading: string | null;
104
+ }[];
105
+ bookmap: FeatureBookmap;
106
+ /** Newest first, at most 10. */
107
+ changes: WrittenChangelogEntry[];
108
+ /** Open tasks naming the feature. */
109
+ tasks: TaskSummary[];
110
+ findings: GrimoireFinding[];
111
+ };
112
+ export type ScryFlowResult = ScryNotes & {
113
+ type: "flow";
114
+ flow: WrittenFlow;
115
+ bookmap: FlowBookmap;
116
+ /** Changelog entries naming the flow, newest first. */
117
+ history: WrittenChangelogEntry[];
118
+ findings: GrimoireFinding[];
119
+ };
120
+ /** What a search hit is. */
121
+ export type ScryHitType = "feature" | "flow" | "block" | "page" | "screen" | "route" | "mail" | "job" | "file" | "export" | "task";
122
+ /** One search hit, ranked. */
123
+ export type ScryHit = {
124
+ type: ScryHitType;
125
+ /**
126
+ * The id to ask about next: a feature id, `<feature>/<flow>`,
127
+ * `<app>/<page>/<block>`, `<app> <route>`, `METHOD path`, a file path,
128
+ * `<file>#<export>`, a mail or job name, or a task id.
129
+ */
130
+ id: string;
131
+ /** Short text shown after the id (a header sentence, a block's flow). */
132
+ detail: string | null;
133
+ /** Higher is better. Only the order is meaningful. */
134
+ score: number;
135
+ };
136
+ export type ScrySearchResult = ScryNotes & {
137
+ type: "search";
138
+ text: string;
139
+ hits: ScryHit[];
140
+ };
141
+ export type ScryResult = ScryFileResult | ScryImpactResult | ScryRouteResult | ScryFeatureResult | ScryFlowResult | ScrySearchResult;
142
+ //#endregion
143
+ //# sourceMappingURL=scry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scry.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/scry.ts"],"mappings":";;;;;;YAWY;;;EAEN;EAAc;;;;EAEd;EAAgB;;;;EAEhB;EAAe;EAAgB;;;;EAE/B;EAAiB;;;;EAEjB;EAAc;EAAiB;;;;EAE/B;EAAgB;EAAc;;;YAGxB;EACV,QAAQ;EACR;;;YAIU;EAAgB;EAAa;EAAe;EAAc;;YAE1D,iBAAiB;EAC3B;EACA,OAAO;;EAEP;;YAIU,mBAAmB,KAAK;EAClC;EACA;;EAEA;IAAa;IAAkB;;;;;;EAK/B,QAAQ,KAAK;EACb,OAAO;;EAEP;;EAEA;IAAY;IAAY;;;EAExB;;YAGU,kBAAkB;EAC5B;EACA,OAAO;;EAEP;;EAEA;IAAS;IAAc;;;EAEvB,MAAM;;YAGI,oBAAoB;EAC9B;EACA,QAAQ;EACR;IAAS;IAAY;IAAgB;IAAe;;EACpD,SAAS;;EAET,SAAS;;EAET,OAAO;EACP,UAAU;;YAGA,iBAAiB;EAC3B;EACA,MAAM;EACN,SAAS;;EAET,SAAS;EACT,UAAU;;;YAIA;;YAcA;EACV,MAAM;;;;;;EAMN;;EAEA;;EAEA;;YAGU,mBAAmB;EAC7B;EACA;EACA,MAAM;;YAGI,aACR,iBACA,mBACA,kBACA,oBACA,iBACA"}
@@ -0,0 +1,52 @@
1
+ import { BookMobileApp, BookSite } from "./adapter.mjs";
2
+ import { GrimoireFinding, RouteFreshness } from "./findings.mjs";
3
+ import { BookAnnotations, LoadedBook } from "./book.mjs";
4
+ import { WrittenGrimoire } from "./written.mjs";
5
+ import { ProofLine, TestResultsStore } from "./test-results.mjs";
6
+ import { CollectedFiles, Ownership } from "./bookmap.mjs";
7
+ //#region ../../packages/grimoire/src/contracts/snapshot.d.ts
8
+ export type GrimoireSnapshot = {
9
+ /** Absolute project root. */
10
+ root: string;
11
+ written: WrittenGrimoire;
12
+ /** Structure errors (`GR1xxx`) from parsing the written files. */
13
+ structure: GrimoireFinding[];
14
+ book: LoadedBook;
15
+ ownership: Ownership;
16
+ /** Written apps matched to the sites and mobile apps the adapter reports, by app id. */
17
+ apps: Record<string, AppMatch>;
18
+ proofs: ProofLine[];
19
+ /** `GR4003`–`GR4005` findings from reading the `@proves` lines. */
20
+ proofFindings: GrimoireFinding[];
21
+ /** `null` when no test run has written results. */
22
+ results: TestResultsStore | null;
23
+ collected: CollectedFiles;
24
+ annotations: BookAnnotations;
25
+ routes: RouteFreshness;
26
+ };
27
+ /** Options of `openGrimoire()`. */
28
+ export type OpenGrimoireOptions = {
29
+ /** See `BuildBookOptions.routes`. Default `cached`. */
30
+ routes?: "fresh" | "cached";
31
+ /** Write the book and the collected files (default `true`). `false` computes in memory only. */
32
+ write?: boolean;
33
+ /** Rebuild every book entry. */
34
+ force?: boolean;
35
+ now?: () => Date;
36
+ };
37
+ /** A check rule: reads the snapshot, returns findings. Never writes. */
38
+ export type GrimoireRule = (snapshot: GrimoireSnapshot) => GrimoireFinding[];
39
+ /**
40
+ * A written app (`grimoire/apps/<id>`) matched by its `root` to what the
41
+ * adapter reports: a `site` app to a `BookSite` with the same root, a
42
+ * `mobile` app to a `BookMobileApp` with the same root. `null` when nothing
43
+ * matches (`GR5005`).
44
+ */
45
+ export type AppMatch = {
46
+ app: string;
47
+ type: "site" | "mobile";
48
+ site: BookSite | null;
49
+ mobile: BookMobileApp | null;
50
+ };
51
+ //#endregion
52
+ //# sourceMappingURL=snapshot.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/snapshot.ts"],"mappings":";;;;;;;YAYY;;EAEV;EACA,SAAS;;EAET,WAAW;EACX,MAAM;EACN,WAAW;;EAEX,MAAM,eAAe;EACrB,QAAQ;;EAER,eAAe;;EAEf,SAAS;EACT,WAAW;EACX,aAAa;EACb,QAAQ;;;YAIE;;EAEV;;EAEA;;EAEA;EACA,YAAY;;;YAIF,gBAAgB,UAAU,qBAAqB;;;;;;;YAQ/C;EACV;EACA;EACA,MAAM;EACN,QAAQ"}
@@ -0,0 +1,63 @@
1
+ import { SourceLocation } from "./location.mjs";
2
+ import { CriterionId, FlowRef } from "./written.mjs";
3
+ //#region ../../packages/grimoire/src/contracts/test-results.d.ts
4
+ /** One `// @proves` line, as `scanProofs()` reads it from a test file. */
5
+ export type ProofLine = {
6
+ feature: string;
7
+ flow: string;
8
+ /** `<feature>/<flow>`. */
9
+ ref: FlowRef;
10
+ criterion: CriterionId;
11
+ /** The `it(…)` / `test(…)` call right under the comment, or `null` when there is none. */
12
+ test: {
13
+ name: string | null;
14
+ line: number;
15
+ } | null;
16
+ /** The comment line itself. */
17
+ at: SourceLocation;
18
+ };
19
+ /** Outcome of one test in one run. */
20
+ export type TestOutcome = "pass" | "fail" | "skip";
21
+ /** The last result of one proving test. */
22
+ export type ProofResult = {
23
+ feature: string;
24
+ flow: string;
25
+ criterion: CriterionId;
26
+ /** Project-relative test file. */
27
+ testFile: string;
28
+ /** Full test name as the runner reports it (`describe > it`). */
29
+ testName: string;
30
+ /** Line of the test call. */
31
+ line: number;
32
+ outcome: TestOutcome;
33
+ durationMs: number | null;
34
+ /** ISO time of the run. */
35
+ ranAt: string;
36
+ /** sha256 of the test file when it ran. A different hash now means the result is stale. */
37
+ testFileHash: string;
38
+ };
39
+ /**
40
+ * `grimoire/book/test-results.json`. A run replaces the results of the test
41
+ * files it ran and keeps the others, so a partial run never forgets results.
42
+ * The book builder never deletes this file.
43
+ */
44
+ export type TestResultsStore = {
45
+ schemaVersion: 1;
46
+ /** ISO time of the last run that wrote it. */
47
+ updatedAt: string;
48
+ runner: "vitest";
49
+ results: ProofResult[];
50
+ };
51
+ /**
52
+ * The status of one criterion, from its proving tests:
53
+ * - `no-test`: no `@proves` line names it;
54
+ * - `fail`: a proving test failed in its last run;
55
+ * - `stale`: none failed, and a result is older than its test file (hash differs);
56
+ * - `not-run`: none failed or is stale, and a proving test has no result;
57
+ * - `pass`: every proving test passed and none is stale.
58
+ *
59
+ * Skipped tests count as not run.
60
+ */
61
+ export type CriterionStatus = "pass" | "fail" | "stale" | "not-run" | "no-test";
62
+ //#endregion
63
+ //# sourceMappingURL=test-results.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-results.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/test-results.ts"],"mappings":";;;;YAaY;EACV;EACA;;EAEA,KAAK;EACL,WAAW;;EAEX;IAAQ;IAAqB;;;EAE7B,IAAI;;;YAIM;;YAGA;EACV;EACA;EACA,WAAW;;EAEX;;EAEA;;EAEA;EACA,SAAS;EACT;;EAEA;;EAEA;;;;;;;YAQU;EACV;;EAEA;EACA;EACA,SAAS;;;;;;;;;;;;YAaC"}