* chore: remove dead/unreferenced files across ui, vscode Remove 59 unused source files (components, hooks, lib utils, stores, barrels, and orphaned vscode github modules) that are not imported by any entry-reachable code. Also drop a stale test mock for the removed execCommands module. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com> * refactor: remove unused exported symbols (types, functions, consts, hooks) Remove exported symbols whose identifier is referenced nowhere in the repository (verified via repo-wide search), across ui types/contracts, lib utilities, sync layer, stores, and components. Also drop the few imports/private helpers orphaned by these removals. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com> * refactor: remove more unused exports (desktop, shortcuts, worktree, vscode) Continue removing repo-wide unreferenced exported functions, consts and types across lib/desktop, shortcuts, worktreeSessionCreator, sync, and vscode gitService, with cascading orphaned helpers/imports cleaned up. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com> * chore: add dead-code cleanup tooling * refactor: checkpoint dead-code cleanup * refactor: remove dead-code suppressions --------- Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com> Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
/**
|
|
* ClawdHub skill scanning
|
|
*
|
|
* Fetches all available skills from the ClawdHub registry
|
|
* and transforms them into SkillsCatalogItem format.
|
|
*/
|
|
|
|
import { fetchClawdHubSkills } from './api.js';
|
|
|
|
const CLAWDHUB_PAGE_LIMIT = 25;
|
|
|
|
const mapClawdHubItem = (item) => {
|
|
const latestVersion = item.tags?.latest || item.latestVersion?.version || '1.0.0';
|
|
|
|
return {
|
|
sourceId: 'clawdhub',
|
|
repoSource: 'clawdhub:registry',
|
|
repoSubpath: null,
|
|
gitIdentityId: null,
|
|
skillDir: item.slug,
|
|
skillName: item.slug,
|
|
frontmatterName: item.displayName || item.slug,
|
|
description: item.summary || null,
|
|
installable: true,
|
|
warnings: [],
|
|
// ClawdHub-specific metadata
|
|
clawdhub: {
|
|
slug: item.slug,
|
|
version: latestVersion,
|
|
displayName: item.displayName,
|
|
owner: item.owner?.handle || null,
|
|
downloads: item.stats?.downloads || 0,
|
|
stars: item.stats?.stars || 0,
|
|
versionsCount: item.stats?.versions || 1,
|
|
createdAt: item.createdAt,
|
|
updatedAt: item.updatedAt,
|
|
},
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Scan a single ClawdHub page (cursor-based)
|
|
* @returns {Promise<{ ok: boolean, items?: Array, nextCursor?: string | null, error?: Object }>}
|
|
*/
|
|
export async function scanClawdHubPage({ cursor } = {}) {
|
|
try {
|
|
const { items, nextCursor } = await fetchClawdHubSkills({ cursor });
|
|
const mapped = (items || []).map(mapClawdHubItem).slice(0, CLAWDHUB_PAGE_LIMIT);
|
|
mapped.sort((a, b) => (b.clawdhub?.downloads || 0) - (a.clawdhub?.downloads || 0));
|
|
return { ok: true, items: mapped, nextCursor: nextCursor || null };
|
|
} catch (error) {
|
|
console.error('ClawdHub page scan error:', error);
|
|
return {
|
|
ok: false,
|
|
error: {
|
|
kind: 'networkError',
|
|
message: error instanceof Error ? error.message : 'Failed to fetch skills from ClawdHub',
|
|
},
|
|
};
|
|
}
|
|
}
|