chore: remove dead code (59 unused files + ~125 unused exports) (#1835)
* 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>
This commit is contained in:
committed by
GitHub
co-authored by
Serhii Dziupin
Bohdan Triapitsyn
parent
4a37b9a005
commit
00821700de
@@ -23,7 +23,3 @@ export function setCachedScan(key, value, ttlMs = DEFAULT_TTL_MS) {
|
||||
const ttl = Number.isFinite(ttlMs) ? ttlMs : DEFAULT_TTL_MS;
|
||||
cache.set(key, { expiresAt: Date.now() + ttl, value });
|
||||
}
|
||||
|
||||
export function clearCache() {
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
@@ -82,38 +82,6 @@ export async function fetchClawdHubSkills({ cursor } = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch details for a specific skill version
|
||||
* @param {string} slug - Skill slug/identifier
|
||||
* @param {string} [version='latest'] - Version string or 'latest'
|
||||
* @returns {Promise<{ skill: Object, version: Object }>}
|
||||
*/
|
||||
export async function fetchClawdHubSkillVersion(slug, version = 'latest') {
|
||||
// For 'latest', we need to first get the skill metadata to find the latest version
|
||||
if (version === 'latest') {
|
||||
const skillResponse = await rateLimitedFetch(`${CLAWDHUB_API_BASE}/skills/${encodeURIComponent(slug)}`);
|
||||
if (!skillResponse.ok) {
|
||||
throw new Error(`ClawdHub skill not found: ${slug}`);
|
||||
}
|
||||
const skillData = await skillResponse.json();
|
||||
const latestVersion = skillData.skill?.tags?.latest || skillData.latestVersion?.version;
|
||||
if (!latestVersion) {
|
||||
throw new Error(`No latest version found for skill: ${slug}`);
|
||||
}
|
||||
version = latestVersion;
|
||||
}
|
||||
|
||||
const url = `${CLAWDHUB_API_BASE}/skills/${encodeURIComponent(slug)}/versions/${encodeURIComponent(version)}`;
|
||||
const response = await rateLimitedFetch(url);
|
||||
|
||||
if (!response.ok) {
|
||||
const text = await response.text().catch(() => '');
|
||||
throw new Error(`ClawdHub version error (${response.status}): ${text || response.statusText}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a skill package as a ZIP buffer
|
||||
* @param {string} slug - Skill slug/identifier
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* ClawdHub integration module
|
||||
*
|
||||
* Provides skill browsing and installation from the ClawdHub registry.
|
||||
* https://clawdhub.com
|
||||
*/
|
||||
|
||||
export { scanClawdHub, scanClawdHubPage } from './scan.js';
|
||||
export { installSkillsFromClawdHub } from './install.js';
|
||||
export {
|
||||
fetchClawdHubSkills,
|
||||
fetchClawdHubSkillVersion,
|
||||
fetchClawdHubSkillInfo,
|
||||
downloadClawdHubSkill,
|
||||
} from './api.js';
|
||||
|
||||
/**
|
||||
* Check if a source string refers to ClawdHub
|
||||
* @param {string} source
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isClawdHubSource(source) {
|
||||
return typeof source === 'string' && source.startsWith('clawdhub:');
|
||||
}
|
||||
|
||||
/**
|
||||
* ClawdHub source identifier used in curated sources
|
||||
*/
|
||||
export const CLAWDHUB_SOURCE_ID = 'clawdhub';
|
||||
export const CLAWDHUB_SOURCE_STRING = 'clawdhub:registry';
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
import { fetchClawdHubSkills } from './api.js';
|
||||
|
||||
const MAX_PAGES = 20; // Safety limit to prevent infinite loops
|
||||
const CLAWDHUB_PAGE_LIMIT = 25;
|
||||
|
||||
const mapClawdHubItem = (item) => {
|
||||
@@ -39,57 +38,6 @@ const mapClawdHubItem = (item) => {
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Scan ClawdHub registry for all available skills
|
||||
* @returns {Promise<{ ok: boolean, items?: Array, error?: Object }>}
|
||||
*/
|
||||
export async function scanClawdHub() {
|
||||
try {
|
||||
const allItems = [];
|
||||
let cursor = null;
|
||||
|
||||
for (let page = 0; page < MAX_PAGES; page++) {
|
||||
let items = [];
|
||||
let nextCursor = null;
|
||||
|
||||
try {
|
||||
const pageResult = await fetchClawdHubSkills({ cursor });
|
||||
items = pageResult.items || [];
|
||||
nextCursor = pageResult.nextCursor || null;
|
||||
} catch (error) {
|
||||
if (page > 0 && allItems.length > 0) {
|
||||
console.warn('ClawdHub pagination failed; returning partial results.');
|
||||
break;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
for (const item of items) {
|
||||
allItems.push(mapClawdHubItem(item));
|
||||
}
|
||||
|
||||
if (!nextCursor) {
|
||||
break;
|
||||
}
|
||||
cursor = nextCursor;
|
||||
}
|
||||
|
||||
// Sort by downloads (most popular first)
|
||||
allItems.sort((a, b) => (b.clawdhub?.downloads || 0) - (a.clawdhub?.downloads || 0));
|
||||
|
||||
return { ok: true, items: allItems };
|
||||
} catch (error) {
|
||||
console.error('ClawdHub scan error:', error);
|
||||
return {
|
||||
ok: false,
|
||||
error: {
|
||||
kind: 'networkError',
|
||||
message: error instanceof Error ? error.message : 'Failed to fetch skills from ClawdHub',
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan a single ClawdHub page (cursor-based)
|
||||
* @returns {Promise<{ ok: boolean, items?: Array, nextCursor?: string | null, error?: Object }>}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const CURATED_SKILLS_SOURCES = [
|
||||
const CURATED_SKILLS_SOURCES = [
|
||||
{
|
||||
id: 'anthropic',
|
||||
label: 'Anthropic',
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Skills catalog module
|
||||
*
|
||||
* Provides skill scanning, installation, and caching from GitHub repositories and ClawdHub.
|
||||
*/
|
||||
|
||||
export {
|
||||
CURATED_SKILLS_SOURCES,
|
||||
getCuratedSkillsSources,
|
||||
} from './curated-sources.js';
|
||||
|
||||
export {
|
||||
getCacheKey,
|
||||
getCachedScan,
|
||||
setCachedScan,
|
||||
clearCache,
|
||||
} from './cache.js';
|
||||
|
||||
export {
|
||||
parseSkillRepoSource,
|
||||
} from './source.js';
|
||||
|
||||
export {
|
||||
scanSkillsRepository,
|
||||
} from './scan.js';
|
||||
|
||||
export {
|
||||
installSkillsFromRepository,
|
||||
} from './install.js';
|
||||
|
||||
export {
|
||||
scanClawdHub,
|
||||
scanClawdHubPage,
|
||||
installSkillsFromClawdHub,
|
||||
fetchClawdHubSkills,
|
||||
fetchClawdHubSkillVersion,
|
||||
fetchClawdHubSkillInfo,
|
||||
downloadClawdHubSkill,
|
||||
isClawdHubSource,
|
||||
CLAWDHUB_SOURCE_ID,
|
||||
CLAWDHUB_SOURCE_STRING,
|
||||
} from './clawdhub/index.js';
|
||||
@@ -1,4 +1,5 @@
|
||||
const GITHUB_HOST = 'github.com';
|
||||
const CLAWDHUB_SOURCE_PREFIX = 'clawdhub:';
|
||||
|
||||
|
||||
function normalizeGitOwnerRepo(owner, repo) {
|
||||
@@ -85,3 +86,7 @@ export function parseSkillRepoSource(input, options = {}) {
|
||||
|
||||
return { ok: false, error: { kind: 'invalidSource', message: 'Unsupported repository source format' } };
|
||||
}
|
||||
|
||||
export function isClawdHubSource(input) {
|
||||
return typeof input === 'string' && input.trim().toLowerCase().startsWith(CLAWDHUB_SOURCE_PREFIX);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user