@warlock.js/grimoire 5.58.0 → 5.60.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 +24 -0
- package/esm/apps/check-apps.mjs +11 -5
- package/esm/apps/check-apps.mjs.map +1 -1
- package/esm/book/build.d.mts.map +1 -1
- package/esm/book/build.mjs.map +1 -1
- package/esm/bookmap/build.d.mts.map +1 -1
- package/esm/bookmap/build.mjs +5 -3
- package/esm/bookmap/build.mjs.map +1 -1
- package/esm/bookmap/steps.mjs +34 -3
- package/esm/bookmap/steps.mjs.map +1 -1
- package/esm/contracts/adapter.d.mts +22 -1
- package/esm/contracts/adapter.d.mts.map +1 -1
- package/esm/contracts/scry.d.mts +26 -6
- package/esm/contracts/scry.d.mts.map +1 -1
- package/esm/contracts/snapshot.d.mts +3 -1
- package/esm/contracts/snapshot.d.mts.map +1 -1
- package/esm/devtools/data.mjs +23 -3
- package/esm/devtools/data.mjs.map +1 -1
- package/esm/devtools/feature-map.mjs +149 -0
- package/esm/devtools/feature-map.mjs.map +1 -0
- package/esm/devtools/index.d.mts +2 -2
- package/esm/devtools/index.mjs +30 -9
- package/esm/devtools/index.mjs.map +1 -1
- package/esm/devtools/product-map.d.mts.map +1 -1
- package/esm/devtools/product-map.mjs +82 -7
- package/esm/devtools/product-map.mjs.map +1 -1
- package/esm/devtools/site.d.mts +43 -1
- package/esm/devtools/site.d.mts.map +1 -1
- package/esm/devtools/site.mjs +111 -15
- package/esm/devtools/site.mjs.map +1 -1
- package/esm/devtools/snapshot-source.mjs +15 -2
- package/esm/devtools/snapshot-source.mjs.map +1 -1
- package/esm/index.d.mts +3 -3
- package/esm/ownership/index.d.mts.map +1 -1
- package/esm/ownership/index.mjs +60 -1
- package/esm/ownership/index.mjs.map +1 -1
- package/esm/scry/compact.mjs +2 -1
- package/esm/scry/compact.mjs.map +1 -1
- package/esm/scry/format.d.mts.map +1 -1
- package/esm/scry/format.mjs +12 -1
- package/esm/scry/format.mjs.map +1 -1
- package/esm/scry/query.d.mts.map +1 -1
- package/esm/scry/query.mjs +147 -23
- package/esm/scry/query.mjs.map +1 -1
- package/esm/test-results/index.d.mts.map +1 -1
- package/esm/test-results/index.mjs.map +1 -1
- package/esm/warlock/actions.mjs +15 -7
- package/esm/warlock/actions.mjs.map +1 -1
- package/esm/warlock/adapter.d.mts.map +1 -1
- package/esm/warlock/adapter.mjs +36 -2
- package/esm/warlock/adapter.mjs.map +1 -1
- package/esm/warlock/commands.mjs +7 -2
- package/esm/warlock/commands.mjs.map +1 -1
- package/esm/warlock/logo.mjs +12 -0
- package/esm/warlock/logo.mjs.map +1 -0
- package/esm/warlock/mcp-tools.mjs +6 -6
- package/esm/warlock/mcp-tools.mjs.map +1 -1
- package/esm/workspace/cache.mjs +194 -0
- package/esm/workspace/cache.mjs.map +1 -0
- package/esm/workspace/index.d.mts.map +1 -1
- package/esm/workspace/index.mjs +3 -1
- package/esm/workspace/index.mjs.map +1 -1
- package/llms-full.txt +32 -9
- package/package.json +3 -3
- package/skills/record-a-change/SKILL.md +2 -0
- package/skills/use-the-grimoire/SKILL.md +30 -9
- package/ui/grimoire-static.js +57 -6
- package/ui/grimoire-view.js +1289 -310
- package/ui/grimoire.css +583 -2
- package/ui/product-map.css +157 -8
- package/ui/product-map.js +507 -59
package/ui/grimoire-static.js
CHANGED
|
@@ -28,26 +28,75 @@ function grimoireStaticApi(data) {
|
|
|
28
28
|
const text = (params.get("q") ?? "").trim().toLowerCase();
|
|
29
29
|
const limit = Number(params.get("limit")) || 20;
|
|
30
30
|
const hits = [];
|
|
31
|
+
const wordsOf = (value) =>
|
|
32
|
+
value
|
|
33
|
+
.toLowerCase()
|
|
34
|
+
.split(/[^a-z0-9]+/)
|
|
35
|
+
.filter(Boolean);
|
|
36
|
+
const tokens = wordsOf(text);
|
|
31
37
|
for (const item of data.search) {
|
|
32
38
|
const id = item.id.toLowerCase();
|
|
33
39
|
const detail = (item.detail ?? "").toLowerCase();
|
|
34
|
-
const
|
|
40
|
+
const written = item.type === "feature" || item.type === "flow";
|
|
41
|
+
const body = written && item.text ? wordsOf(item.text) : [];
|
|
42
|
+
// Written text matches whole words (a short token must equal a word), so "5" finds AC-5 and not AC-15.
|
|
43
|
+
const inBody =
|
|
44
|
+
tokens.length > 0 &&
|
|
45
|
+
body.length > 0 &&
|
|
46
|
+
tokens.every((token) =>
|
|
47
|
+
body.some((word) => (token.length >= 3 ? word.startsWith(token) : word === token)),
|
|
48
|
+
);
|
|
49
|
+
let score =
|
|
35
50
|
id === text
|
|
36
51
|
? 4
|
|
37
52
|
: id.startsWith(text)
|
|
38
53
|
? 3
|
|
39
54
|
: id.includes(text)
|
|
40
55
|
? 2
|
|
41
|
-
: detail.includes(text)
|
|
56
|
+
: detail.includes(text) || inBody
|
|
42
57
|
? 1
|
|
43
58
|
: 0;
|
|
44
|
-
|
|
59
|
+
// Written content ranks above files and exports of the same match.
|
|
60
|
+
if (text && score && written) score += 2;
|
|
61
|
+
if (text && score) hits.push({ ...item, text: undefined, score });
|
|
45
62
|
}
|
|
46
63
|
hits.sort((left, right) => right.score - left.score || left.id.localeCompare(right.id));
|
|
64
|
+
// Features and flows keep a share of the limit, so files never push them out; the list is grouped by type.
|
|
65
|
+
const order = [
|
|
66
|
+
"feature",
|
|
67
|
+
"flow",
|
|
68
|
+
"block",
|
|
69
|
+
"page",
|
|
70
|
+
"screen",
|
|
71
|
+
"route",
|
|
72
|
+
"mail",
|
|
73
|
+
"job",
|
|
74
|
+
"file",
|
|
75
|
+
"export",
|
|
76
|
+
"task",
|
|
77
|
+
];
|
|
78
|
+
const writtenHits = hits
|
|
79
|
+
.filter((hit) => hit.type === "feature" || hit.type === "flow")
|
|
80
|
+
.slice(0, Math.max(1, Math.ceil(limit * 0.75)));
|
|
81
|
+
const chosen = new Set(writtenHits);
|
|
82
|
+
for (const hit of hits) {
|
|
83
|
+
if (chosen.size >= limit) break;
|
|
84
|
+
chosen.add(hit);
|
|
85
|
+
}
|
|
86
|
+
const counts = {};
|
|
87
|
+
for (const hit of hits) counts[hit.type] = (counts[hit.type] ?? 0) + 1;
|
|
47
88
|
return {
|
|
48
89
|
type: "search",
|
|
49
90
|
text,
|
|
50
|
-
|
|
91
|
+
counts,
|
|
92
|
+
hits: [...chosen]
|
|
93
|
+
.sort(
|
|
94
|
+
(left, right) =>
|
|
95
|
+
order.indexOf(left.type) - order.indexOf(right.type) ||
|
|
96
|
+
right.score - left.score ||
|
|
97
|
+
left.id.localeCompare(right.id),
|
|
98
|
+
)
|
|
99
|
+
.map(({ text: _text, ...hit }) => hit),
|
|
51
100
|
routes: data.routes.summary?.routes ?? "cached",
|
|
52
101
|
notes: [],
|
|
53
102
|
};
|
|
@@ -80,8 +129,10 @@ function grimoireStaticContext(data, root, rerender) {
|
|
|
80
129
|
if (value == null) continue;
|
|
81
130
|
if (key === "class") node.setAttribute("class", value);
|
|
82
131
|
else if (key === "text") node.textContent = value;
|
|
83
|
-
else if (
|
|
84
|
-
|
|
132
|
+
else if (/^on[a-z]+$/i.test(key)) {
|
|
133
|
+
// Only a real function becomes a listener; a string `on*` attribute is never set (it would be script).
|
|
134
|
+
if (typeof value === "function") node.addEventListener(key.slice(2).toLowerCase(), value);
|
|
135
|
+
} else node.setAttribute(key, value);
|
|
85
136
|
}
|
|
86
137
|
};
|
|
87
138
|
const build = (node, attrs, children) => {
|