2 Commits
v1.5.0 ... main

Author SHA1 Message Date
976c4d0980 1.5.1
Some checks failed
CI / Type Check & Lint (push) Failing after 15s
Publish to npm / npm-publish (push) Failing after 42s
CI / Build Test (Current Platform) (push) Successful in 1m14s
CI / Build All Platforms (push) Successful in 1m56s
Release / build-and-release (push) Successful in 3m55s
2025-10-29 01:23:04 +00:00
eda652994d fix(scriptindex): Improve script search: use ObjectSorter with weighted results prioritizing slug and name 2025-10-29 01:23:04 +00:00
5 changed files with 33 additions and 19 deletions

View File

@@ -1,5 +1,13 @@
# Changelog
## 2025-10-29 - 1.5.1 - fix(scriptindex)
Improve script search: use ObjectSorter with weighted results prioritizing slug and name
- Replaced smartfuzzy.FuzzyMatcher with smartfuzzy.ObjectSorter for multi-field fuzzy searching
- Search now runs across slug, name, and description fields
- Added weighting so slug matches are prioritized, name matches receive a medium boost
- Search returns ordered script objects based on adjusted score
## 2025-10-29 - 1.5.0 - feat(scripts)
Add fuzzy search and type filtering for community scripts; improve scripts CLI output and cache handling

View File

@@ -1,6 +1,6 @@
{
"name": "@serve.zone/moxytool",
"version": "1.5.0",
"version": "1.5.1",
"exports": "./mod.ts",
"nodeModulesDir": "auto",
"tasks": {

View File

@@ -1,6 +1,6 @@
{
"name": "@serve.zone/moxytool",
"version": "1.5.0",
"version": "1.5.1",
"description": "Proxmox administration tool for vGPU setup, VM management, and cluster configuration",
"keywords": [
"proxmox",

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/moxytool',
version: '1.5.0',
version: '1.5.1',
description: 'Proxmox administration tool for vGPU setup, VM management, and cluster configuration'
}

View File

@@ -272,29 +272,35 @@ export class ScriptIndex {
scripts = scripts.filter((script) => script.type === typeFilter);
}
// Use smartfuzzy for ranking
const fuzzyMatcher = new plugins.smartfuzzy.FuzzyMatcher();
// Use ObjectSorter for fuzzy searching across multiple fields
const sorter = new plugins.smartfuzzy.ObjectSorter(scripts);
const scoredResults = scripts.map((script) => {
// Calculate match scores for each field
const nameScore = script.name ? fuzzyMatcher.match(query, script.name) : 0;
const slugScore = script.slug ? fuzzyMatcher.match(query, script.slug) : 0;
const descScore = script.description ? fuzzyMatcher.match(query, script.description) : 0;
// Search across slug, name, and description
const results = sorter.sort(query, ['slug', 'name', 'description']);
// Prioritize: slug > name > description
const totalScore = slugScore * 3 + nameScore * 2 + descScore;
// Post-process to weight results by which field matched
const weightedResults = results.map((result) => {
let weight = 1;
// Boost score if match was in slug (highest priority)
if (result.matches?.some((m) => m.key === 'slug')) {
weight = 3;
}
// Boost if match was in name (medium priority)
else if (result.matches?.some((m) => m.key === 'name')) {
weight = 2;
}
return {
script,
score: totalScore,
...result,
adjustedScore: (result.score || 0) / weight,
};
});
// Filter out non-matches and sort by score
return scoredResults
.filter((result) => result.score > 0)
.sort((a, b) => b.score - a.score)
.map((result) => result.script);
// Sort by adjusted score and return just the script objects
return weightedResults
.sort((a, b) => (a.adjustedScore || 0) - (b.adjustedScore || 0))
.map((result) => result.item);
}
/**