@warlock.js/grimoire 5.56.0 → 5.58.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 (105) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/esm/book/build.d.mts.map +1 -1
  3. package/esm/book/build.mjs +2 -1
  4. package/esm/book/build.mjs.map +1 -1
  5. package/esm/book/render.mjs +10 -0
  6. package/esm/book/render.mjs.map +1 -1
  7. package/esm/bookmap/build.d.mts.map +1 -1
  8. package/esm/bookmap/build.mjs +2 -2
  9. package/esm/bookmap/build.mjs.map +1 -1
  10. package/esm/bookmap/steps.mjs +53 -38
  11. package/esm/bookmap/steps.mjs.map +1 -1
  12. package/esm/check/check-grimoire.d.mts.map +1 -1
  13. package/esm/check/check-grimoire.mjs +4 -1
  14. package/esm/check/check-grimoire.mjs.map +1 -1
  15. package/esm/check/rules/criteria.mjs +21 -2
  16. package/esm/check/rules/criteria.mjs.map +1 -1
  17. package/esm/check/rules/screenshots.mjs +57 -0
  18. package/esm/check/rules/screenshots.mjs.map +1 -0
  19. package/esm/codes/codes.d.mts +12 -0
  20. package/esm/codes/codes.d.mts.map +1 -1
  21. package/esm/codes/codes.mjs +6 -0
  22. package/esm/codes/codes.mjs.map +1 -1
  23. package/esm/contracts/adapter.d.mts +6 -0
  24. package/esm/contracts/adapter.d.mts.map +1 -1
  25. package/esm/contracts/book.d.mts +2 -0
  26. package/esm/contracts/book.d.mts.map +1 -1
  27. package/esm/contracts/book.mjs.map +1 -1
  28. package/esm/contracts/bookmap.d.mts +19 -1
  29. package/esm/contracts/bookmap.d.mts.map +1 -1
  30. package/esm/contracts/snapshot.d.mts +11 -0
  31. package/esm/contracts/snapshot.d.mts.map +1 -1
  32. package/esm/contracts/test-results.d.mts +34 -0
  33. package/esm/contracts/test-results.d.mts.map +1 -1
  34. package/esm/contracts/written.d.mts +44 -0
  35. package/esm/contracts/written.d.mts.map +1 -1
  36. package/esm/contracts/written.mjs.map +1 -1
  37. package/esm/devtools/data.mjs +126 -4
  38. package/esm/devtools/data.mjs.map +1 -1
  39. package/esm/devtools/index.d.mts +31 -1
  40. package/esm/devtools/index.d.mts.map +1 -1
  41. package/esm/devtools/index.mjs +94 -5
  42. package/esm/devtools/index.mjs.map +1 -1
  43. package/esm/devtools/product-map.d.mts +14 -0
  44. package/esm/devtools/product-map.d.mts.map +1 -0
  45. package/esm/devtools/product-map.mjs +385 -0
  46. package/esm/devtools/product-map.mjs.map +1 -0
  47. package/esm/devtools/site.d.mts.map +1 -1
  48. package/esm/devtools/site.mjs +97 -21
  49. package/esm/devtools/site.mjs.map +1 -1
  50. package/esm/devtools/snapshot-source.mjs +71 -22
  51. package/esm/devtools/snapshot-source.mjs.map +1 -1
  52. package/esm/graph/index.d.mts +10 -1
  53. package/esm/graph/index.d.mts.map +1 -1
  54. package/esm/graph/index.mjs +3 -2
  55. package/esm/graph/index.mjs.map +1 -1
  56. package/esm/index.d.mts +4 -4
  57. package/esm/paths/index.d.mts +2 -0
  58. package/esm/paths/index.d.mts.map +1 -1
  59. package/esm/paths/index.mjs +3 -1
  60. package/esm/paths/index.mjs.map +1 -1
  61. package/esm/scry/compact.mjs +169 -0
  62. package/esm/scry/compact.mjs.map +1 -0
  63. package/esm/scry/format.d.mts.map +1 -1
  64. package/esm/scry/format.mjs +7 -1
  65. package/esm/scry/format.mjs.map +1 -1
  66. package/esm/scry/query.d.mts.map +1 -1
  67. package/esm/scry/query.mjs +12 -1
  68. package/esm/scry/query.mjs.map +1 -1
  69. package/esm/test-results/index.d.mts +7 -2
  70. package/esm/test-results/index.d.mts.map +1 -1
  71. package/esm/test-results/index.mjs +79 -12
  72. package/esm/test-results/index.mjs.map +1 -1
  73. package/esm/vitest/index.d.mts +6 -0
  74. package/esm/vitest/index.d.mts.map +1 -1
  75. package/esm/vitest/index.mjs +22 -6
  76. package/esm/vitest/index.mjs.map +1 -1
  77. package/esm/warlock/adapter.d.mts.map +1 -1
  78. package/esm/warlock/adapter.mjs +6 -2
  79. package/esm/warlock/adapter.mjs.map +1 -1
  80. package/esm/warlock/mcp-tools.mjs +48 -12
  81. package/esm/warlock/mcp-tools.mjs.map +1 -1
  82. package/esm/workspace/index.d.mts.map +1 -1
  83. package/esm/workspace/index.mjs +4 -2
  84. package/esm/workspace/index.mjs.map +1 -1
  85. package/esm/written/apps.mjs +4 -2
  86. package/esm/written/apps.mjs.map +1 -1
  87. package/esm/written/features.mjs +119 -6
  88. package/esm/written/features.mjs.map +1 -1
  89. package/esm/written/markdown.mjs +66 -1
  90. package/esm/written/markdown.mjs.map +1 -1
  91. package/esm/written/parse-grimoire.d.mts.map +1 -1
  92. package/esm/written/parse-grimoire.mjs +1 -1
  93. package/esm/written/parse-grimoire.mjs.map +1 -1
  94. package/llms-full.txt +77 -2
  95. package/package.json +3 -3
  96. package/skills/backfill-a-grimoire/SKILL.md +5 -0
  97. package/skills/describe-an-app/SKILL.md +12 -0
  98. package/skills/record-a-change/SKILL.md +8 -0
  99. package/skills/use-the-grimoire/SKILL.md +15 -0
  100. package/skills/write-a-feature/SKILL.md +37 -2
  101. package/ui/grimoire-static.js +4 -0
  102. package/ui/grimoire-view.js +2283 -428
  103. package/ui/grimoire.css +1036 -45
  104. package/ui/product-map.css +636 -0
  105. package/ui/product-map.js +817 -0
