@agentskillshub/cli 0.2.0 → 0.2.1
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/bin/ash.mjs +14 -1
- package/package.json +1 -1
package/bin/ash.mjs
CHANGED
|
@@ -181,9 +181,22 @@ function applyFilters(skills, f) {
|
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
/** Tokenize a query. Splits on whitespace AND at latin↔CJK boundaries, so a
|
|
185
|
+
* glued mixed query like "ppt制作" becomes ["ppt", "制作"] (otherwise it's one
|
|
186
|
+
* token that matches nothing). Pure-CJK compounds still rely on the bigram
|
|
187
|
+
* fallback in scoreRow. */
|
|
188
|
+
function tokenize(q) {
|
|
189
|
+
return q
|
|
190
|
+
.toLowerCase()
|
|
191
|
+
.replace(/([a-z0-9])([一-鿿])/g, "$1 $2")
|
|
192
|
+
.replace(/([一-鿿])([a-z0-9])/g, "$1 $2")
|
|
193
|
+
.split(/\s+/)
|
|
194
|
+
.filter(Boolean);
|
|
195
|
+
}
|
|
196
|
+
|
|
184
197
|
function runSearch(index, args) {
|
|
185
198
|
const f = parseFilters(args);
|
|
186
|
-
const tokens = f.query
|
|
199
|
+
const tokens = tokenize(f.query);
|
|
187
200
|
const pool = applyFilters(index.skills, f);
|
|
188
201
|
const ranked = pool
|
|
189
202
|
.map((r) => ({ r, score: scoreRow(r, tokens) }))
|
package/package.json
CHANGED