@hraness/wordcell 0.22.2 → 0.22.4
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/README.md +4 -4
- package/dist/cli.js +4 -4
- package/dist/{index-3agn8scn.js → index-23m6bbjt.js} +47 -11
- package/dist/{index-bw2r37z9.js → index-9h7zh0wt.js} +1 -1
- package/dist/{index-hmw17zaa.js → index-pnt9wr59.js} +516 -230
- package/dist/index.js +2 -2
- package/dist/publish-reader/reader.js +48 -12
- package/dist/publish-search.js +1 -1
- package/dist/publish.js +2 -2
- package/dist/{support-p452p9c4.js → support-m3t917ev.js} +3 -3
- package/package.json +3 -3
- package/skills/wordcell/SKILL.md +1 -1
- package/src/publish-index.ts +3 -2
- package/src/publish-markdown.ts +400 -122
- package/src/publish-model.ts +2 -2
- package/src/publish-reader/reader.ts +3 -1
- package/src/publish-search.ts +44 -13
- package/src/publish.ts +4 -1
package/README.md
CHANGED
|
@@ -42,14 +42,14 @@ Git evidence, and selective publishing. [Compare the tradeoffs](https://github.c
|
|
|
42
42
|
The CLI and TypeScript SDK run with Bun. Install the versioned GitHub archive:
|
|
43
43
|
|
|
44
44
|
```sh
|
|
45
|
-
bun add --global --ignore-scripts https://github.com/hraness/wordcell/releases/download/v0.22.
|
|
45
|
+
bun add --global --ignore-scripts https://github.com/hraness/wordcell/releases/download/v0.22.4/hraness-wordcell-0.22.4.tgz
|
|
46
46
|
wordcell --help
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Prefer npm? The same release is [mirrored there](https://www.npmjs.com/package/@hraness/wordcell):
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
|
-
npm install --global --ignore-scripts @hraness/wordcell@0.22.
|
|
52
|
+
npm install --global --ignore-scripts @hraness/wordcell@0.22.4
|
|
53
53
|
wordcell --help
|
|
54
54
|
```
|
|
55
55
|
|
|
@@ -91,7 +91,7 @@ After trying the CLI, install the public Agent Skill into a compatible agent,
|
|
|
91
91
|
such as Claude Code, Codex, Cursor, or GitHub Copilot:
|
|
92
92
|
|
|
93
93
|
```sh
|
|
94
|
-
bunx skills add hraness/wordcell#v0.22.
|
|
94
|
+
bunx skills add hraness/wordcell#v0.22.4 --skill wordcell
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
Then ask:
|
|
@@ -283,7 +283,7 @@ exist. [Graph queries and proof limits](https://github.com/hraness/wordcell/blob
|
|
|
283
283
|
Add the same immutable release to a Bun project:
|
|
284
284
|
|
|
285
285
|
```sh
|
|
286
|
-
bun add --exact --ignore-scripts https://github.com/hraness/wordcell/releases/download/v0.22.
|
|
286
|
+
bun add --exact --ignore-scripts https://github.com/hraness/wordcell/releases/download/v0.22.4/hraness-wordcell-0.22.4.tgz
|
|
287
287
|
```
|
|
288
288
|
|
|
289
289
|
The SDK provides read-only vault sessions, metadata queries, search, graph
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
parseArguments,
|
|
6
6
|
runExecutable,
|
|
7
7
|
usage
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-9h7zh0wt.js";
|
|
9
9
|
import"./index-bcknqxrq.js";
|
|
10
10
|
import"./index-054mb7d3.js";
|
|
11
11
|
import"./index-bqtqeak3.js";
|
|
@@ -41,14 +41,14 @@ import"./index-tf4wzjew.js";
|
|
|
41
41
|
import"./index-1gwbassd.js";
|
|
42
42
|
import"./index-vnybgywh.js";
|
|
43
43
|
import"./index-1xxnjn0d.js";
|
|
44
|
-
import"./index-
|
|
44
|
+
import"./index-pnt9wr59.js";
|
|
45
45
|
import"./index-233z9wmn.js";
|
|
46
46
|
import"./index-d13v9ckt.js";
|
|
47
47
|
import"./index-48pz4jpc.js";
|
|
48
48
|
import"./index-06c9ctr6.js";
|
|
49
49
|
import"./index-4knsp9qj.js";
|
|
50
50
|
import"./index-66pshdtx.js";
|
|
51
|
-
import"./index-
|
|
51
|
+
import"./index-23m6bbjt.js";
|
|
52
52
|
import"./index-hya40gb2.js";
|
|
53
53
|
import"./index-5vwpzb5a.js";
|
|
54
54
|
import"./index-x3fthpsc.js";
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
|
|
62
62
|
// src/cli.ts
|
|
63
63
|
if (import.meta.main) {
|
|
64
|
-
const { standaloneSupportEnvironment, isUsefulSupportResult, runProductSupportCommand, showProductSupportInvitation } = await import("./support-
|
|
64
|
+
const { standaloneSupportEnvironment, isUsefulSupportResult, runProductSupportCommand, showProductSupportInvitation } = await import("./support-m3t917ev.js");
|
|
65
65
|
const env = standaloneSupportEnvironment();
|
|
66
66
|
const args = process.argv.slice(2);
|
|
67
67
|
if (args[0] === "support") {
|
|
@@ -285,22 +285,58 @@ function comparePublishScores(left, right) {
|
|
|
285
285
|
return Number(right.identity) - Number(left.identity) || right.score - left.score || left.i - right.i;
|
|
286
286
|
}
|
|
287
287
|
function publishSnippet(text, query, fallback, windowBytes = 160) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
if (!Number.isSafeInteger(windowBytes) || windowBytes < 0)
|
|
289
|
+
throw new RangeError("Snippet window must be a nonnegative safe byte count.");
|
|
290
|
+
const display = text.normalize("NFC");
|
|
291
|
+
const normalized = publishNormalize(display);
|
|
292
|
+
let match = query.normalized === "" ? -1 : normalized.indexOf(query.normalized);
|
|
293
|
+
if (match < 0) {
|
|
291
294
|
for (const term of query.terms) {
|
|
292
|
-
|
|
293
|
-
if (
|
|
295
|
+
match = normalized.indexOf(term);
|
|
296
|
+
if (match >= 0)
|
|
294
297
|
break;
|
|
295
298
|
}
|
|
296
299
|
}
|
|
297
|
-
if (
|
|
300
|
+
if (match < 0)
|
|
298
301
|
return fallback;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
let offset = 0, normalizedOffset = 0;
|
|
303
|
+
for (const character of display) {
|
|
304
|
+
const width = character.toLocaleLowerCase("en-US").length;
|
|
305
|
+
if (normalizedOffset + width > match)
|
|
306
|
+
break;
|
|
307
|
+
normalizedOffset += width;
|
|
308
|
+
offset += character.length;
|
|
309
|
+
}
|
|
310
|
+
const edge = windowBytes >= 6 ? "\u2026" : "";
|
|
311
|
+
const budget = windowBytes - 2 * publishUtf8Bytes(edge);
|
|
312
|
+
const previous = (end2) => {
|
|
313
|
+
const last = display.charCodeAt(end2 - 1);
|
|
314
|
+
return end2 > 1 && last >= 56320 && last <= 57343 && display.charCodeAt(end2 - 2) >= 55296 && display.charCodeAt(end2 - 2) <= 56319 ? end2 - 2 : end2 - 1;
|
|
315
|
+
};
|
|
316
|
+
let start = offset, end = offset, used = 0;
|
|
317
|
+
while (start > 0) {
|
|
318
|
+
const before = previous(start), bytes = publishUtf8Bytes(display.slice(before, start));
|
|
319
|
+
if (used + bytes > Math.floor(budget / 2))
|
|
320
|
+
break;
|
|
321
|
+
start = before;
|
|
322
|
+
used += bytes;
|
|
323
|
+
}
|
|
324
|
+
while (end < display.length) {
|
|
325
|
+
const character = String.fromCodePoint(display.codePointAt(end) ?? 0), bytes = publishUtf8Bytes(character);
|
|
326
|
+
if (used + bytes > budget)
|
|
327
|
+
break;
|
|
328
|
+
end += character.length;
|
|
329
|
+
used += bytes;
|
|
330
|
+
}
|
|
331
|
+
while (start > 0) {
|
|
332
|
+
const before = previous(start), bytes = publishUtf8Bytes(display.slice(before, start));
|
|
333
|
+
if (used + bytes > budget)
|
|
334
|
+
break;
|
|
335
|
+
start = before;
|
|
336
|
+
used += bytes;
|
|
337
|
+
}
|
|
338
|
+
const snippet = display.slice(start, end).replace(/\s+/gu, " ").trim();
|
|
339
|
+
return `${start > 0 ? edge : ""}${snippet}${end < display.length ? edge : ""}`;
|
|
304
340
|
}
|
|
305
341
|
|
|
306
342
|
export { PUBLISH_FIELD_TITLE, PUBLISH_FIELD_ALIAS, PUBLISH_FIELD_PATH, PUBLISH_FIELD_TAG, PUBLISH_FIELD_METADATA, PUBLISH_FIELD_CONTENT, PUBLISH_SEARCH_WEIGHTS_V1, MAX_PUBLISH_QUERY_BYTES, MAX_PUBLISH_QUERY_TERMS, MAX_PUBLISH_PREFIX_EXPANSIONS, publishUtf8Bytes, publishNormalize, MAX_PUBLISH_QUERY_FILTERS, publishQueryParts, publishDocMatchesFilters, MAX_PUBLISH_MARK_RANGES, publishMarkRanges, publishQuery, publishShardName, publishPrefixTerms, scorePublishDocument, comparePublishScores, publishSnippet };
|