@@ -20,6 +20,11 @@ export type GrimoireSnapshot = {
20
20
  proofFindings: GrimoireFinding[];
21
21
  /** `null` when no test run has written results. */
22
22
  results: TestResultsStore | null;
23
+ /**
24
+ * Project-relative path the results were read from (or would be): the
25
+ * `testResultsFile` option, else `grimoire/book/test-results.json`.
26
+ */
27
+ resultsFile: string;
23
28
  collected: CollectedFiles;
24
29
  annotations: BookAnnotations;
25
30
  routes: RouteFreshness;
@@ -32,6 +37,12 @@ export type OpenGrimoireOptions = {
32
37
  write?: boolean;
33
38
  /** Rebuild every book entry. */
34
39
  force?: boolean;
40
+ /**
41
+ * Where to read the test results from: a project-relative or absolute path.
42
+ * Default `grimoire/book/test-results.json` (what the Vitest reporter
43
+ * writes). A deploy that ships results from CI points here.
44
+ */
45
+ testResultsFile?: string;
35
46
  now?: () => Date;
36
47
  };
37
48
  /** A check rule: reads the snapshot, returns findings. Never writes. */
@@ -1 +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"}
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;;;;;EAKT;EACA,WAAW;EACX,aAAa;EACb,QAAQ;;;YAIE;;EAEV;;EAEA;;EAEA;;;;;;EAMA;EACA,YAAY;;;YAIF,gBAAgB,UAAU,qBAAqB;;;;;;;YAQ/C;EACV;EACA;EACA,MAAM;EACN,QAAQ"}
@@ -47,6 +47,40 @@ export type TestResultsStore = {
47
47
  updatedAt: string;
48
48
  runner: "vitest";
49
49
  results: ProofResult[];
50
+ /**
51
+ * `@proves` lines of the files the runs covered whose test the reporter
52
+ * could not match to a result (`GR4010`). Replaced per test file like
53
+ * `results`. Absent in stores written before 5.58.
54
+ */
55
+ unmatched?: UnmatchedProof[];
56
+ };
57
+ /** A proving test the reporter saw in a run file but could not match to a test result. */
58
+ export type UnmatchedProof = {
59
+ feature: string;
60
+ flow: string;
61
+ criterion: CriterionId;
62
+ testFile: string;
63
+ /** Line of the `@proves` comment. */
64
+ line: number;
65
+ };
66
+ /**
67
+ * What the readers know about the results store: whether one was read, from
68
+ * where, and how many proving tests have a result. The devtools answers carry
69
+ * it so a view can tell "never recorded" apart from "did not run".
70
+ */
71
+ export type TestResultsInfo = {
72
+ /** `true` when a results store was read. */
73
+ recorded: boolean;
74
+ /** Project-relative path the store was read from, or would be read from. */
75
+ file: string;
76
+ /** `updatedAt` of the store, or `null`. */
77
+ updatedAt: string | null;
78
+ /** `@proves` lines in the project. */
79
+ proofs: number;
80
+ /** Proving tests with a result in the store. */
81
+ withResult: number;
82
+ /** Entries of `unmatched` (0 when absent). */
83
+ unmatched: number;
50
84
  };
51
85
  /**
52
86
  * The status of one criterion, from its proving tests:
@@ -1 +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"}
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;;;;;;EAMT,YAAY;;;YAIF;EACV;EACA;EACA,WAAW;EACX;;EAEA;;;;;;;YAQU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;YAaU"}
@@ -10,6 +10,20 @@ export type FeatureVersion = string;
10
10
  export type FlowRef = string;
11
11
  /** A criterion id: `AC-<n>`. */
12
12
  export type CriterionId = string;
13
+ /**
14
+ * An image line `![<alt>](<path>)` in a written file, outside code fences.
15
+ * The path is written relative to the Markdown file (so it renders on a git
16
+ * host) and must point inside `grimoire/screenshots/` (`GR1029` otherwise).
17
+ */
18
+ export type WrittenScreenshot = {
19
+ /** The alt text; `""` when none is written. */
20
+ alt: string;
21
+ /** As written in the file. */
22
+ written: string;
23
+ /** Path under `grimoire/screenshots/` (`web/product-page.png`), or `null` when it points elsewhere. */
24
+ path: string | null;
25
+ at: SourceLocation;
26
+ };
13
27
  /** One `- name text` line of a list section. */
14
28
  export type WrittenListLine = {
15
29
  /** The first word or phrase (a flow id, an app id, a condition name, a question). */
@@ -37,6 +51,14 @@ export type WrittenFeatureReadme = {
37
51
  heading: Located<string> | null;
38
52
  /** The paragraph under the heading, or `null`. */
39
53
  summary: string | null;
54
+ /**
55
+ * Front matter `audience`: who the feature is for, in the owner's words
56
+ * (`[shoppers, store staff]`). Empty when not written; readers then use the
57
+ * flows' `who` values.
58
+ */
59
+ audience: Located<string>[];
60
+ /** `## Why`: the paragraphs of the optional section, joined with a blank line, or `null`. */
61
+ why: string | null;
40
62
  /** `## Flows`: `- <flow-id> <what it does>`. */
41
63
  flows: WrittenListLine[];
42
64
  /** `## Affects and affected by`: free lines; references `<feature>/<flow>` are read from them. */
@@ -125,6 +147,20 @@ export type WrittenCase = {
125
147
  answer: string;
126
148
  /** The answer starts with `does not apply`. */
127
149
  doesNotApply: boolean;
150
+ /** Criteria named in a trailing `(AC-n[, AC-m])` of the answer (removed from `answer`). Empty when none. */
151
+ criteria: CriterionId[];
152
+ at: SourceLocation;
153
+ };
154
+ /**
155
+ * One `<n>. <sentence>` line of the optional `## Story` section: a step in
156
+ * the user's words, for readers who do not read code. Continuation lines are
157
+ * joined; image lines inside the item attach screenshots.
158
+ */
159
+ export type WrittenStoryStep = {
160
+ index: number;
161
+ /** The sentence, without image lines. */
162
+ text: string;
163
+ screenshots: WrittenScreenshot[];
128
164
  at: SourceLocation;
129
165
  };
130
166
  /** One `- AC-<n>[ [app-id]] <text>` line of `## Acceptance criteria`. */
@@ -151,6 +187,10 @@ export type WrittenFlow = {
151
187
  who: Located<string>;
152
188
  origin: Located<WrittenOrigin> | null;
153
189
  heading: Located<string> | null;
190
+ /** The paragraph under the `# Title`: what the flow does, in one or two sentences. `null` when not written (`GR1030`). */
191
+ summary: string | null;
192
+ /** `## Story`: the steps in the user's words. Empty when the section is not written. */
193
+ story: WrittenStoryStep[];
154
194
  steps: WrittenStep[];
155
195
  /** `## Differs by app`: `- <app-id> <what differs>`. */
156
196
  differs: WrittenListLine[];
@@ -225,6 +265,8 @@ export type WrittenBlockFile = {
225
265
  heading: Located<string> | null;
226
266
  /** `- <key> <value>` lines. */
227
267
  details: WrittenListLine[];
268
+ /** Image lines of the file (what the block looks like). */
269
+ screenshots: WrittenScreenshot[];
228
270
  };
229
271
  /** One `- <kind> <name>` line of `## Also reached from`. */
230
272
  export type WrittenEntryPoint = {
@@ -254,6 +296,8 @@ export type WrittenPage = {
254
296
  heading: Located<string> | null;
255
297
  /** The paragraph under the heading, or `null`. */
256
298
  purpose: string | null;
299
+ /** Image lines of the README (what the page or screen looks like). */
300
+ screenshots: WrittenScreenshot[];
257
301
  blocks: WrittenBlockRow[];
258
302
  alsoReachedFrom: WrittenEntryPoint[];
259
303
  blockFiles: WrittenBlockFile[];
@@ -1 +1 @@
1
- {"version":3,"file":"written.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/written.ts"],"mappings":";;;YAeY;;YAGA;;YAGA;;YAGA;;YAGA;;YAGA;;EAEV;;EAEA;EACA,IAAI;;;YAMM;EACV;;EAEA,IAAI;EACJ,OAAO;EACP,QAAQ,QAAQ;EAChB,SAAS,QAAQ;;EAEjB,SAAS;;EAET,MAAM;;EAEN,SAAS;EACT,QAAQ,QAAQ;;EAEhB,SAAS;;EAET;;E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A,IAAI;EACJ,MAAM;;EAEN,MAAM;;EAEN,QAAQ,QAAQ;EAChB,SAAS;;EAET,YAAY;EACZ,SAAS;EACT,OAAO;EACP,SAAS;;YAKC;YAEA;;;;;YAaA;EACV;;EAEA;;EAEA;;EAEA,IAAI;EACJ,MAAM,QAAQ;EACd,SAAS;;EAET,MAAM;EACN,MAAM;EACN,QAAQ,QAAQ;;EAEhB,SAAS;IAAU;IAAiB,SAAS;;EAC7C,SAAS;;EAET;IAAU;IAAa;IAAe,IAAI;;;EAE1C;;;qBAMW;qBACA;;YAGD;EACV;EACA,SAAS;EACT,MAAM;EACN;EACA,UAAU;EACV;EACA,IAAI;;;YAIM;EACV;;EAEA,SAAS;;EAET,MAAM;EACN,SAAS;;EAET;;EAEA;IAAa,OAAO;IAAgB,KAAK;IAAgB,SAAS;;;;YAMxD;;EAEV;;EAEA;EACA,UAAU;EACV,MAAM;EACN,OAAO;EACP,UAAU;;;;;EAKV"}
1
+ {"version":3,"file":"written.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/written.ts"],"mappings":";;;YAeY;;YAGA;;YAGA;;YAGA;;YAGA;;;;;;YAOA;;EAEV;;EAEA;;EAEA;EACA,IAAI;;;YAIM;;EAEV;;EAEA;EACA,IAAI;;;YAMM;EACV;;EAEA,IAAI;EACJ,OAAO;EACP,QAAQ,QAAQ;EAChB,SAAS,QAAQ;;EAEjB,SAAS;;EAET,MAAM;;EAEN,SAAS;EACT,QAAQ,QAAQ;;EAEhB,SAAS;;EAET;;;;;;EAMA,UAAU;;EAEV;;EAEA,OAAO;;EAEP;IAAa;IAAc,MAAM;IAAW,IAAI;;;;YAItC;;;;;;YAOA;EACV;EACA,SAAS,QAAQ;EACjB,MAAM;;EAEN;;EAEA,UAAU;;EAEV;;EAEA;;EAEA;EACA,IAAI;;;;;;YAOM;EACV;EACA;EACA,IAAI;;;YAIM;EACV;EACA,UAAU;EACV,SAAS;;;YAIC;;YAWA;;EAEV;EACA,MAAM;;EA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EAEA,IAAI;EACJ,MAAM,QAAQ;EACd,SAAS;;EAET,MAAM;EACN,MAAM;EACN,QAAQ,QAAQ;;EAEhB,SAAS;IAAU;IAAiB,SAAS;;EAC7C,SAAS;;EAET;IAAU;IAAa;IAAe,IAAI;;;EAE1C;;;qBAMW;qBACA;;YAGD;EACV;EACA,SAAS;EACT,MAAM;EACN;EACA,UAAU;EACV;EACA,IAAI;;;YAIM;EACV;;EAEA,SAAS;;EAET,MAAM;EACN,SAAS;;EAET;;EAEA;IAAa,OAAO;IAAgB,KAAK;IAAgB,SAAS;;;;YAMxD;;EAEV;;EAEA;EACA,UAAU;EACV,MAAM;EACN,OAAO;EACP,UAAU;;;;;EAKV"}
@@ -1 +1 @@
1
- {"version":3,"file":"written.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/written.ts"],"sourcesContent":["/**\n * The agent-written files under `grimoire/`, as the parser (`parseGrimoire`)\n * returns them. Warlock reads these files and never edits them, except the\n * collected list between the markers of a release file.\n *\n * Every value that a check may point at carries its location. Absent\n * optional values are `null`, never `undefined`.\n *\n * The grammar of each file is fixed (see the docs page \"Written files\"):\n * front matter between `---` lines (`key: value`, inline lists `[a, b]` or\n * `- item` lines under the key), then Markdown with fixed headings.\n */\nimport type { Located, SourceLocation } from \"./location\";\n\n/** Status of a feature or a flow. */\nexport type WrittenStatus = \"proposed\" | \"building\" | \"shipped\" | \"retired\";\n\n/** Whether the description was written from the code (`inferred`) or confirmed by the owner. */\nexport type WrittenOrigin = \"inferred\" | \"confirmed\";\n\n/** A feature version: `<whole>.<decimal>` (`2.1`). */\nexport type FeatureVersion = string;\n\n/** A flow reference: `<feature>/<flow>`. */\nexport type FlowRef = string;\n\n/** A criterion id: `AC-<n>`. */\nexport type CriterionId = string;\n\n/** One `- name text` line of a list section. */\nexport type WrittenListLine = {\n /** The first word or phrase (a flow id, an app id, a condition name, a question). */\n name: string;\n /** The rest of the line, continuation lines joined with a space. */\n text: string;\n at: SourceLocation;\n};\n\n// ── Features ───────────────────────────────────────────────────────────────\n\n/** `grimoire/features/<id>/README.md`. */\nexport type WrittenFeatureReadme = {\n file: string;\n /** Front matter `id`; must equal the folder name. */\n id: Located<string>;\n title: Located<string>;\n status: Located<WrittenStatus>;\n version: Located<FeatureVersion>;\n /** `yyyy-mm-dd`. */\n updated: Located<string>;\n /** App ids under `grimoire/apps/`. */\n apps: Located<string>[];\n /** Project-relative folders whose files the feature owns; an entry with a code-file extension names one file. */\n folders: Located<string>[];\n origin: Located<WrittenOrigin> | null;\n /** The `# Heading`. */\n heading: Located<string> | null;\n /** The paragraph under the heading, or `null`. */\n summary: string | null;\n /** `## Flows`: `- <flow-id> <what it does>`. */\n flows: WrittenListLine[];\n /** `## Affects and affected by`: free lines; references `<feature>/<flow>` are read from them. */\n relations: { text: string; refs: FlowRef[]; at: SourceLocation }[];\n};\n\n/** A changed-word of a changelog entry. */\nexport type ChangeWord = \"added\" | \"changed\" | \"fixed\" | \"removed\";\n\n/**\n * One changelog entry:\n * `- <version> <word> [<flow>: ]<text>[ (AC-n[, AC-m])]`, continuation\n * lines indented.\n */\nexport type WrittenChangelogEntry = {\n feature: string;\n version: Located<FeatureVersion>;\n word: ChangeWord;\n /** The flow id named before `:`, or `null`. */\n flow: string | null;\n /** Criteria named in the trailing parentheses. */\n criteria: CriterionId[];\n /** The text without the flow prefix and the criteria. */\n text: string;\n /** `null` while under `## Unreleased`; the section's release once the agent moved it. */\n release: string | null;\n /** `yyyy-mm-dd` of the release section, or `null`. */\n date: string | null;\n at: SourceLocation;\n};\n\n/**\n * A changelog section: `## Unreleased`, or `## <release> (<yyyy-mm-dd>)`\n * for a release the agent stamped.\n */\nexport type WrittenChangelogSection = {\n release: string | null;\n date: string | null;\n at: SourceLocation;\n};\n\n/** `grimoire/features/<id>/CHANGELOG.md`, newest first. */\nexport type WrittenChangelog = {\n file: string;\n sections: WrittenChangelogSection[];\n entries: WrittenChangelogEntry[];\n};\n\n/** Flow step kinds. `affects` names an effect on another feature. */\nexport type StepType =\n | \"page\"\n | \"route\"\n | \"mail\"\n | \"notification\"\n | \"job\"\n | \"event\"\n | \"outside service\"\n | \"affects\";\n\n/** One `<n>. <kind> <target>[ — note]` line of `## Steps`. */\nexport type WrittenStep = {\n /** The number written before the dot. */\n index: number;\n type: StepType;\n /** The name as written (`POST /wishlist`, `/products/:id`, `order-confirmation`, `catalog/stock`). */\n target: string;\n /**\n * For a page step written `/support [web-admin]`: the app the page is in\n * (the target is then the path alone). `null` for every other step.\n */\n app: string | null;\n /** For a route step: the uppercase method and the path. */\n route: { method: string; path: string } | null;\n /** For an affects step: the feature and, when given, the flow. */\n affects: { feature: string; flow: string | null } | null;\n /** Text after ` — ` (or ` -- `), or `null`. */\n note: string | null;\n at: SourceLocation;\n};\n\n/** The fixed case questions every flow answers (in `## Cases` or `## Not handled`). */\nexport const CASE_QUESTIONS = [\n \"invalid input\",\n \"not allowed\",\n \"not found\",\n \"duplicate\",\n \"limits\",\n \"expiry\",\n \"double submit\",\n \"outside service down\",\n] as const;\n\n/** One fixed case question. */\nexport type CaseQuestion = (typeof CASE_QUESTIONS)[number];\n\n/** One `- <question> <answer>` line of `## Cases`. */\nexport type WrittenCase = {\n /** The question, lower-case (`double submit`), or the owner's own case label. */\n question: string;\n /** Whether `question` is one of {@link CASE_QUESTIONS}. */\n fixed: boolean;\n answer: string;\n /** The answer starts with `does not apply`. */\n doesNotApply: boolean;\n at: SourceLocation;\n};\n\n/** One `- AC-<n>[ [app-id]] <text>` line of `## Acceptance criteria`. */\nexport type WrittenCriterion = {\n id: CriterionId;\n number: number;\n /** The app the criterion is scoped to, or `null` for every app. */\n app: string | null;\n text: string;\n at: SourceLocation;\n};\n\n/** `grimoire/features/<feature>/flows/<id>.md`. */\nexport type WrittenFlow = {\n file: string;\n feature: string;\n /** Front matter `id`; must equal the file name without `.md`. */\n id: Located<string>;\n /** `<feature>/<id>`. */\n ref: FlowRef;\n /** The feature version that introduced the flow. */\n since: Located<FeatureVersion>;\n status: Located<WrittenStatus>;\n /** Who walks the flow (`customer`, `guest`, `admin`, `system`). Free text. */\n who: Located<string>;\n origin: Located<WrittenOrigin> | null;\n heading: Located<string> | null;\n steps: WrittenStep[];\n /** `## Differs by app`: `- <app-id> <what differs>`. */\n differs: WrittenListLine[];\n cases: WrittenCase[];\n /** `## Not handled`: questions the code does not handle yet. */\n notHandled: WrittenListLine[];\n /** Every line starting with `Unknown:` anywhere in the flow. */\n unknowns: { text: string; at: SourceLocation }[];\n criteria: WrittenCriterion[];\n};\n\n/** `grimoire/features/<feature>/versions/v<n>.md`: the brief before a whole-number version. */\nexport type WrittenVersionBrief = {\n file: string;\n feature: string;\n /** The whole number from the file name (`3` for `v3.md`). */\n major: number;\n heading: Located<string> | null;\n};\n\n/** One feature folder. */\nexport type WrittenFeature = {\n id: string;\n /** `grimoire/features/<id>`. */\n dir: string;\n /** `null` when the folder has no README (a structure error). */\n readme: WrittenFeatureReadme | null;\n changelog: WrittenChangelog | null;\n flows: WrittenFlow[];\n versions: WrittenVersionBrief[];\n};\n\n// ── Apps ───────────────────────────────────────────────────────────────────\n\n/** Who sees a block: `everyone`, or condition names of the app. */\nexport type WrittenWho = {\n everyone: boolean;\n conditions: string[];\n};\n\n/** One `Changes with` item: `<condition>: <text>`, or free text with no condition. */\nexport type WrittenChangesWith = {\n condition: string | null;\n text: string;\n};\n\n/** One row of a `## Blocks` table: `| Block | Flow | Who sees it | Changes with |`. */\nexport type WrittenBlockRow = {\n block: string;\n /** `<feature>/<flow>`, or `null` for `—`. */\n flow: FlowRef | null;\n who: WrittenWho;\n /** Empty for `—`. Items are separated by `;`. */\n changesWith: WrittenChangesWith[];\n at: SourceLocation;\n};\n\n/** `grimoire/apps/<app>/layouts/<id>.md`. */\nexport type WrittenLayout = {\n file: string;\n app: string;\n /** The file name without `.md`. */\n id: string;\n /** Front matter `origin`, when given. */\n origin: Located<WrittenOrigin> | null;\n heading: Located<string> | null;\n blocks: WrittenBlockRow[];\n};\n\n/** `grimoire/apps/<app>/pages/<page>/blocks/<id>.md`. */\nexport type WrittenBlockFile = {\n file: string;\n app: string;\n /** The page or screen folder name. */\n page: string;\n id: string;\n flow: Located<FlowRef> | null;\n heading: Located<string> | null;\n /** `- <key> <value>` lines. */\n details: WrittenListLine[];\n};\n\n/** One `- <kind> <name>` line of `## Also reached from`. */\nexport type WrittenEntryPoint = {\n /** `mail`, `notification`, `page`, `screen`, `outside service`, or another word. */\n type: string;\n name: string;\n at: SourceLocation;\n};\n\n/**\n * `grimoire/apps/<app>/pages/<id>/README.md` (a site page) or\n * `grimoire/apps/<app>/screens/<id>/README.md` (a mobile screen).\n */\nexport type WrittenPage = {\n file: string;\n app: string;\n type: \"page\" | \"screen\";\n /** The folder name. */\n id: string;\n /** Front matter `route`: the page's route path, or a screen's file-based route. */\n route: Located<string> | null;\n /** Front matter `screen`: the screen name used by code-defined navigation. */\n screen: Located<string> | null;\n /** Front matter `layout`: a file in the app's `layouts/`. */\n layout: Located<string> | null;\n /** Front matter `origin`, when given. */\n origin: Located<WrittenOrigin> | null;\n heading: Located<string> | null;\n /** The paragraph under the heading, or `null`. */\n purpose: string | null;\n blocks: WrittenBlockRow[];\n alsoReachedFrom: WrittenEntryPoint[];\n blockFiles: WrittenBlockFile[];\n};\n\n/** `grimoire/apps/<id>/README.md` and everything under that folder. */\nexport type WrittenApp = {\n /** `grimoire/apps/<id>`. */\n dir: string;\n /** `README.md`, or `null` when missing (a structure error). */\n file: string | null;\n /** Front matter `id`; must equal the folder name. */\n id: Located<string>;\n type: Located<\"site\" | \"mobile\">;\n /** Project-relative root of the site or mobile app (`src/web/$sites/client`, `mobile`). */\n root: Located<string>;\n /** Front matter `origin`, when given. */\n origin: Located<WrittenOrigin> | null;\n heading: Located<string> | null;\n /** `## Conditions`: `- <name> <meaning>`. */\n conditions: WrittenListLine[];\n layouts: WrittenLayout[];\n pages: WrittenPage[];\n screens: WrittenPage[];\n};\n\n// ── Tasks ──────────────────────────────────────────────────────────────────\n\nexport type TaskType = \"bug\" | \"feature\" | \"decision\" | \"chore\";\n\nexport type TaskStatus =\n | \"open\"\n | \"waiting for approval\"\n | \"approved\"\n | \"in progress\"\n | \"blocked\"\n | \"done\"\n | \"dropped\";\n\n/**\n * `grimoire/tasks/open/T-<n>-<slug>.md` or\n * `grimoire/tasks/done/<yyyy-mm>/T-<n>-<slug>.md`.\n */\nexport type WrittenTask = {\n file: string;\n /** Which folder holds it. */\n folder: \"open\" | \"done\";\n /** `yyyy-mm` of the done folder, or `null` for open tasks. */\n month: string | null;\n /** `T-<n>`. */\n id: Located<string>;\n type: Located<TaskType>;\n feature: Located<string> | null;\n /** Flow id within `feature`, or a full `<feature>/<flow>`; stored as written. */\n flow: Located<string> | null;\n apps: Located<string>[];\n status: Located<TaskStatus>;\n /** `shipped: <feature> <version>`, once done. */\n shipped: Located<{ feature: string; version: FeatureVersion }> | null;\n heading: Located<string> | null;\n /** `- <Key>: <value>` lines of the body (`Asked by`, `Why`, `Brief`, `Decision needed`, …). */\n fields: { key: string; value: string; at: SourceLocation }[];\n /** The `Decision needed` value, or `null`. */\n decisionNeeded: string | null;\n};\n\n// ── Releases ───────────────────────────────────────────────────────────────\n\n/** Markers around the list Warlock writes into a release file. */\nexport const COLLECTED_START_MARKER = \"<!-- grimoire:collected:start -->\";\nexport const COLLECTED_END_MARKER = \"<!-- grimoire:collected:end -->\";\n\n/** One line of a release file's collected list, read back. */\nexport type WrittenReleaseListed = {\n feature: string;\n version: FeatureVersion;\n word: ChangeWord;\n flow: string | null;\n criteria: CriterionId[];\n text: string;\n at: SourceLocation;\n};\n\n/** `grimoire/releases/<release>.md`. */\nexport type WrittenRelease = {\n file: string;\n /** Front matter `release`; must equal the file name without `.md`. */\n release: Located<string>;\n /** `yyyy-mm-dd`. */\n date: Located<string>;\n heading: Located<string> | null;\n /** The agent's brief: the text between the heading and the collected list. */\n brief: string;\n /** The list between the markers; `null` when the release command has not run yet. */\n collected: { start: SourceLocation; end: SourceLocation; entries: WrittenReleaseListed[] } | null;\n};\n\n// ── Everything ─────────────────────────────────────────────────────────────\n\n/** Every written file of a project, parsed. */\nexport type WrittenGrimoire = {\n /** Absolute project root. */\n root: string;\n /** `false` when the project has no `grimoire/` folder (book-only mode). */\n exists: boolean;\n features: WrittenFeature[];\n apps: WrittenApp[];\n tasks: WrittenTask[];\n releases: WrittenRelease[];\n /**\n * sha256 over the path and content of every written file, in path order.\n * The book manifest stores it to know when ownership and book maps change.\n */\n hash: string;\n};\n"],"mappings":";;AA4IA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AA8NA,MAAa,yBAAyB;AACtC,MAAa,uBAAuB"}
1
+ {"version":3,"file":"written.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/contracts/written.ts"],"sourcesContent":["/**\n * The agent-written files under `grimoire/`, as the parser (`parseGrimoire`)\n * returns them. Warlock reads these files and never edits them, except the\n * collected list between the markers of a release file.\n *\n * Every value that a check may point at carries its location. Absent\n * optional values are `null`, never `undefined`.\n *\n * The grammar of each file is fixed (see the docs page \"Written files\"):\n * front matter between `---` lines (`key: value`, inline lists `[a, b]` or\n * `- item` lines under the key), then Markdown with fixed headings.\n */\nimport type { Located, SourceLocation } from \"./location\";\n\n/** Status of a feature or a flow. */\nexport type WrittenStatus = \"proposed\" | \"building\" | \"shipped\" | \"retired\";\n\n/** Whether the description was written from the code (`inferred`) or confirmed by the owner. */\nexport type WrittenOrigin = \"inferred\" | \"confirmed\";\n\n/** A feature version: `<whole>.<decimal>` (`2.1`). */\nexport type FeatureVersion = string;\n\n/** A flow reference: `<feature>/<flow>`. */\nexport type FlowRef = string;\n\n/** A criterion id: `AC-<n>`. */\nexport type CriterionId = string;\n\n/**\n * An image line `![<alt>](<path>)` in a written file, outside code fences.\n * The path is written relative to the Markdown file (so it renders on a git\n * host) and must point inside `grimoire/screenshots/` (`GR1029` otherwise).\n */\nexport type WrittenScreenshot = {\n /** The alt text; `\"\"` when none is written. */\n alt: string;\n /** As written in the file. */\n written: string;\n /** Path under `grimoire/screenshots/` (`web/product-page.png`), or `null` when it points elsewhere. */\n path: string | null;\n at: SourceLocation;\n};\n\n/** One `- name text` line of a list section. */\nexport type WrittenListLine = {\n /** The first word or phrase (a flow id, an app id, a condition name, a question). */\n name: string;\n /** The rest of the line, continuation lines joined with a space. */\n text: string;\n at: SourceLocation;\n};\n\n// ── Features ───────────────────────────────────────────────────────────────\n\n/** `grimoire/features/<id>/README.md`. */\nexport type WrittenFeatureReadme = {\n file: string;\n /** Front matter `id`; must equal the folder name. */\n id: Located<string>;\n title: Located<string>;\n status: Located<WrittenStatus>;\n version: Located<FeatureVersion>;\n /** `yyyy-mm-dd`. */\n updated: Located<string>;\n /** App ids under `grimoire/apps/`. */\n apps: Located<string>[];\n /** Project-relative folders whose files the feature owns; an entry with a code-file extension names one file. */\n folders: Located<string>[];\n origin: Located<WrittenOrigin> | null;\n /** The `# Heading`. */\n heading: Located<string> | null;\n /** The paragraph under the heading, or `null`. */\n summary: string | null;\n /**\n * Front matter `audience`: who the feature is for, in the owner's words\n * (`[shoppers, store staff]`). Empty when not written; readers then use the\n * flows' `who` values.\n */\n audience: Located<string>[];\n /** `## Why`: the paragraphs of the optional section, joined with a blank line, or `null`. */\n why: string | null;\n /** `## Flows`: `- <flow-id> <what it does>`. */\n flows: WrittenListLine[];\n /** `## Affects and affected by`: free lines; references `<feature>/<flow>` are read from them. */\n relations: { text: string; refs: FlowRef[]; at: SourceLocation }[];\n};\n\n/** A changed-word of a changelog entry. */\nexport type ChangeWord = \"added\" | \"changed\" | \"fixed\" | \"removed\";\n\n/**\n * One changelog entry:\n * `- <version> <word> [<flow>: ]<text>[ (AC-n[, AC-m])]`, continuation\n * lines indented.\n */\nexport type WrittenChangelogEntry = {\n feature: string;\n version: Located<FeatureVersion>;\n word: ChangeWord;\n /** The flow id named before `:`, or `null`. */\n flow: string | null;\n /** Criteria named in the trailing parentheses. */\n criteria: CriterionId[];\n /** The text without the flow prefix and the criteria. */\n text: string;\n /** `null` while under `## Unreleased`; the section's release once the agent moved it. */\n release: string | null;\n /** `yyyy-mm-dd` of the release section, or `null`. */\n date: string | null;\n at: SourceLocation;\n};\n\n/**\n * A changelog section: `## Unreleased`, or `## <release> (<yyyy-mm-dd>)`\n * for a release the agent stamped.\n */\nexport type WrittenChangelogSection = {\n release: string | null;\n date: string | null;\n at: SourceLocation;\n};\n\n/** `grimoire/features/<id>/CHANGELOG.md`, newest first. */\nexport type WrittenChangelog = {\n file: string;\n sections: WrittenChangelogSection[];\n entries: WrittenChangelogEntry[];\n};\n\n/** Flow step kinds. `affects` names an effect on another feature. */\nexport type StepType =\n | \"page\"\n | \"route\"\n | \"mail\"\n | \"notification\"\n | \"job\"\n | \"event\"\n | \"outside service\"\n | \"affects\";\n\n/** One `<n>. <kind> <target>[ — note]` line of `## Steps`. */\nexport type WrittenStep = {\n /** The number written before the dot. */\n index: number;\n type: StepType;\n /** The name as written (`POST /wishlist`, `/products/:id`, `order-confirmation`, `catalog/stock`). */\n target: string;\n /**\n * For a page step written `/support [web-admin]`: the app the page is in\n * (the target is then the path alone). `null` for every other step.\n */\n app: string | null;\n /** For a route step: the uppercase method and the path. */\n route: { method: string; path: string } | null;\n /** For an affects step: the feature and, when given, the flow. */\n affects: { feature: string; flow: string | null } | null;\n /** Text after ` — ` (or ` -- `), or `null`. */\n note: string | null;\n at: SourceLocation;\n};\n\n/** The fixed case questions every flow answers (in `## Cases` or `## Not handled`). */\nexport const CASE_QUESTIONS = [\n \"invalid input\",\n \"not allowed\",\n \"not found\",\n \"duplicate\",\n \"limits\",\n \"expiry\",\n \"double submit\",\n \"outside service down\",\n] as const;\n\n/** One fixed case question. */\nexport type CaseQuestion = (typeof CASE_QUESTIONS)[number];\n\n/** One `- <question> <answer>` line of `## Cases`. */\nexport type WrittenCase = {\n /** The question, lower-case (`double submit`), or the owner's own case label. */\n question: string;\n /** Whether `question` is one of {@link CASE_QUESTIONS}. */\n fixed: boolean;\n answer: string;\n /** The answer starts with `does not apply`. */\n doesNotApply: boolean;\n /** Criteria named in a trailing `(AC-n[, AC-m])` of the answer (removed from `answer`). Empty when none. */\n criteria: CriterionId[];\n at: SourceLocation;\n};\n\n/**\n * One `<n>. <sentence>` line of the optional `## Story` section: a step in\n * the user's words, for readers who do not read code. Continuation lines are\n * joined; image lines inside the item attach screenshots.\n */\nexport type WrittenStoryStep = {\n index: number;\n /** The sentence, without image lines. */\n text: string;\n screenshots: WrittenScreenshot[];\n at: SourceLocation;\n};\n\n/** One `- AC-<n>[ [app-id]] <text>` line of `## Acceptance criteria`. */\nexport type WrittenCriterion = {\n id: CriterionId;\n number: number;\n /** The app the criterion is scoped to, or `null` for every app. */\n app: string | null;\n text: string;\n at: SourceLocation;\n};\n\n/** `grimoire/features/<feature>/flows/<id>.md`. */\nexport type WrittenFlow = {\n file: string;\n feature: string;\n /** Front matter `id`; must equal the file name without `.md`. */\n id: Located<string>;\n /** `<feature>/<id>`. */\n ref: FlowRef;\n /** The feature version that introduced the flow. */\n since: Located<FeatureVersion>;\n status: Located<WrittenStatus>;\n /** Who walks the flow (`customer`, `guest`, `admin`, `system`). Free text. */\n who: Located<string>;\n origin: Located<WrittenOrigin> | null;\n heading: Located<string> | null;\n /** The paragraph under the `# Title`: what the flow does, in one or two sentences. `null` when not written (`GR1030`). */\n summary: string | null;\n /** `## Story`: the steps in the user's words. Empty when the section is not written. */\n story: WrittenStoryStep[];\n steps: WrittenStep[];\n /** `## Differs by app`: `- <app-id> <what differs>`. */\n differs: WrittenListLine[];\n cases: WrittenCase[];\n /** `## Not handled`: questions the code does not handle yet. */\n notHandled: WrittenListLine[];\n /** Every line starting with `Unknown:` anywhere in the flow. */\n unknowns: { text: string; at: SourceLocation }[];\n criteria: WrittenCriterion[];\n};\n\n/** `grimoire/features/<feature>/versions/v<n>.md`: the brief before a whole-number version. */\nexport type WrittenVersionBrief = {\n file: string;\n feature: string;\n /** The whole number from the file name (`3` for `v3.md`). */\n major: number;\n heading: Located<string> | null;\n};\n\n/** One feature folder. */\nexport type WrittenFeature = {\n id: string;\n /** `grimoire/features/<id>`. */\n dir: string;\n /** `null` when the folder has no README (a structure error). */\n readme: WrittenFeatureReadme | null;\n changelog: WrittenChangelog | null;\n flows: WrittenFlow[];\n versions: WrittenVersionBrief[];\n};\n\n// ── Apps ───────────────────────────────────────────────────────────────────\n\n/** Who sees a block: `everyone`, or condition names of the app. */\nexport type WrittenWho = {\n everyone: boolean;\n conditions: string[];\n};\n\n/** One `Changes with` item: `<condition>: <text>`, or free text with no condition. */\nexport type WrittenChangesWith = {\n condition: string | null;\n text: string;\n};\n\n/** One row of a `## Blocks` table: `| Block | Flow | Who sees it | Changes with |`. */\nexport type WrittenBlockRow = {\n block: string;\n /** `<feature>/<flow>`, or `null` for `—`. */\n flow: FlowRef | null;\n who: WrittenWho;\n /** Empty for `—`. Items are separated by `;`. */\n changesWith: WrittenChangesWith[];\n at: SourceLocation;\n};\n\n/** `grimoire/apps/<app>/layouts/<id>.md`. */\nexport type WrittenLayout = {\n file: string;\n app: string;\n /** The file name without `.md`. */\n id: string;\n /** Front matter `origin`, when given. */\n origin: Located<WrittenOrigin> | null;\n heading: Located<string> | null;\n blocks: WrittenBlockRow[];\n};\n\n/** `grimoire/apps/<app>/pages/<page>/blocks/<id>.md`. */\nexport type WrittenBlockFile = {\n file: string;\n app: string;\n /** The page or screen folder name. */\n page: string;\n id: string;\n flow: Located<FlowRef> | null;\n heading: Located<string> | null;\n /** `- <key> <value>` lines. */\n details: WrittenListLine[];\n /** Image lines of the file (what the block looks like). */\n screenshots: WrittenScreenshot[];\n};\n\n/** One `- <kind> <name>` line of `## Also reached from`. */\nexport type WrittenEntryPoint = {\n /** `mail`, `notification`, `page`, `screen`, `outside service`, or another word. */\n type: string;\n name: string;\n at: SourceLocation;\n};\n\n/**\n * `grimoire/apps/<app>/pages/<id>/README.md` (a site page) or\n * `grimoire/apps/<app>/screens/<id>/README.md` (a mobile screen).\n */\nexport type WrittenPage = {\n file: string;\n app: string;\n type: \"page\" | \"screen\";\n /** The folder name. */\n id: string;\n /** Front matter `route`: the page's route path, or a screen's file-based route. */\n route: Located<string> | null;\n /** Front matter `screen`: the screen name used by code-defined navigation. */\n screen: Located<string> | null;\n /** Front matter `layout`: a file in the app's `layouts/`. */\n layout: Located<string> | null;\n /** Front matter `origin`, when given. */\n origin: Located<WrittenOrigin> | null;\n heading: Located<string> | null;\n /** The paragraph under the heading, or `null`. */\n purpose: string | null;\n /** Image lines of the README (what the page or screen looks like). */\n screenshots: WrittenScreenshot[];\n blocks: WrittenBlockRow[];\n alsoReachedFrom: WrittenEntryPoint[];\n blockFiles: WrittenBlockFile[];\n};\n\n/** `grimoire/apps/<id>/README.md` and everything under that folder. */\nexport type WrittenApp = {\n /** `grimoire/apps/<id>`. */\n dir: string;\n /** `README.md`, or `null` when missing (a structure error). */\n file: string | null;\n /** Front matter `id`; must equal the folder name. */\n id: Located<string>;\n type: Located<\"site\" | \"mobile\">;\n /** Project-relative root of the site or mobile app (`src/web/$sites/client`, `mobile`). */\n root: Located<string>;\n /** Front matter `origin`, when given. */\n origin: Located<WrittenOrigin> | null;\n heading: Located<string> | null;\n /** `## Conditions`: `- <name> <meaning>`. */\n conditions: WrittenListLine[];\n layouts: WrittenLayout[];\n pages: WrittenPage[];\n screens: WrittenPage[];\n};\n\n// ── Tasks ──────────────────────────────────────────────────────────────────\n\nexport type TaskType = \"bug\" | \"feature\" | \"decision\" | \"chore\";\n\nexport type TaskStatus =\n | \"open\"\n | \"waiting for approval\"\n | \"approved\"\n | \"in progress\"\n | \"blocked\"\n | \"done\"\n | \"dropped\";\n\n/**\n * `grimoire/tasks/open/T-<n>-<slug>.md` or\n * `grimoire/tasks/done/<yyyy-mm>/T-<n>-<slug>.md`.\n */\nexport type WrittenTask = {\n file: string;\n /** Which folder holds it. */\n folder: \"open\" | \"done\";\n /** `yyyy-mm` of the done folder, or `null` for open tasks. */\n month: string | null;\n /** `T-<n>`. */\n id: Located<string>;\n type: Located<TaskType>;\n feature: Located<string> | null;\n /** Flow id within `feature`, or a full `<feature>/<flow>`; stored as written. */\n flow: Located<string> | null;\n apps: Located<string>[];\n status: Located<TaskStatus>;\n /** `shipped: <feature> <version>`, once done. */\n shipped: Located<{ feature: string; version: FeatureVersion }> | null;\n heading: Located<string> | null;\n /** `- <Key>: <value>` lines of the body (`Asked by`, `Why`, `Brief`, `Decision needed`, …). */\n fields: { key: string; value: string; at: SourceLocation }[];\n /** The `Decision needed` value, or `null`. */\n decisionNeeded: string | null;\n};\n\n// ── Releases ───────────────────────────────────────────────────────────────\n\n/** Markers around the list Warlock writes into a release file. */\nexport const COLLECTED_START_MARKER = \"<!-- grimoire:collected:start -->\";\nexport const COLLECTED_END_MARKER = \"<!-- grimoire:collected:end -->\";\n\n/** One line of a release file's collected list, read back. */\nexport type WrittenReleaseListed = {\n feature: string;\n version: FeatureVersion;\n word: ChangeWord;\n flow: string | null;\n criteria: CriterionId[];\n text: string;\n at: SourceLocation;\n};\n\n/** `grimoire/releases/<release>.md`. */\nexport type WrittenRelease = {\n file: string;\n /** Front matter `release`; must equal the file name without `.md`. */\n release: Located<string>;\n /** `yyyy-mm-dd`. */\n date: Located<string>;\n heading: Located<string> | null;\n /** The agent's brief: the text between the heading and the collected list. */\n brief: string;\n /** The list between the markers; `null` when the release command has not run yet. */\n collected: { start: SourceLocation; end: SourceLocation; entries: WrittenReleaseListed[] } | null;\n};\n\n// ── Everything ─────────────────────────────────────────────────────────────\n\n/** Every written file of a project, parsed. */\nexport type WrittenGrimoire = {\n /** Absolute project root. */\n root: string;\n /** `false` when the project has no `grimoire/` folder (book-only mode). */\n exists: boolean;\n features: WrittenFeature[];\n apps: WrittenApp[];\n tasks: WrittenTask[];\n releases: WrittenRelease[];\n /**\n * sha256 over the path and content of every written file, in path order.\n * The book manifest stores it to know when ownership and book maps change.\n */\n hash: string;\n};\n"],"mappings":";;AAmKA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAqPA,MAAa,yBAAyB;AACtC,MAAa,uBAAuB"}
@@ -1,8 +1,10 @@
1
- import { isGrimoireCode } from "../codes/index.mjs";
1
+ import { explainGrimoireCode, isGrimoireCode } from "../codes/index.mjs";
2
+ import { testResultsInfo } from "../test-results/index.mjs";
2
3
  import { checkGrimoire } from "../check/check-grimoire.mjs";
3
4
  import "../check/index.mjs";
4
5
  import { scry } from "../scry/query.mjs";
5
6
  import "../scry/index.mjs";
7
+ import { STEP_FILE_SETS, compactFlow, stepFilePage } from "../scry/compact.mjs";
6
8
  import { featureGraph, fileGraph, moduleGraph, pageGraph } from "./graphs.mjs";
7
9
 
8
10
  //#region ../../packages/grimoire/src/devtools/data.ts
@@ -52,9 +54,32 @@ function summary(snapshot) {
52
54
  files: files.length,
53
55
  modules: new Set(files.map((file) => file.module)).size,
54
56
  builtAt: snapshot.book.manifest.builtAt
55
- }
57
+ },
58
+ apps: {
59
+ apps: written.apps.length,
60
+ pages: written.apps.reduce((total, app) => total + app.pages.length, 0),
61
+ screens: written.apps.reduce((total, app) => total + app.screens.length, 0)
62
+ },
63
+ releases: written.releases.length,
64
+ results: testResultsInfo(snapshot)
56
65
  };
