@warlock.js/grimoire 5.55.0 → 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.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
`@warlock.js/grimoire` is new in 5.55.0 and experimental: its file layout, `GR` codes and API may change in any release until it is marked stable.
|
|
4
4
|
|
|
5
|
+
## 5.56.0 - 2026-11-17
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- The Grimoire tab works in the devtools production monitor. It is read-only there: it opens the book without writing any file. `GrimoireDevtoolsPanel` gains `production`, and `GrimoirePanelContext` gains `mode`.
|
|
10
|
+
|
|
5
11
|
## 5.55.0 - 2026-11-17
|
|
6
12
|
|
|
7
13
|
### Added
|
package/esm/devtools/index.d.mts
CHANGED
|
@@ -18,11 +18,18 @@ export type GrimoireDevtoolsPanel = {
|
|
|
18
18
|
handler: (request: GrimoirePanelRequest) => unknown;
|
|
19
19
|
}[];
|
|
20
20
|
assets?: Readonly<Record<string, string | URL>>;
|
|
21
|
+
/** Safe for the production monitor: the tab only reads (see `GrimoirePanelContext.mode`). */
|
|
22
|
+
production?: boolean;
|
|
21
23
|
};
|
|
22
|
-
/** What the panel factory takes: devtools passes `{ root }`; the rest is for tests and custom setups. */
|
|
24
|
+
/** What the panel factory takes: devtools passes `{ root, mode }`; the rest is for tests and custom setups. */
|
|
23
25
|
export type GrimoirePanelContext = {
|
|
24
26
|
/** The app root. */
|
|
25
27
|
root: string;
|
|
28
|
+
/**
|
|
29
|
+
* Where the dashboard runs. In `"production"` the tab writes no files:
|
|
30
|
+
* it reads the book as it is on disk. Default: development.
|
|
31
|
+
*/
|
|
32
|
+
mode?: "development" | "production";
|
|
26
33
|
/** The adapter to open the book with. Default: the Warlock adapter, loaded on first request. */
|
|
27
34
|
adapter?: BookAdapter | (() => Promise<BookAdapter>);
|
|
28
35
|
/** How long an opened snapshot is reused when the book manifest did not change (ms). Default 2000, longer after a slow open. */
|
|
@@ -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;;;
|
|
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"}
|
package/esm/devtools/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ function one(query, name) {
|
|
|
11
11
|
/** Build the panel for the app at `root`. */
|
|
12
12
|
async function grimoireDevtoolsPanel(context) {
|
|
13
13
|
const source = createSnapshotSource(context.root, {
|
|
14
|
-
write:
|
|
14
|
+
write: context.mode !== "production",
|
|
15
15
|
...context.adapter === void 0 ? {} : { adapter: context.adapter },
|
|
16
16
|
...context.ttlMs === void 0 ? {} : { ttlMs: context.ttlMs }
|
|
17
17
|
});
|
|
@@ -19,6 +19,7 @@ async function grimoireDevtoolsPanel(context) {
|
|
|
19
19
|
return {
|
|
20
20
|
id: "grimoire",
|
|
21
21
|
title: "Grimoire",
|
|
22
|
+
production: true,
|
|
22
23
|
view: new URL("../../ui/grimoire-view.js", import.meta.url),
|
|
23
24
|
assets: { "grimoire.css": new URL("../../ui/grimoire.css", import.meta.url) },
|
|
24
25
|
routes: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["data.summary","data.search","data.file","data.impact","data.route","data.feature","data.flow","data.apps","data.page","data.tasks","data.releases","data.release","data.check","data.graphOfFile","data.graphOfFeature","data.graphOfPage","data.graphOfModules"],"sources":["../../../../../../../../packages/grimoire/src/devtools/index.ts"],"sourcesContent":["/**\n * `@warlock.js/grimoire/devtools`: the Grimoire tab of the devtools\n * dashboard. An app enables it in `src/config/devtools.ts`:\n *\n * ```ts\n * panels: [\"@warlock.js/grimoire/devtools\"]\n * ```\n *\n * The default export is a panel factory (devtools' `DevtoolsPanelExport`),\n * typed structurally here so this entry needs no `@warlock.js/devtools`\n * import. The browser view lives in the package's `ui/` folder. Data routes\n * open the snapshot with `routes: \"cached\"` (never booting the app) and keep\n * the generated book up to date; agent-written files are only read.\n */\nimport type { BookAdapter } from \"../contracts/adapter\";\nimport type { GrimoireSnapshot } from \"../contracts/snapshot\";\nimport * as data from \"./data\";\nimport { createSnapshotSource } from \"./snapshot-source\";\n\nexport { exportGrimoireSite } from \"./site\";\nexport type { ExportGrimoireSiteOptions } from \"./site\";\n\n/** The parts of devtools' `DevtoolsPanelRequest` the routes read. */\nexport type GrimoirePanelRequest = {\n params: Readonly<Record<string, string>>;\n query: Readonly<Record<string, string | readonly string[]>>;\n body: unknown;\n};\n\n/** Devtools' `DevtoolsPanel`, structurally. */\nexport type GrimoireDevtoolsPanel = {\n id: string;\n title: string;\n view: string | URL;\n routes?: readonly {\n method?: \"GET\" | \"POST\";\n path: string;\n handler: (request: GrimoirePanelRequest) => unknown;\n }[];\n assets?: Readonly<Record<string, string | URL>>;\n};\n\n/** What the panel factory takes: devtools passes `{ root }`; the rest is for tests and custom setups. */\nexport type GrimoirePanelContext = {\n /** The app root. */\n root: string;\n /** The adapter to open the book with. Default: the Warlock adapter, loaded on first request. */\n adapter?: BookAdapter | (() => Promise<BookAdapter>);\n /** How long an opened snapshot is reused when the book manifest did not change (ms). Default 2000, longer after a slow open. */\n ttlMs?: number;\n};\n\n/** The first value of a query parameter. */\nfunction one(query: GrimoirePanelRequest[\"query\"], name: string): string | undefined {\n const value = query[name];\n\n return Array.isArray(value) ? value[0] : (value as string | undefined);\n}\n\n/** Build the panel for the app at `root`. */\nexport async function grimoireDevtoolsPanel(\n context: GrimoirePanelContext,\n): Promise<GrimoireDevtoolsPanel> {\n //
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["data.summary","data.search","data.file","data.impact","data.route","data.feature","data.flow","data.apps","data.page","data.tasks","data.releases","data.release","data.check","data.graphOfFile","data.graphOfFeature","data.graphOfPage","data.graphOfModules"],"sources":["../../../../../../../../packages/grimoire/src/devtools/index.ts"],"sourcesContent":["/**\n * `@warlock.js/grimoire/devtools`: the Grimoire tab of the devtools\n * dashboard. An app enables it in `src/config/devtools.ts`:\n *\n * ```ts\n * panels: [\"@warlock.js/grimoire/devtools\"]\n * ```\n *\n * The default export is a panel factory (devtools' `DevtoolsPanelExport`),\n * typed structurally here so this entry needs no `@warlock.js/devtools`\n * import. The browser view lives in the package's `ui/` folder. Data routes\n * open the snapshot with `routes: \"cached\"` (never booting the app) and keep\n * the generated book up to date; agent-written files are only read.\n */\nimport type { BookAdapter } from \"../contracts/adapter\";\nimport type { GrimoireSnapshot } from \"../contracts/snapshot\";\nimport * as data from \"./data\";\nimport { createSnapshotSource } from \"./snapshot-source\";\n\nexport { exportGrimoireSite } from \"./site\";\nexport type { ExportGrimoireSiteOptions } from \"./site\";\n\n/** The parts of devtools' `DevtoolsPanelRequest` the routes read. */\nexport type GrimoirePanelRequest = {\n params: Readonly<Record<string, string>>;\n query: Readonly<Record<string, string | readonly string[]>>;\n body: unknown;\n};\n\n/** Devtools' `DevtoolsPanel`, structurally. */\nexport type GrimoireDevtoolsPanel = {\n id: string;\n title: string;\n view: string | URL;\n routes?: readonly {\n method?: \"GET\" | \"POST\";\n path: string;\n handler: (request: GrimoirePanelRequest) => unknown;\n }[];\n assets?: Readonly<Record<string, string | URL>>;\n /** Safe for the production monitor: the tab only reads (see `GrimoirePanelContext.mode`). */\n production?: boolean;\n};\n\n/** What the panel factory takes: devtools passes `{ root, mode }`; the rest is for tests and custom setups. */\nexport type GrimoirePanelContext = {\n /** The app root. */\n root: string;\n /**\n * Where the dashboard runs. In `\"production\"` the tab writes no files:\n * it reads the book as it is on disk. Default: development.\n */\n mode?: \"development\" | \"production\";\n /** The adapter to open the book with. Default: the Warlock adapter, loaded on first request. */\n adapter?: BookAdapter | (() => Promise<BookAdapter>);\n /** How long an opened snapshot is reused when the book manifest did not change (ms). Default 2000, longer after a slow open. */\n ttlMs?: number;\n};\n\n/** The first value of a query parameter. */\nfunction one(query: GrimoirePanelRequest[\"query\"], name: string): string | undefined {\n const value = query[name];\n\n return Array.isArray(value) ? value[0] : (value as string | undefined);\n}\n\n/** Build the panel for the app at `root`. */\nexport async function grimoireDevtoolsPanel(\n context: GrimoirePanelContext,\n): Promise<GrimoireDevtoolsPanel> {\n // In development the tab keeps Warlock's generated files (book, book maps, indexes) up to date, so\n // the next open is incremental. In production it writes nothing. Agent-written files are only read,\n // and cached routes never boot the app.\n const source = createSnapshotSource(context.root, {\n write: context.mode !== \"production\",\n ...(context.adapter === undefined ? {} : { adapter: context.adapter }),\n ...(context.ttlMs === undefined ? {} : { ttlMs: context.ttlMs }),\n });\n const answer =\n <Answer>(read: (snapshot: GrimoireSnapshot, request: GrimoirePanelRequest) => Answer) =>\n async (request: GrimoirePanelRequest): Promise<Answer> =>\n read(await source.get(), request);\n\n return {\n id: \"grimoire\",\n title: \"Grimoire\",\n production: true,\n view: new URL(\"../../ui/grimoire-view.js\", import.meta.url),\n assets: { \"grimoire.css\": new URL(\"../../ui/grimoire.css\", import.meta.url) },\n routes: [\n { path: \"/summary\", handler: answer((snapshot) => data.summary(snapshot)) },\n {\n path: \"/search\",\n handler: answer((snapshot, { query }) => {\n const limit = Number(one(query, \"limit\"));\n\n return data.search(\n snapshot,\n one(query, \"q\") ?? \"\",\n Number.isFinite(limit) && limit > 0 ? limit : undefined,\n );\n }),\n },\n {\n path: \"/file\",\n handler: answer((snapshot, { query }) => data.file(snapshot, one(query, \"path\"))),\n },\n {\n path: \"/impact\",\n handler: answer((snapshot, { query }) => data.impact(snapshot, one(query, \"path\"))),\n },\n {\n path: \"/route\",\n handler: answer((snapshot, { query }) =>\n data.route(snapshot, one(query, \"method\"), one(query, \"path\")),\n ),\n },\n {\n path: \"/features/:feature\",\n handler: answer((snapshot, { params }) => data.feature(snapshot, params.feature)),\n },\n {\n path: \"/flows/:feature/:flow\",\n handler: answer((snapshot, { params }) => data.flow(snapshot, params.feature, params.flow)),\n },\n { path: \"/apps\", handler: answer((snapshot) => data.apps(snapshot)) },\n {\n path: \"/apps/:app/pages/:page\",\n handler: answer((snapshot, { params }) => data.page(snapshot, params.app, params.page)),\n },\n { path: \"/tasks\", handler: answer((snapshot) => data.tasks(snapshot)) },\n { path: \"/releases\", handler: answer((snapshot) => data.releases(snapshot)) },\n {\n path: \"/releases/:release\",\n handler: answer((snapshot, { params }) => data.release(snapshot, params.release)),\n },\n { path: \"/check\", handler: answer((snapshot) => data.check(snapshot)) },\n {\n path: \"/graph/file\",\n handler: answer((snapshot, { query }) => data.graphOfFile(snapshot, one(query, \"path\"))),\n },\n {\n path: \"/graph/feature/:feature\",\n handler: answer((snapshot, { params }) => data.graphOfFeature(snapshot, params.feature)),\n },\n {\n path: \"/graph/page\",\n handler: answer((snapshot, { query }) =>\n data.graphOfPage(snapshot, one(query, \"app\"), one(query, \"page\")),\n ),\n },\n { path: \"/graph/modules\", handler: answer((snapshot) => data.graphOfModules(snapshot)) },\n ],\n };\n}\n\nexport default grimoireDevtoolsPanel;\n"],"mappings":";;;;;;AA4DA,SAAS,IAAI,OAAsC,MAAkC;CACnF,MAAM,QAAQ,MAAM;CAEpB,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAM;AAC5C;;AAGA,eAAsB,sBACpB,SACgC;CAIhC,MAAM,SAAS,qBAAqB,QAAQ,MAAM;EAChD,OAAO,QAAQ,SAAS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,QAAQ,aAAaC,KAAU,QAAQ,CAAC;GAAE;GACpE;IACE,MAAM;IACN,SAAS,QAAQ,UAAU,EAAE,aAAaC,KAAU,UAAU,OAAO,KAAK,OAAO,IAAI,CAAC;GACxF;GACA;IAAE,MAAM;IAAU,SAAS,QAAQ,aAAaC,MAAW,QAAQ,CAAC;GAAE;GACtE;IAAE,MAAM;IAAa,SAAS,QAAQ,aAAaC,SAAc,QAAQ,CAAC;GAAE;GAC5E;IACE,MAAM;IACN,SAAS,QAAQ,UAAU,EAAE,aAAaC,QAAa,UAAU,OAAO,OAAO,CAAC;GAClF;GACA;IAAE,MAAM;IAAU,SAAS,QAAQ,aAAaC,MAAW,QAAQ,CAAC;GAAE;GACtE;IACE,MAAM;IACN,SAAS,QAAQ,UAAU,EAAE,YAAYC,YAAiB,UAAU,IAAI,OAAO,MAAM,CAAC,CAAC;GACzF;GACA;IACE,MAAM;IACN,SAAS,QAAQ,UAAU,EAAE,aAAaC,eAAoB,UAAU,OAAO,OAAO,CAAC;GACzF;GACA;IACE,MAAM;IACN,SAAS,QAAQ,UAAU,EAAE,YAC3BC,YAAiB,UAAU,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,MAAM,CAAC,CAClE;GACF;GACA;IAAE,MAAM;IAAkB,SAAS,QAAQ,aAAaC,eAAoB,QAAQ,CAAC;GAAE;EACzF;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"environment": "server"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@warlock.js/core": "5.
|
|
30
|
-
"@warlock.js/web": "5.
|
|
29
|
+
"@warlock.js/core": "5.56.0",
|
|
30
|
+
"@warlock.js/web": "5.56.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependenciesMeta": {
|
|
33
33
|
"@warlock.js/web": {
|
|
34
34
|
"optional": true
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
"version": "5.
|
|
37
|
+
"version": "5.56.0",
|
|
38
38
|
"type": "module",
|
|
39
39
|
"main": "./esm/index.mjs",
|
|
40
40
|
"module": "./esm/index.mjs",
|