dsh-skill-mcp-market 0.5.76 → 0.5.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -388,6 +388,7 @@ window.__ModuleLoader__.load({
388
388
  category: cat === 'all' ? '' : cat,
389
389
  page: pageNo,
390
390
  pageSize: (options && options.size) || size,
391
+ sort: sort === 'default' ? 'installCount' : (sort === 'name' ? 'name' : ''),
391
392
  });
392
393
  const rows = d.items || [];
393
394
  if (cacheKey) {
@@ -1296,6 +1297,17 @@ window.__ModuleLoader__.load({
1296
1297
  },
1297
1298
  },
1298
1299
  h('div', { style: { ...S.title, fontSize: 14 } }, `${detail.kind === 'skill' ? '技能' : 'MCP'}:${detail.slug}`),
1300
+ detail.kind === 'mcp' && detail.data && (detail.data.detailSource || detail.data.rating != null || detail.data.installs != null || detail.data.description) ? h('div', { style: { ...S.meta, marginTop: 6, display: 'flex', flexDirection: 'column', gap: 3 } }, [
1301
+ detail.data.description ? h('span', { key: 'desc', style: { fontSize: 12, opacity: 0.85 } }, detail.data.description) : null,
1302
+ h('div', { key: 'chips', style: S.row }, [
1303
+ detail.data.rating != null ? h('span', { key: 'rating', style: S.chip() }, `评分 ${detail.data.rating}`) : null,
1304
+ detail.data.installs != null ? h('span', { key: 'installs', style: S.chip() }, `安装 ${Number(detail.data.installs).toLocaleString()}`) : null,
1305
+ detail.data.category ? h('span', { key: 'cat', style: S.chip() }, detail.data.category) : null,
1306
+ detail.data.detailSource ? h('span', { key: 'src', style: { fontSize: 11, opacity: 0.6 } }, `详情来源:${detail.data.detailSource}`) : null,
1307
+ ]),
1308
+ detail.data.envRequired && detail.data.envRequired.length ? h('span', { key: 'env', style: { fontSize: 11, opacity: 0.7 } }, `需环境变量:${detail.data.envRequired.join(', ')}`) : null,
1309
+ detail.data.homepage ? h('a', { key: 'hp', style: { fontSize: 11, color: 'var(--dsh-accent, #2f6feb)', cursor: 'pointer' }, onClick: () => { try { window.open(detail.data.homepage, '_blank'); } catch {} } }, detail.data.homepage) : null,
1310
+ ]) : null,
1299
1311
  detail.kind === 'skill'
1300
1312
  ? h('div', { style: { marginTop: 12 } },
1301
1313
  h('div', { style: S.row },
package/index.js CHANGED
@@ -25,7 +25,7 @@ import { createMcpManager, missingEnv, normalizeServerName } from "./src/mcp.js"
25
25
  import { REGISTRY_PAGE_SIZE, fallbackCards, registryCatalogueCacheKey, registryDefinitionByName, searchMcpRegistryPage } from "./src/mcp-registry.js";
26
26
  import { createMarketSkillProvider, readSkillBody } from "./src/provider.js";
27
27
  import { makeCache, lookupSkillShRepo, searchSkills, warmMarketCache } from "./src/sources.js";
28
- import { lobehubManifestDefinition, lobehubRegistered, searchLobeHubMarket } from "./src/lobehub-market.js";
28
+ import { lobehubManifestDefinition, lobehubRegistered, searchLobeHubMarket, viewLobeHubMcp } from "./src/lobehub-market.js";
29
29
  import { setUserEnvironmentVariable } from "./src/env.js";
30
30
  import { inspectSessionLog, repairSessionLog } from "./src/session-repair.js";
31
31
  import { autoRepairSessions } from "./src/auto-repair.js";
@@ -1495,8 +1495,16 @@ export async function apply(ctx, config = {}) {
1495
1495
  }
1496
1496
  return updated;
1497
1497
  }
1498
- case "mcp.detail":
1499
- return mcp.detail(body.serverName);
1498
+ case "mcp.detail": {
1499
+ const local = await mcp.detail(body.serverName);
1500
+ if (body.source === "lobehub" || String(body.serverName || "").includes("lobehub")) {
1501
+ try {
1502
+ const view = await viewLobeHubMcp(body.serverName, { cache: marketCache });
1503
+ return { ...local, ...view };
1504
+ } catch { return { ...local, detailSource: "local" }; }
1505
+ }
1506
+ return local;
1507
+ }
1500
1508
  case "mcp.update":
1501
1509
  return mcp.update(body.serverName, body.patch || {});
1502
1510
  case "mcp.search": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-skill-mcp-market",
3
- "version": "0.5.76",
3
+ "version": "0.5.78",
4
4
  "type": "module",
5
5
  "description": "DSH 技能市场与 MCP 连接器市场:浏览实时技能源,一键安装 SKILL.md 技能与 MCP 连接器,装完即刻可用、无需重启。SKILL & MCP marketplace for DeepSeek Harness — browse live sources, install skills and MCP connectors, effective immediately.",
6
6
  "license": "MIT",
@@ -89,6 +89,8 @@ function mapClawHubRows(rows, q, mode, limitOverride) {
89
89
  upstreamUrl: "",
90
90
  installRef: reference,
91
91
  downloads: Number(raw.downloads || raw.metrics?.rolling60DayInstalls || 0) || 0,
92
+ // 面板排序/卡片统一读 item.installs;clawhub 上游叫 downloads,不映射则「按安装数」对 clawhub 也是 0。
93
+ installs: Number(raw.downloads || raw.metrics?.rolling60DayInstalls || 0) || 0,
92
94
  category: raw.category || "",
93
95
  installable: Boolean(reference),
94
96
  // 搜索端点无分页;浏览端点支持 limit。让客户端据此决定「加载更多」是否可用
@@ -278,10 +280,11 @@ export async function searchTrustTools({ query = "", page = 1, pageSize = 24, ca
278
280
  // install: npx -y @lobehub/market-cli skills install <identifier> --dir <path>
279
281
  // The CLI auto-downloads via npx; no pre-install or authentication required.
280
282
  // `view` requires a token and is not used.
281
- export async function searchLobeHubSkills({ query = "", page = 1, pageSize = 24, cache }) {
283
+ export async function searchLobeHubSkills({ query = "", page = 1, pageSize = 24, cache, sort = "" }) {
282
284
  const p = Math.max(1, Number(page) || 1);
283
285
  const size = Math.max(1, Number(pageSize) || 24);
284
- const cacheKey = `lobehub_skills_search:${query.trim()}:${p}:${size}`;
286
+ const sortKey = String(sort || "").trim();
287
+ const cacheKey = `lobehub_skills_search:${query.trim()}:${sortKey}:${p}:${size}`;
285
288
  const cached = cache ? await cache.get(cacheKey, 30 * 60 * 1000) : undefined;
286
289
  if (cached) return { source: "lobehub", ...cached };
287
290
 
@@ -291,6 +294,7 @@ export async function searchLobeHubSkills({ query = "", page = 1, pageSize = 24,
291
294
  const q = String(query || "").trim();
292
295
  const args = ["skills", "search"];
293
296
  if (q) args.push("--q", q);
297
+ if (sort) args.push("--sort", sort);
294
298
  args.push("--page", String(p), "--page-size", String(size), "--output", "json");
295
299
  // First npx run auto-downloads the CLI (~30 s); subsequent runs are cached.
296
300
  // 180 s covers the worst-case cold start without hanging the UI.
@@ -316,6 +320,8 @@ export async function searchLobeHubSkills({ query = "", page = 1, pageSize = 24,
316
320
  category: raw.category || "",
317
321
  tags: [],
318
322
  installCount: Number(raw.installCount || 0),
323
+ // 面板读 item.installs;LobeHub 上游字段叫 installCount,补映射让卡片与「按安装数」排序有数。
324
+ installs: Number(raw.installCount || 0),
319
325
  rating: Number(raw.ratingAverage || 0),
320
326
  installable: Boolean(raw.identifier),
321
327
  note: "通过官方 CLI 安装 LobeHub 技能",
@@ -484,6 +490,7 @@ export async function searchModelScope({ query = "", page = 1, pageSize = 24, ca
484
490
  ref: branch,
485
491
  skillDir,
486
492
  downloads: Number(raw.DownloadCount || 0),
493
+ installs: Number(raw.DownloadCount || 0),
487
494
  tags: Array.isArray(raw.Tags) ? raw.Tags : [],
488
495
  installable: true,
489
496
  modelScopeIdent: ident,
@@ -240,6 +240,52 @@ function definitionFromManifest(manifest, identifier) {
240
240
  }
241
241
 
242
242
  /** Read one plugin manifest (public endpoint) and reduce it to a runnable definition. */
243
+ export async function viewLobeHubMcp(identifier, { cache, timeoutMs = 90000 } = {}) {
244
+ const key = "lobehub_mcp_view:" + String(identifier).toLowerCase();
245
+ if (cache) {
246
+ const hit = await cache.get(key, 30 * 60 * 1000);
247
+ if (hit) return hit;
248
+ }
249
+ try {
250
+ const raw = await runCli(["mcp", "view", identifier, "--output", "json"], timeoutMs);
251
+ const parsed = JSON.parse(raw.slice(raw.indexOf("{")));
252
+ const data = parsed.data || parsed;
253
+ const out = {
254
+ identifier,
255
+ slug: identifier,
256
+ name: data.name || data.identifier || identifier,
257
+ description: data.description || "",
258
+ category: data.category || "",
259
+ rating: data.ratingAverage ?? data.rating ?? null,
260
+ installs: data.installCount ?? null,
261
+ envRequired: Array.isArray(data.envRequired) ? data.envRequired : [],
262
+ envHints: data.envHints || {},
263
+ homepage: data.homepage || data.url || "https://market.lobehub.com/" + encodeURIComponent(identifier),
264
+ owner: data.owner || "",
265
+ detailSource: "lobehub-cli",
266
+ };
267
+ if (cache) await cache.put(key, out);
268
+ return out;
269
+ } catch (error) {
270
+ const fallback = await lobehubManifestDefinition(identifier);
271
+ return {
272
+ identifier,
273
+ slug: identifier,
274
+ name: fallback.title || identifier,
275
+ description: fallback.description || "",
276
+ category: "",
277
+ rating: null,
278
+ installs: null,
279
+ envRequired: fallback.envRequired || [],
280
+ envHints: fallback.envHints || {},
281
+ homepage: "https://market.lobehub.com/" + encodeURIComponent(identifier),
282
+ owner: fallback.owner || "",
283
+ detailSource: "lobehub-manifest",
284
+ note: "CLI view 不可用(" + String((error && error.message) || error).slice(0, 80) + "),已回退到 manifest",
285
+ };
286
+ }
287
+ }
288
+
243
289
  export async function lobehubManifestDefinition(identifier) {
244
290
  // Cards carry the market prefix in their id (`lobehub:<slug>`) while the manifest route
245
291
  // wants the bare slug, so the prefix is stripped here instead of at every call site.
package/src/sources.js CHANGED
@@ -523,7 +523,7 @@ const SOURCE_HANDLERS = {
523
523
  modelscope: searchModelScope,
524
524
  };
525
525
 
526
- export async function searchSkills({ query, source = "all", page = 1, pageSize = 24, cache = fallbackCache }) {
526
+ export async function searchSkills({ query, source = "all", page = 1, pageSize = 24, cache = fallbackCache, sort = "" }) {
527
527
  const wanted = source === "all" ? ALL_SOURCES : [source];
528
528
  const p = Math.max(1, Number(page) || 1);
529
529
  const size = Math.max(1, Math.min(60, Number(pageSize) || 24));
@@ -536,7 +536,7 @@ export async function searchSkills({ query, source = "all", page = 1, pageSize =
536
536
  const handler = SOURCE_HANDLERS[name];
537
537
  if (!handler) continue;
538
538
  try {
539
- const result = await handler({ query, page: p, pageSize: size, cache });
539
+ const result = await handler({ query, page: p, pageSize: size, cache, sort });
540
540
  if (result && result.hint) hints.push(`${name}:${result.hint}`);
541
541
  if (result && Array.isArray(result.items) && result.items.length) items.push(...result.items);
542
542
  total += Number(result && result.total) || 0;