mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-18 18:04:26 +00:00
* feat: integrate skills.sh as first-class registry Add SkillsShRegistry and SkillsShProvider so users can install skills directly from skills.sh (e.g. `skillkit install skills.sh/owner/repo/skill`). The find command now searches skills.sh by default alongside the local marketplace. Post-install shows skills.sh popularity stats and pro tips highlighting skillkit's unique features (translate, recommend, evaluate). * fix: address CodeRabbit and Devin review findings for skills.sh integration - Fix path traversal vulnerability in SkillsShProvider.clone (validate subpath containment) - Fix federated search skipped for interactive queries (use searchTerm instead of this.query) - Guard showSkillsShStats to skip network call for local providers - Replace deprecated npm --production with --omit=dev - Fix loose includes() match in getSkillStats to use strict endsWith() - Fix FederatedSearch resilience: don't re-throw RateLimitError, return partial results - Forward timeoutMs through FederatedSearch to registries - Extract shared formatCount utility to helpers.ts (deduplicate find.ts/install.ts) - Fix install hint to use skill.source instead of fragile skill.description - Fix timer leak in fetchLeaderboard using finally block - Deduplicate URL parsing via shared parseSkillsShParts helper - Validate --agent flag values against known agent types
71 lines
2.3 KiB
TypeScript
71 lines
2.3 KiB
TypeScript
// Re-export commonly used functions with proper adapters
|
|
import {
|
|
loadConfig,
|
|
getSearchDirs as coreGetSearchDirs,
|
|
getInstallDir as coreGetInstallDir,
|
|
getAgentConfigPath as coreGetAgentConfigPath,
|
|
initProject as coreInitProject,
|
|
loadSkillMetadata as coreLoadSkillMetadata,
|
|
saveSkillMetadata as coreSaveSkillMetadata,
|
|
} from "@skillkit/core";
|
|
import { getAdapter, detectAgent } from "@skillkit/agents";
|
|
import type { AgentType, AgentAdapterInfo } from "@skillkit/core";
|
|
|
|
// Re-export metadata functions directly (they don't need adapter bridging)
|
|
export const loadSkillMetadata = coreLoadSkillMetadata;
|
|
export const saveSkillMetadata = coreSaveSkillMetadata;
|
|
|
|
export function getSearchDirs(agentType?: AgentType): string[] {
|
|
const type = agentType || loadConfig().agent;
|
|
const adapter = getAdapter(type);
|
|
const adapterInfo: AgentAdapterInfo = {
|
|
type: adapter.type,
|
|
name: adapter.name,
|
|
skillsDir: adapter.skillsDir,
|
|
configFile: adapter.configFile,
|
|
};
|
|
return coreGetSearchDirs(adapterInfo);
|
|
}
|
|
|
|
export function getInstallDir(global = false, agentType?: AgentType): string {
|
|
const type = agentType || loadConfig().agent;
|
|
const adapter = getAdapter(type);
|
|
const adapterInfo: AgentAdapterInfo = {
|
|
type: adapter.type,
|
|
name: adapter.name,
|
|
skillsDir: adapter.skillsDir,
|
|
configFile: adapter.configFile,
|
|
};
|
|
return coreGetInstallDir(adapterInfo, global);
|
|
}
|
|
|
|
export function getAgentConfigPath(agentType?: AgentType): string {
|
|
const type = agentType || loadConfig().agent;
|
|
const adapter = getAdapter(type);
|
|
const adapterInfo: AgentAdapterInfo = {
|
|
type: adapter.type,
|
|
name: adapter.name,
|
|
skillsDir: adapter.skillsDir,
|
|
configFile: adapter.configFile,
|
|
};
|
|
return coreGetAgentConfigPath(adapterInfo);
|
|
}
|
|
|
|
export async function initProject(agentType?: AgentType): Promise<void> {
|
|
const type = agentType || (await detectAgent());
|
|
const adapter = getAdapter(type);
|
|
const adapterInfo: AgentAdapterInfo = {
|
|
type: adapter.type,
|
|
name: adapter.name,
|
|
skillsDir: adapter.skillsDir,
|
|
configFile: adapter.configFile,
|
|
};
|
|
return coreInitProject(type, adapterInfo);
|
|
}
|
|
|
|
export function formatCount(count: number): string {
|
|
if (count >= 1_000_000) return `${(count / 1_000_000).toFixed(1)}M`;
|
|
if (count >= 1_000) return `${(count / 1_000).toFixed(1)}K`;
|
|
return String(count);
|
|
}
|