57
66
  }
67
+ /** The features listing: the features index with each README summary and flow headings. */
68
+ function features(snapshot) {
69
+ const written = new Map(snapshot.written.features.map((feature) => [feature.id, feature]));
70
+ return { features: snapshot.collected.featuresIndex.features.map((entry) => {
71
+ const source = written.get(entry.id);
72
+ const headings = new Map((source?.flows ?? []).map((flow) => [flow.id.value, flow.heading?.value ?? null]));
73
+ return {
74
+ ...entry,
75
+ summary: source?.readme?.summary ?? null,
76
+ flows: entry.flows.map((flow) => ({
77
+ ...flow,
78
+ heading: headings.get(flow.id) ?? null
79
+ }))
80
+ };
81
+ }) };
82
+ }
58
83
  function search(snapshot, text, limit) {
59
84
  return ask(snapshot, {
60
85
  type: "search",
@@ -100,7 +125,16 @@ function apps(snapshot) {
100
125
  type: app.type.value,
101
126
  root: app.root.value,
102
127
  pages: app.pages.map((page) => page.id),
103
- screens: app.screens.map((screen) => screen.id)
128
+ screens: app.screens.map((screen) => screen.id),
129
+ rows: [...app.pages, ...app.screens].map((item) => ({
130
+ id: item.id,
131
+ type: item.type,
132
+ route: item.route?.value ?? item.screen?.value ?? null,
133
+ heading: item.heading?.value ?? null,
134
+ origin: item.origin?.value ?? null,
135
+ layout: item.layout?.value ?? null,
136
+ blocks: item.blocks.length
137
+ }))
104
138
  })) };
