fix: resolve empty marketplace search results by supporting fallback regex parsing (#273)
This commit is contained in:
committed by
GitHub
Unverified
parent
c1719b3d52
commit
2b966cc573
@@ -163,7 +163,7 @@ export class ClawHubService {
|
|||||||
|
|
||||||
// Format could be: slug vversion description (score)
|
// Format could be: slug vversion description (score)
|
||||||
// Or sometimes: slug vversion description
|
// Or sometimes: slug vversion description
|
||||||
const match = cleanLine.match(/^(\S+)\s+v?(\d+\.\S+)\s+(.+)$/);
|
let match = cleanLine.match(/^(\S+)\s+v?(\d+\.\S+)\s+(.+)$/);
|
||||||
if (match) {
|
if (match) {
|
||||||
const slug = match[1];
|
const slug = match[1];
|
||||||
const version = match[2];
|
const version = match[2];
|
||||||
@@ -179,6 +179,24 @@ export class ClawHubService {
|
|||||||
description,
|
description,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback for new clawhub search format without version:
|
||||||
|
// slug name/description (score)
|
||||||
|
match = cleanLine.match(/^(\S+)\s+(.+)$/);
|
||||||
|
if (match) {
|
||||||
|
const slug = match[1];
|
||||||
|
let description = match[2];
|
||||||
|
|
||||||
|
// Clean up score if present at the end
|
||||||
|
description = description.replace(/\(\d+\.\d+\)$/, '').trim();
|
||||||
|
|
||||||
|
return {
|
||||||
|
slug,
|
||||||
|
name: slug,
|
||||||
|
version: 'latest', // Fallback version since it's not provided
|
||||||
|
description,
|
||||||
|
};
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}).filter((s): s is ClawHubSkillResult => s !== null);
|
}).filter((s): s is ClawHubSkillResult => s !== null);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user