105
139
  }
106
140
  function findApp(snapshot, id) {
@@ -165,7 +199,95 @@ function graphOfPage(snapshot, appId, key) {
165
199
  function graphOfModules(snapshot) {
166
200
  return moduleGraph(snapshot);
167
201
  }
202
+ /** `GET /flows/:feature/:flow`: the compact flow answer (step counts, direct imports, health, neighbours). */
203
+ function flowAnswer(snapshot, featureId, flowId) {
204
+ return compactFlow(snapshot, flow(snapshot, featureId, flowId));
205
+ }
206
+ /** A whole number from a query value, or a 400 naming the parameter. */
207
+ function whole(value, name, fallback, min) {
208
+ if (value === void 0 || value === "") return fallback;
209
+ const number = Number(value);
210
+ if (!Number.isInteger(number) || number < min) throw new GrimoirePanelError(400, `"${name}" must be a whole number of ${min} or more.`);
211
+ return number;
212
+ }
213
+ /** `GET /flows/:feature/:flow/steps/:index/files`: one page of a step's files. */
214
+ function stepFiles(snapshot, featureId, flowId, index, query) {
215
+ const feature = required(featureId, "feature");
216
+ const id = required(flowId, "flow");
217
+ const set = query.set === void 0 || query.set === "" ? "reachable" : query.set;
218
+ if (!STEP_FILE_SETS.includes(set)) throw new GrimoirePanelError(400, `Unknown set "${set}". Use one of: ${STEP_FILE_SETS.join(", ")}.`);
219
+ const stepIndex = whole(required(index, "index"), "index", 0, 0);
220
+ const offset = whole(query.offset, "offset", 0, 0);
221
+ const limit = Math.min(whole(query.limit, "limit", 200, 1), 200);
222
+ const written = snapshot.written.features.find((item) => item.id === feature)?.flows.find((item) => item.id.value === id);
223
+ const bookmap = written === void 0 ? void 0 : snapshot.collected.flows[written.ref];
224
+ if (written === void 0 || bookmap === void 0) throw new GrimoirePanelError(404, `No flow ${feature}/${id} is written.`);
225
+ const step = bookmap.steps.find((item) => item.index === stepIndex);
226
+ if (step === void 0) throw new GrimoirePanelError(404, `${written.ref} has no step ${stepIndex}.`);
227
+ return stepFilePage(snapshot, bookmap, step, set, offset, limit);
228
+ }
229
+ /** `GET /check?code=&feature=&flow=&severity=&state=&offset=&limit=`: matching findings, paged. */
230
+ function checkPage(snapshot, filter) {
231
+ const report = checkGrimoire(snapshot);
232
+ const limit = Math.min(Math.max(1, Math.floor(filter.limit ?? 100)), 500);
233
+ const offset = Math.max(0, Math.floor(filter.offset ?? 0));
234
+ const code = filter.code?.trim().toUpperCase();
235
+ const matching = report.findings.filter((finding) => {
236
+ if (code !== void 0 && code !== "" && finding.code !== code) return false;
237
+ if (filter.severity !== void 0 && finding.severity !== filter.severity) return false;
238
+ if (filter.state !== void 0 && finding.expected !== (filter.state === "expected")) return false;
239
+ if (filter.flow !== void 0 && filter.flow !== "" && finding.subject.flow !== filter.flow) return false;
240
+ if (filter.feature !== void 0 && filter.feature !== "") return featureOfFinding(finding) === filter.feature;
241
+ return true;
242
+ });
243
+ return {
244
+ ...report,
245
+ findings: matching.slice(offset, offset + limit),
246
+ total: matching.length,
247
+ offset,
248
+ limit
249
+ };
250
+ }
251
+ /** The feature a finding belongs to: its subject, else the feature of its flow, else `(none)`. */
252
+ function featureOfFinding(finding) {
253
+ return finding.subject.feature ?? finding.subject.flow?.split("/")[0] ?? "(none)";
254
+ }
255
+ /** `GET /check/groups`: the check by code, errors first, then by count. */
256
+ function checkGroups(snapshot) {
257
+ const report = checkGrimoire(snapshot);
258
+ const byCode = /* @__PURE__ */ new Map();
259
+ for (const finding of report.findings) byCode.set(finding.code, [...byCode.get(finding.code) ?? [], finding]);
260
+ const groups = [];
261
+ for (const [code, findings] of byCode) {
262
+ const definition = explainGrimoireCode(code);
263
+ const unexpected = findings.filter((finding) => !finding.expected);
264
+ const features = /* @__PURE__ */ new Map();
265
+ for (const finding of unexpected) {
266
+ const feature = featureOfFinding(finding);
267
+ features.set(feature, (features.get(feature) ?? 0) + 1);
268
+ }
269
+ groups.push({
270
+ code,
271
+ severity: findings[0]?.severity ?? definition?.severity ?? "warning",
272
+ area: definition?.area ?? "",
273
+ title: definition?.title ?? code,
274
+ fix: definition?.fix ?? findings[0]?.hint ?? "",
275
+ count: unexpected.length,
276
+ expected: findings.length - unexpected.length,
277
+ features: [...features].map(([feature, count]) => ({
278
+ feature,
279
+ count
280
+ })).sort((left, right) => right.count - left.count || (left.feature < right.feature ? -1 : 1))
281
+ });
282
+ }
283
+ groups.sort((left, right) => (left.severity === right.severity ? 0 : left.severity === "error" ? -1 : 1) || right.count - left.count || (left.code < right.code ? -1 : 1));
284
+ return {
285
+ counts: report.counts,
286
+ ok: report.ok,
287
+ groups
288
+ };
289
+ }
168
290
 
169
291
  //#endregion
170
- export { GrimoirePanelError, apps, check, feature, file, findPage, flow, graphOfFeature, graphOfFile, graphOfModules, graphOfPage, impact, page, release, releases, route, search, summary, tasks };
292
+ export { GrimoirePanelError, apps, check, checkGroups, checkPage, feature, features, file, findPage, flow, flowAnswer, graphOfFeature, graphOfFile, graphOfModules, graphOfPage, impact, page, release, releases, route, search, stepFiles, summary, tasks };
171
293
  //# sourceMappingURL=data.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/devtools/data.ts"],"sourcesContent":["/**\n * The answers of the tab, as functions of the snapshot. The devtools routes\n * and the static export both call them; questions about one item go to\n * `scry()`, the rest read the snapshot directly.\n */\nimport { isGrimoireCode } from \"../codes\";\nimport { checkGrimoire } from \"../check\";\nimport type { BookPage, BookScreen } from \"../contracts/adapter\";\nimport type { TasksIndex, FeaturesIndex } from \"../contracts/bookmap\";\nimport type { GrimoireCheckReport, RouteFreshness } from \"../contracts/findings\";\nimport type {\n ScryFeatureResult,\n ScryFileResult,\n ScryFlowResult,\n ScryImpactResult,\n ScryRouteResult,\n ScrySearchResult,\n} from \"../contracts/scry\";\nimport type { GrimoireSnapshot } from \"../contracts/snapshot\";\nimport type { WrittenApp, WrittenLayout, WrittenPage, WrittenRelease } from \"../contracts/written\";\nimport { scry } from \"../scry\";\nimport { featureGraph, fileGraph, moduleGraph, pageGraph, type GrimoireGraph } from \"./graphs\";\n\n/** An error a route answers with a status (devtools turns `statusCode` into the response status). */\nexport class GrimoirePanelError extends Error {\n public readonly statusCode: number;\n\n public constructor(statusCode: number, message: string) {\n super(message);\n this.name = \"GrimoirePanelError\";\n this.statusCode = statusCode;\n }\n}\n\nexport type GrimoireSummary = {\n routes: RouteFreshness;\n features: FeaturesIndex;\n tasks: TasksIndex;\n counts: GrimoireCheckReport[\"counts\"];\n /** Whether any feature, app, task or release is written, and how big the book is. */\n written: boolean;\n book: { files: number; modules: number; builtAt: string };\n};\n\nexport type GrimoireAppsAnswer = {\n apps: { id: string; type: string; root: string; pages: string[]; screens: string[] }[];\n};\n\nexport type GrimoirePageAnswer = {\n page: WrittenPage;\n layout: WrittenLayout | null;\n book: BookPage | BookScreen | null;\n};\n\nexport type GrimoireReleasesAnswer = {\n releases: { release: string; date: string; file: string }[];\n};\n\n/** `scry()` with its not-found codes turned into a 404 and the rest into a 400. */\nfunction ask<Result>(snapshot: GrimoireSnapshot, query: Parameters<typeof scry>[1]): Result {\n try {\n return scry(snapshot, query) as Result;\n } catch (error) {\n const code = (error as { code?: unknown }).code;\n\n if (typeof code === \"string\" && isGrimoireCode(code)) {\n throw new GrimoirePanelError(code === \"GR9006\" ? 400 : 404, (error as Error).message);\n }\n\n throw error;\n }\n}\n\nfunction required(value: string | undefined, name: string): string {\n if (value === undefined || value === \"\") throw new GrimoirePanelError(400, `Missing \"${name}\".`);\n\n return value;\n}\n\nexport function summary(snapshot: GrimoireSnapshot): GrimoireSummary {\n const files = snapshot.book.facts.files;\n const written = snapshot.written;\n\n return {\n routes: snapshot.routes,\n features: snapshot.collected.featuresIndex,\n tasks: snapshot.collected.tasksIndex,\n counts: checkGrimoire(snapshot).counts,\n written: [written.features, written.apps, written.tasks, written.releases].some(\n (items) => items.length > 0,\n ),\n book: {\n files: files.length,\n modules: new Set(files.map((file) => file.module)).size,\n builtAt: snapshot.book.manifest.builtAt,\n },\n };\n}\n\nexport function search(snapshot: GrimoireSnapshot, text: string, limit?: number): ScrySearchResult {\n return ask<ScrySearchResult>(snapshot, {\n type: \"search\",\n text,\n ...(limit !== undefined && Number.isFinite(limit) && limit > 0\n ? { limit: Math.min(limit, 100) }\n : {}),\n });\n}\n\nexport function file(snapshot: GrimoireSnapshot, path: string | undefined): ScryFileResult {\n return ask(snapshot, { type: \"file\", file: required(path, \"path\") });\n}\n\nexport function impact(snapshot: GrimoireSnapshot, path: string | undefined): ScryImpactResult {\n return ask(snapshot, { type: \"impact\", file: required(path, \"path\") });\n}\n\nexport function route(\n snapshot: GrimoireSnapshot,\n method: string | undefined,\n path: string | undefined,\n): ScryRouteResult {\n return ask(snapshot, {\n type: \"route\",\n method: required(method, \"method\"),\n path: required(path, \"path\"),\n });\n}\n\nexport function feature(snapshot: GrimoireSnapshot, id: string | undefined): ScryFeatureResult {\n return ask(snapshot, { type: \"feature\", feature: required(id, \"feature\") });\n}\n\nexport function flow(\n snapshot: GrimoireSnapshot,\n featureId: string | undefined,\n flowId: string | undefined,\n): ScryFlowResult {\n return ask(snapshot, {\n type: \"flow\",\n feature: required(featureId, \"feature\"),\n flow: required(flowId, \"flow\"),\n });\n}\n\nexport function apps(snapshot: GrimoireSnapshot): GrimoireAppsAnswer {\n return {\n apps: snapshot.written.apps.map((app) => ({\n id: app.id.value,\n type: app.type.value,\n root: app.root.value,\n pages: app.pages.map((page) => page.id),\n screens: app.screens.map((screen) => screen.id),\n })),\n };\n}\n\nfunction findApp(snapshot: GrimoireSnapshot, id: string | undefined): WrittenApp {\n const app = snapshot.written.apps.find((candidate) => candidate.id.value === id);\n\n if (app === undefined)\n throw new GrimoirePanelError(404, `No app \"${id ?? \"\"}\" is written in grimoire/apps.`);\n\n return app;\n}\n\n/** A page or screen by its id or its route. */\nexport function findPage(app: WrittenApp, key: string): WrittenPage | undefined {\n return [...app.pages, ...app.screens].find(\n (page) => page.id === key || page.route?.value === key || page.screen?.value === key,\n );\n}\n\nexport function page(\n snapshot: GrimoireSnapshot,\n appId: string | undefined,\n key: string | undefined,\n): GrimoirePageAnswer {\n const app = findApp(snapshot, appId);\n const written = findPage(app, required(key, \"page\"));\n\n if (written === undefined) {\n throw new GrimoirePanelError(\n 404,\n `App \"${app.id.value}\" has no page or screen \"${key ?? \"\"}\".`,\n );\n }\n\n const match = snapshot.apps[app.id.value];\n const route = written.route?.value ?? written.screen?.value ?? null;\n let book: BookPage | BookScreen | null = null;\n\n if (route !== null && match?.site) {\n book =\n snapshot.book.facts.pages.find(\n (candidate) => candidate.site === match.site?.id && candidate.route === route,\n ) ?? null;\n } else if (route !== null && match?.mobile) {\n book = match.mobile.screens.find((screen) => screen.route === route) ?? null;\n }\n\n const layoutId = written.layout?.value ?? null;\n\n return {\n page: written,\n layout:\n layoutId === null ? null : (app.layouts.find((layout) => layout.id === layoutId) ?? null),\n book,\n };\n}\n\nexport function tasks(snapshot: GrimoireSnapshot): TasksIndex {\n return snapshot.collected.tasksIndex;\n}\n\nexport function releases(snapshot: GrimoireSnapshot): GrimoireReleasesAnswer {\n return {\n releases: snapshot.written.releases.map((release) => ({\n release: release.release.value,\n date: release.date.value,\n file: release.file,\n })),\n };\n}\n\nexport function release(snapshot: GrimoireSnapshot, id: string | undefined): WrittenRelease {\n const found = snapshot.written.releases.find((candidate) => candidate.release.value === id);\n\n if (found === undefined)\n throw new GrimoirePanelError(404, `No release \"${id ?? \"\"}\" in grimoire/releases.`);\n\n return found;\n}\n\nexport function check(snapshot: GrimoireSnapshot): GrimoireCheckReport {\n return checkGrimoire(snapshot);\n}\n\nfunction graphOrNotFound(graph: GrimoireGraph | null, what: string): GrimoireGraph {\n if (graph === null) throw new GrimoirePanelError(404, `${what} is not in the book.`);\n\n return graph;\n}\n\nexport function graphOfFile(snapshot: GrimoireSnapshot, path: string | undefined): GrimoireGraph {\n const target = required(path, \"path\");\n\n return graphOrNotFound(fileGraph(snapshot, target), `\"${target}\"`);\n}\n\nexport function graphOfFeature(snapshot: GrimoireSnapshot, id: string | undefined): GrimoireGraph {\n const target = required(id, \"feature\");\n\n return graphOrNotFound(featureGraph(snapshot, target), `Feature \"${target}\"`);\n}\n\nexport function graphOfPage(\n snapshot: GrimoireSnapshot,\n appId: string | undefined,\n key: string | undefined,\n): GrimoireGraph {\n const target = required(key, \"page\");\n\n return graphOrNotFound(pageGraph(snapshot, required(appId, \"app\"), target), `Page \"${target}\"`);\n}\n\nexport function graphOfModules(snapshot: GrimoireSnapshot): GrimoireGraph {\n return moduleGraph(snapshot);\n}\n"],"mappings":";;;;;;;;;;;;;;AAwBA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,AAAgB;CAEhB,AAAO,YAAY,YAAoB,SAAiB;EACtD,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF;;AA2BA,SAAS,IAAY,UAA4B,OAA2C;CAC1F,IAAI;EACF,OAAO,KAAK,UAAU,KAAK;CAC7B,SAAS,OAAO;EACd,MAAM,OAAQ,MAA6B;EAE3C,IAAI,OAAO,SAAS,YAAY,eAAe,IAAI,GACjD,MAAM,IAAI,mBAAmB,SAAS,WAAW,MAAM,KAAM,MAAgB,OAAO;EAGtF,MAAM;CACR;AACF;AAEA,SAAS,SAAS,OAA2B,MAAsB;CACjE,IAAI,UAAU,UAAa,UAAU,IAAI,MAAM,IAAI,mBAAmB,KAAK,YAAY,KAAK,GAAG;CAE/F,OAAO;AACT;AAEA,SAAgB,QAAQ,UAA6C;CACnE,MAAM,QAAQ,SAAS,KAAK,MAAM;CAClC,MAAM,UAAU,SAAS;CAEzB,OAAO;EACL,QAAQ,SAAS;EACjB,UAAU,SAAS,UAAU;EAC7B,OAAO,SAAS,UAAU;EAC1B,QAAQ,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3,"file":"data.mjs","names":[],"sources":["../../../../../../../../packages/grimoire/src/devtools/data.ts"],"sourcesContent":["/**\n * The answers of the tab, as functions of the snapshot. The devtools routes\n * and the static export both call them; questions about one item go to\n * `scry()`, the rest read the snapshot directly.\n */\nimport { explainGrimoireCode, isGrimoireCode } from \"../codes\";\nimport { checkGrimoire } from \"../check\";\nimport type { BookPage, BookScreen } from \"../contracts/adapter\";\nimport type { TasksIndex, FeaturesIndex } from \"../contracts/bookmap\";\nimport type { GrimoireCheckReport, GrimoireFinding, RouteFreshness } from \"../contracts/findings\";\nimport type {\n ScryFeatureResult,\n ScryFileResult,\n ScryFlowResult,\n ScryImpactResult,\n ScryRouteResult,\n ScrySearchResult,\n} from \"../contracts/scry\";\nimport type { GrimoireSnapshot } from \"../contracts/snapshot\";\nimport type { WrittenApp, WrittenLayout, WrittenPage, WrittenRelease } from \"../contracts/written\";\nimport { scry } from \"../scry\";\nimport { compactFlow, STEP_FILE_SETS, stepFilePage } from \"../scry/compact\";\nimport { testResultsInfo } from \"../test-results\";\nimport { featureGraph, fileGraph, moduleGraph, pageGraph, type GrimoireGraph } from \"./graphs\";\nimport {\n STEP_FILES_PAGE_LIMIT,\n type GrimoireCheckFilter,\n type GrimoireCheckGroup,\n type GrimoireCheckGroups,\n type GrimoireCheckPage,\n type GrimoireFlowAnswer,\n type GrimoireStepFilesAnswer,\n type StepFileSet,\n} from \"./answers\";\nimport type { TestResultsInfo } from \"../contracts/test-results\";\n\n/** An error a route answers with a status (devtools turns `statusCode` into the response status). */\nexport class GrimoirePanelError extends Error {\n public readonly statusCode: number;\n\n public constructor(statusCode: number, message: string) {\n super(message);\n this.name = \"GrimoirePanelError\";\n this.statusCode = statusCode;\n }\n}\n\nexport type GrimoireSummary = {\n routes: RouteFreshness;\n features: FeaturesIndex;\n tasks: TasksIndex;\n counts: GrimoireCheckReport[\"counts\"];\n /** Whether any feature, app, task or release is written, and how big the book is. */\n written: boolean;\n book: { files: number; modules: number; builtAt: string };\n /** How many apps, pages, screens and releases are written (the tab's navigation and overview badges). */\n apps: { apps: number; pages: number; screens: number };\n releases: number;\n /** Whether test results were read, from where, and how many proofs have one. */\n results: TestResultsInfo;\n};\n\n/** One feature of the listing: the index entry plus what the cards show. */\nexport type GrimoireFeatureRow = Omit<FeaturesIndex[\"features\"][number], \"flows\"> & {\n /** The README paragraph under the heading, or `null`. */\n summary: string | null;\n /** The index flows with their headings. */\n flows: (FeaturesIndex[\"features\"][number][\"flows\"][number] & { heading: string | null })[];\n};\n\nexport type GrimoireFeaturesAnswer = { features: GrimoireFeatureRow[] };\n\n/** One page or screen of an app, as the listing shows it. */\nexport type GrimoireAppRow = {\n id: string;\n type: \"page\" | \"screen\";\n /** The page route or the screen name, or `null` when the file gives none. */\n route: string | null;\n heading: string | null;\n /** `confirmed` or `inferred` when the file says so, otherwise `null`. */\n origin: \"confirmed\" | \"inferred\" | null;\n layout: string | null;\n /** How many block rows the page lists itself. */\n blocks: number;\n};\n\nexport type GrimoireAppsAnswer = {\n apps: {\n id: string;\n type: string;\n root: string;\n pages: string[];\n screens: string[];\n /** Every page and screen with what the listing needs. */\n rows: GrimoireAppRow[];\n }[];\n};\n\nexport type GrimoirePageAnswer = {\n page: WrittenPage;\n layout: WrittenLayout | null;\n book: BookPage | BookScreen | null;\n};\n\nexport type GrimoireReleasesAnswer = {\n releases: { release: string; date: string; file: string }[];\n};\n\n/** `scry()` with its not-found codes turned into a 404 and the rest into a 400. */\nfunction ask<Result>(snapshot: GrimoireSnapshot, query: Parameters<typeof scry>[1]): Result {\n try {\n return scry(snapshot, query) as Result;\n } catch (error) {\n const code = (error as { code?: unknown }).code;\n\n if (typeof code === \"string\" && isGrimoireCode(code)) {\n throw new GrimoirePanelError(code === \"GR9006\" ? 400 : 404, (error as Error).message);\n }\n\n throw error;\n }\n}\n\nfunction required(value: string | undefined, name: string): string {\n if (value === undefined || value === \"\") throw new GrimoirePanelError(400, `Missing \"${name}\".`);\n\n return value;\n}\n\nexport function summary(snapshot: GrimoireSnapshot): GrimoireSummary {\n const files = snapshot.book.facts.files;\n const written = snapshot.written;\n\n return {\n routes: snapshot.routes,\n features: snapshot.collected.featuresIndex,\n tasks: snapshot.collected.tasksIndex,\n counts: checkGrimoire(snapshot).counts,\n written: [written.features, written.apps, written.tasks, written.releases].some(\n (items) => items.length > 0,\n ),\n book: {\n files: files.length,\n modules: new Set(files.map((file) => file.module)).size,\n builtAt: snapshot.book.manifest.builtAt,\n },\n apps: {\n apps: written.apps.length,\n pages: written.apps.reduce((total, app) => total + app.pages.length, 0),\n screens: written.apps.reduce((total, app) => total + app.screens.length, 0),\n },\n releases: written.releases.length,\n results: testResultsInfo(snapshot),\n };\n}\n\n/** The features listing: the features index with each README summary and flow headings. */\nexport function features(snapshot: GrimoireSnapshot): GrimoireFeaturesAnswer {\n const written = new Map(snapshot.written.features.map((feature) => [feature.id, feature]));\n\n return {\n features: snapshot.collected.featuresIndex.features.map((entry) => {\n const source = written.get(entry.id);\n const headings = new Map(\n (source?.flows ?? []).map((flow) => [flow.id.value, flow.heading?.value ?? null]),\n );\n\n return {\n ...entry,\n summary: source?.readme?.summary ?? null,\n flows: entry.flows.map((flow) => ({ ...flow, heading: headings.get(flow.id) ?? null })),\n };\n }),\n };\n}\n\nexport function search(snapshot: GrimoireSnapshot, text: string, limit?: number): ScrySearchResult {\n return ask<ScrySearchResult>(snapshot, {\n type: \"search\",\n text,\n ...(limit !== undefined && Number.isFinite(limit) && limit > 0\n ? { limit: Math.min(limit, 100) }\n : {}),\n });\n}\n\nexport function file(snapshot: GrimoireSnapshot, path: string | undefined): ScryFileResult {\n return ask(snapshot, { type: \"file\", file: required(path, \"path\") });\n}\n\nexport function impact(snapshot: GrimoireSnapshot, path: string | undefined): ScryImpactResult {\n return ask(snapshot, { type: \"impact\", file: required(path, \"path\") });\n}\n\nexport function route(\n snapshot: GrimoireSnapshot,\n method: string | undefined,\n path: string | undefined,\n): ScryRouteResult {\n return ask(snapshot, {\n type: \"route\",\n method: required(method, \"method\"),\n path: required(path, \"path\"),\n });\n}\n\nexport function feature(snapshot: GrimoireSnapshot, id: string | undefined): ScryFeatureResult {\n return ask(snapshot, { type: \"feature\", feature: required(id, \"feature\") });\n}\n\nexport function flow(\n snapshot: GrimoireSnapshot,\n featureId: string | undefined,\n flowId: string | undefined,\n): ScryFlowResult {\n return ask(snapshot, {\n type: \"flow\",\n feature: required(featureId, \"feature\"),\n flow: required(flowId, \"flow\"),\n });\n}\n\nexport function apps(snapshot: GrimoireSnapshot): GrimoireAppsAnswer {\n return {\n apps: snapshot.written.apps.map((app) => ({\n id: app.id.value,\n type: app.type.value,\n root: app.root.value,\n pages: app.pages.map((page) => page.id),\n screens: app.screens.map((screen) => screen.id),\n rows: [...app.pages, ...app.screens].map((item) => ({\n id: item.id,\n type: item.type,\n route: item.route?.value ?? item.screen?.value ?? null,\n heading: item.heading?.value ?? null,\n origin: item.origin?.value ?? null,\n layout: item.layout?.value ?? null,\n blocks: item.blocks.length,\n })),\n })),\n };\n}\n\nfunction findApp(snapshot: GrimoireSnapshot, id: string | undefined): WrittenApp {\n const app = snapshot.written.apps.find((candidate) => candidate.id.value === id);\n\n if (app === undefined)\n throw new GrimoirePanelError(404, `No app \"${id ?? \"\"}\" is written in grimoire/apps.`);\n\n return app;\n}\n\n/** A page or screen by its id or its route. */\nexport function findPage(app: WrittenApp, key: string): WrittenPage | undefined {\n return [...app.pages, ...app.screens].find(\n (page) => page.id === key || page.route?.value === key || page.screen?.value === key,\n );\n}\n\nexport function page(\n snapshot: GrimoireSnapshot,\n appId: string | undefined,\n key: string | undefined,\n): GrimoirePageAnswer {\n const app = findApp(snapshot, appId);\n const written = findPage(app, required(key, \"page\"));\n\n if (written === undefined) {\n throw new GrimoirePanelError(\n 404,\n `App \"${app.id.value}\" has no page or screen \"${key ?? \"\"}\".`,\n );\n }\n\n const match = snapshot.apps[app.id.value];\n const route = written.route?.value ?? written.screen?.value ?? null;\n let book: BookPage | BookScreen | null = null;\n\n if (route !== null && match?.site) {\n book =\n snapshot.book.facts.pages.find(\n (candidate) => candidate.site === match.site?.id && candidate.route === route,\n ) ?? null;\n } else if (route !== null && match?.mobile) {\n book = match.mobile.screens.find((screen) => screen.route === route) ?? null;\n }\n\n const layoutId = written.layout?.value ?? null;\n\n return {\n page: written,\n layout:\n layoutId === null ? null : (app.layouts.find((layout) => layout.id === layoutId) ?? null),\n book,\n };\n}\n\nexport function tasks(snapshot: GrimoireSnapshot): TasksIndex {\n return snapshot.collected.tasksIndex;\n}\n\nexport function releases(snapshot: GrimoireSnapshot): GrimoireReleasesAnswer {\n return {\n releases: snapshot.written.releases.map((release) => ({\n release: release.release.value,\n date: release.date.value,\n file: release.file,\n })),\n };\n}\n\nexport function release(snapshot: GrimoireSnapshot, id: string | undefined): WrittenRelease {\n const found = snapshot.written.releases.find((candidate) => candidate.release.value === id);\n\n if (found === undefined)\n throw new GrimoirePanelError(404, `No release \"${id ?? \"\"}\" in grimoire/releases.`);\n\n return found;\n}\n\nexport function check(snapshot: GrimoireSnapshot): GrimoireCheckReport {\n return checkGrimoire(snapshot);\n}\n\nfunction graphOrNotFound(graph: GrimoireGraph | null, what: string): GrimoireGraph {\n if (graph === null) throw new GrimoirePanelError(404, `${what} is not in the book.`);\n\n return graph;\n}\n\nexport function graphOfFile(snapshot: GrimoireSnapshot, path: string | undefined): GrimoireGraph {\n const target = required(path, \"path\");\n\n return graphOrNotFound(fileGraph(snapshot, target), `\"${target}\"`);\n}\n\nexport function graphOfFeature(snapshot: GrimoireSnapshot, id: string | undefined): GrimoireGraph {\n const target = required(id, \"feature\");\n\n return graphOrNotFound(featureGraph(snapshot, target), `Feature \"${target}\"`);\n}\n\nexport function graphOfPage(\n snapshot: GrimoireSnapshot,\n appId: string | undefined,\n key: string | undefined,\n): GrimoireGraph {\n const target = required(key, \"page\");\n\n return graphOrNotFound(pageGraph(snapshot, required(appId, \"app\"), target), `Page \"${target}\"`);\n}\n\nexport function graphOfModules(snapshot: GrimoireSnapshot): GrimoireGraph {\n return moduleGraph(snapshot);\n}\n\n// ── Compact flow, step files, check pages and groups ───────────────────────\n\n/** `GET /flows/:feature/:flow`: the compact flow answer (step counts, direct imports, health, neighbours). */\nexport function flowAnswer(\n snapshot: GrimoireSnapshot,\n featureId: string | undefined,\n flowId: string | undefined,\n): GrimoireFlowAnswer {\n return compactFlow(snapshot, flow(snapshot, featureId, flowId));\n}\n\n/** A whole number from a query value, or a 400 naming the parameter. */\nfunction whole(value: string | undefined, name: string, fallback: number, min: number): number {\n if (value === undefined || value === \"\") return fallback;\n\n const number = Number(value);\n\n if (!Number.isInteger(number) || number < min) {\n throw new GrimoirePanelError(400, `\"${name}\" must be a whole number of ${min} or more.`);\n }\n\n return number;\n}\n\n/** `GET /flows/:feature/:flow/steps/:index/files`: one page of a step's files. */\nexport function stepFiles(\n snapshot: GrimoireSnapshot,\n featureId: string | undefined,\n flowId: string | undefined,\n index: string | undefined,\n query: { set?: string | undefined; offset?: string | undefined; limit?: string | undefined },\n): GrimoireStepFilesAnswer {\n const feature = required(featureId, \"feature\");\n const id = required(flowId, \"flow\");\n const set = query.set === undefined || query.set === \"\" ? \"reachable\" : query.set;\n\n if (!(STEP_FILE_SETS as readonly string[]).includes(set)) {\n throw new GrimoirePanelError(\n 400,\n `Unknown set \"${set}\". Use one of: ${STEP_FILE_SETS.join(\", \")}.`,\n );\n }\n\n const stepIndex = whole(required(index, \"index\"), \"index\", 0, 0);\n const offset = whole(query.offset, \"offset\", 0, 0);\n const limit = Math.min(whole(query.limit, \"limit\", STEP_FILES_PAGE_LIMIT, 1), STEP_FILES_PAGE_LIMIT);\n const written = snapshot.written.features\n .find((item) => item.id === feature)\n ?.flows.find((item) => item.id.value === id);\n const bookmap = written === undefined ? undefined : snapshot.collected.flows[written.ref];\n\n if (written === undefined || bookmap === undefined) {\n throw new GrimoirePanelError(404, `No flow ${feature}/${id} is written.`);\n }\n\n const step = bookmap.steps.find((item) => item.index === stepIndex);\n\n if (step === undefined) {\n throw new GrimoirePanelError(404, `${written.ref} has no step ${stepIndex}.`);\n }\n\n return stepFilePage(snapshot, bookmap, step, set as StepFileSet, offset, limit);\n}\n\n/** `GET /check?code=&feature=&flow=&severity=&state=&offset=&limit=`: matching findings, paged. */\nexport function checkPage(snapshot: GrimoireSnapshot, filter: GrimoireCheckFilter): GrimoireCheckPage {\n const report = checkGrimoire(snapshot);\n const limit = Math.min(Math.max(1, Math.floor(filter.limit ?? 100)), 500);\n const offset = Math.max(0, Math.floor(filter.offset ?? 0));\n const code = filter.code?.trim().toUpperCase();\n const matching = report.findings.filter((finding) => {\n if (code !== undefined && code !== \"\" && finding.code !== code) return false;\n if (filter.severity !== undefined && finding.severity !== filter.severity) return false;\n if (filter.state !== undefined && finding.expected !== (filter.state === \"expected\")) return false;\n if (filter.flow !== undefined && filter.flow !== \"\" && finding.subject.flow !== filter.flow) {\n return false;\n }\n\n if (filter.feature !== undefined && filter.feature !== \"\") {\n return featureOfFinding(finding) === filter.feature;\n }\n\n return true;\n });\n\n return {\n ...report,\n findings: matching.slice(offset, offset + limit),\n total: matching.length,\n offset,\n limit,\n };\n}\n\n/** The feature a finding belongs to: its subject, else the feature of its flow, else `(none)`. */\nfunction featureOfFinding(finding: GrimoireFinding): string {\n return finding.subject.feature ?? finding.subject.flow?.split(\"/\")[0] ?? \"(none)\";\n}\n\n/** `GET /check/groups`: the check by code, errors first, then by count. */\nexport function checkGroups(snapshot: GrimoireSnapshot): GrimoireCheckGroups {\n const report = checkGrimoire(snapshot);\n const byCode = new Map<string, GrimoireFinding[]>();\n\n for (const finding of report.findings) {\n byCode.set(finding.code, [...(byCode.get(finding.code) ?? []), finding]);\n }\n\n const groups: GrimoireCheckGroup[] = [];\n\n for (const [code, findings] of byCode) {\n const definition = explainGrimoireCode(code);\n const unexpected = findings.filter((finding) => !finding.expected);\n const features = new Map<string, number>();\n\n for (const finding of unexpected) {\n const feature = featureOfFinding(finding);\n\n features.set(feature, (features.get(feature) ?? 0) + 1);\n }\n\n groups.push({\n code,\n severity: findings[0]?.severity ?? definition?.severity ?? \"warning\",\n area: definition?.area ?? \"\",\n title: definition?.title ?? code,\n fix: definition?.fix ?? findings[0]?.hint ?? \"\",\n count: unexpected.length,\n expected: findings.length - unexpected.length,\n features: [...features]\n .map(([feature, count]) => ({ feature, count }))\n .sort((left, right) => right.count - left.count || (left.feature < right.feature ? -1 : 1)),\n });\n }\n\n groups.sort(\n (left, right) =>\n (left.severity === right.severity ? 0 : left.severity === \"error\" ? -1 : 1) ||\n right.count - left.count ||\n (left.code < right.code ? -1 : 1),\n );\n\n return { counts: report.counts, ok: report.ok, groups };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,AAAgB;CAEhB,AAAO,YAAY,YAAoB,SAAiB;EACtD,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF;;AAgEA,SAAS,IAAY,UAA4B,OAA2C;CAC1F,IAAI;EACF,OAAO,KAAK,UAAU,KAAK;CAC7B,SAAS,OAAO;EACd,MAAM,OAAQ,MAA6B;EAE3C,IAAI,OAAO,SAAS,YAAY,eAAe,IAAI,GACjD,MAAM,IAAI,mBAAmB,SAAS,WAAW,MAAM,KAAM,MAAgB,OAAO;EAGtF,MAAM;CACR;AACF;AAEA,SAAS,SAAS,OAA2B,MAAsB;CACjE,IAAI,UAAU,UAAa,UAAU,IAAI,MAAM,IAAI,mBAAmB,KAAK,YAAY,KAAK,GAAG;CAE/F,OAAO;AACT;AAEA,SAAgB,QAAQ,UAA6C;CACnE,MAAM,QAAQ,SAAS,KAAK,MAAM;CAClC,MAAM,UAAU,SAAS;CAEzB,OAAO;EACL,QAAQ,SAAS;EACjB,UAAU,SAAS,UAAU;EAC7B,OAAO,SAAS,UAAU;EAC1B,QAAQ,cAAc,QAAQ,CAAC,CAAC;EAChC,SAAS;GAAC,QAAQ;GAAU,QAAQ;GAAM,QAAQ;GAAO,QAAQ;EAAQ,CAAC,CAAC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M,WAAW,YAAY;GAChC,MAAM,UAAU,iBAAiB,OAAO;GAExC,SAAS,IAAI,UAAU,SAAS,IAAI,OAAO,KAAK,KAAK,CAAC;EACxD;EAEA,OAAO,KAAK;GACV;GACA,UAAU,SAAS,EAAE,EAAE,YAAY,YAAY,YAAY;GAC3D,MAAM,YAAY,QAAQ;GAC1B,OAAO,YAAY,SAAS;GAC5B,KAAK,YAAY,OAAO,SAAS,EAAE,EAAE,QAAQ;GAC7C,OAAO,WAAW;GAClB,UAAU,SAAS,SAAS,WAAW;GACvC,UAAU,CAAC,GAAG,QAAQ,CAAC,CACpB,KAAK,CAAC,SAAS,YAAY;IAAE;IAAS;GAAM,EAAE,CAAC,CAC/C,MAAM,MAAM,UAAU,MAAM,QAAQ,KAAK,UAAU,KAAK,UAAU,MAAM,UAAU,KAAK,EAAE;EAC9F,CAAC;CACH;CAEA,OAAO,MACJ,MAAM,WACJ,KAAK,aAAa,MAAM,WAAW,IAAI,KAAK,aAAa,UAAU,KAAK,MACzE,MAAM,QAAQ,KAAK,UAClB,KAAK,OAAO,MAAM,OAAO,KAAK,EACnC;CAEA,OAAO;EAAE,QAAQ,OAAO;EAAQ,IAAI,OAAO;EAAI;CAAO;AACxD"}
@@ -1,4 +1,5 @@
1
1
  import { BookAdapter } from "../contracts/adapter.mjs";
2
+ import { ProductErrorSummary } from "./product-map.mjs";
2
3
  import { ExportGrimoireSiteOptions, exportGrimoireSite } from "./site.mjs";
3
4
  //#region ../../packages/grimoire/src/devtools/index.d.ts
4
5
  /** The parts of devtools' `DevtoolsPanelRequest` the routes read. */
@@ -6,6 +7,15 @@ export type GrimoirePanelRequest = {
6
7
  params: Readonly<Record<string, string>>;
7
8
  query: Readonly<Record<string, string | readonly string[]>>;
8
9
  body: unknown;
10
+ /** `true` when the request came through a read-only share link. */
11
+ shared?: boolean;
12
+ };
13
+ /** Devtools' `DevtoolsPanelShare`, structurally: what a share link may show. */
14
+ export type GrimoireDevtoolsPanelShare = {
15
+ view: string | URL;
16
+ routes: readonly string[];
17
+ assets?: readonly string[];
18
+ files?: boolean;
9
19
  };
10
20
  /** Devtools' `DevtoolsPanel`, structurally. */
11
21
  export type GrimoireDevtoolsPanel = {
@@ -18,6 +28,13 @@ export type GrimoireDevtoolsPanel = {
18
28
  handler: (request: GrimoirePanelRequest) => unknown;
19
29
  }[];
20
30
  assets?: Readonly<Record<string, string | URL>>;
31
+ /** A folder of images served next to the panel. */
32
+ files?: {
33
+ dir: string;
34
+ extensions?: readonly string[];
35
+ };
36
+ /** What a read-only share link may show. */
37
+ share?: GrimoireDevtoolsPanelShare;
21
38
  /** Safe for the production monitor: the tab only reads (see `GrimoirePanelContext.mode`). */
22
39
  production?: boolean;
23
40
  };
@@ -32,8 +49,21 @@ export type GrimoirePanelContext = {
32
49
  mode?: "development" | "production";
33
50
  /** The adapter to open the book with. Default: the Warlock adapter, loaded on first request. */
34
51
  adapter?: BookAdapter | (() => Promise<BookAdapter>);
35
- /** How long an opened snapshot is reused when the book manifest did not change (ms). Default 2000, longer after a slow open. */
52
+ /**
53
+ * How long an opened snapshot is reused when the book did not change (ms).
54
+ * Default in development: 2000, longer after a slow open; the old snapshot is served while a
55
+ * background open refreshes it. Default in production: until the book changes.
56
+ */
36
57
  ttlMs?: number;
58
+ /**
59
+ * Where the test results are read from (project-relative or absolute).
60
+ * Default `grimoire/book/test-results.json`. Set it when the deploy ships
61
+ * the results from CI; the Vitest reporter writes there with
62
+ * `grimoireReporter({ file })`.
63
+ */
64
+ testResultsFile?: string;
65
+ /** Captured error groups of the monitor (counts only), for the product map's health. Devtools passes it. */
66
+ errors?: () => Promise<readonly ProductErrorSummary[]>;
37
67
  };
38
68
  /** Build the panel for the app at `root`. */
39
69
  export declare function grimoireDevtoolsPanel(context: GrimoirePanelContext): Promise<GrimoireDevtoolsPanel>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/devtools/index.ts"],"mappings":";;;;YAuBY;EACV,QAAQ,SAAS;EACjB,OAAO,SAAS;EAChB;;;YAIU;EACV;EACA;EACA,eAAe;EACf;IACE;IACA;IACA,UAAU,SAAS;;EAErB,SAAS,SAAS,wBAAwB;;EAE1C;;;YAIU;;EAEV;;;;;EAKA;;EAEA,UAAU,qBAAqB,QAAQ;;EAEvC;;;wBAWoB,sBACpB,SAAS,uBACR,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../../../../packages/grimoire/src/devtools/index.ts"],"mappings":";;;;;YA0BY;EACV,QAAQ,SAAS;EACjB,OAAO,SAAS;EAChB;;EAEA;;;YAIU;EACV,eAAe;EACf;EACA;EACA;;;YAIU;EACV;EACA;EACA,eAAe;EACf;IACE;IACA;IACA,UAAU,SAAS;;EAErB,SAAS,SAAS,wBAAwB;;EAE1C;IAAU;IAAa;;;EAEvB,QAAQ;;EAER;;;YAIU;;EAEV;;;;;EAKA;;EAEA,UAAU,qBAAqB,QAAQ;;;;;;EAMvC;;;;;;;EAOA;;EAEA,eAAe,iBAAiB;;;wBAWZ,sBACpB,SAAS,uBACR,QAAQ"}