dshbase-catalog 0.1.0 → 0.2.0

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/dist/index.js CHANGED
@@ -3,50 +3,136 @@ import catalog from './catalog.json' with { type: 'json' };
3
3
  export const name = 'dshbase-catalog';
4
4
  export const inject = ['tools'];
5
5
  const plugins = catalog.plugins || [];
6
+ const CATEGORIES = ['UI Enhancements', 'Sessions & Messages', 'Tools & Capabilities', 'Workflow & Automation', 'Notifications & Integrations', 'Development & Runtime', 'Just for Fun'];
6
7
  function text(v) {
7
8
  return [{ type: 'text', text: v }];
8
9
  }
10
+ // 按星数降序排好的副本
11
+ const byStars = [...plugins].sort((a, b) => (b.stars || 0) - (a.stars || 0));
12
+ // 按收录时间降序(新收录在前)
13
+ const byNew = [...plugins].sort((a, b) => (b.added || '').localeCompare(a.added || ''));
14
+ function fmtHit(p, i) {
15
+ const idx = i !== undefined ? `${i + 1}. ` : '';
16
+ const star = `★${p.stars || 0}`;
17
+ const status = p.test === 'verified' ? '已验证' : p.test === 'broken' ? '异常' : '待验证';
18
+ return `${idx}${p.name} [${status}] ${star}\n ${p.desc}\n Install: ${p.install}`;
19
+ }
9
20
  export function apply(ctx) {
21
+ // 1. 搜索插件
10
22
  ctx.tools.register(defineTool({
11
23
  name: 'search_dsh_plugins',
12
- description: 'Search the dshbase plugin directory for DeepSeek Harness plugins. Pass a keyword to match against plugin name, category, or description. Returns matching plugins with their install command and test status.',
24
+ description: 'Search the dshbase plugin directory for DeepSeek Harness plugins by keyword. Matches against plugin name, category, or description (English & Chinese). Returns each hit with its install command and verification status so you can install it directly.',
13
25
  parameters: {
14
- query: { type: 'string', required: true, description: 'Keyword to search (e.g. "memory", "terminal", "ui")' },
26
+ query: { type: 'string', required: true, description: 'Keyword (e.g. "memory", "terminal", "视觉", "浏览器")' },
15
27
  limit: { type: 'string', description: 'Max results (default 10)' },
16
28
  },
17
- output: {
18
- schema: { type: 'string' },
19
- render: (_a, v) => text(v),
20
- },
29
+ output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
21
30
  async execute(args) {
22
31
  const q = (args.query || '').toLowerCase();
23
32
  const lim = parseInt(args.limit || '10', 10) || 10;
24
33
  const hits = plugins.filter((p) => !q ||
25
- (p.name || '').toLowerCase().includes(q) ||
26
- (p.category || '').toLowerCase().includes(q) ||
27
- (p.desc || '').toLowerCase().includes(q) ||
28
- (p.desc_zh || '').toLowerCase().includes(q)).slice(0, lim);
34
+ p.name.toLowerCase().includes(q) ||
35
+ p.category.toLowerCase().includes(q) ||
36
+ p.desc.toLowerCase().includes(q) ||
37
+ p.desc_zh.toLowerCase().includes(q)).slice(0, lim);
29
38
  if (!hits.length)
30
39
  return `No plugins matched "${args.query}". Try a broader keyword.`;
31
- const lines = hits.map((p, i) => `${i + 1}. ${p.name} [${p.test}] ★${p.stars || 0}\n ${p.desc}\n Install: ${p.install}`);
32
- return `Found ${hits.length} plugins (of ${plugins.length} total):\n\n${lines.join('\n\n')}`;
40
+ return `Found ${hits.length} plugins (of ${plugins.length} on dshbase):\n\n${hits.map((p, i) => fmtHit(p, i)).join('\n\n')}`;
33
41
  },
34
42
  }));
43
+ // 2. 插件详情 + 安装命令
35
44
  ctx.tools.register(defineTool({
36
45
  name: 'get_dsh_plugin',
37
- description: 'Get details and the exact install command for a specific DeepSeek Harness plugin from the dshbase directory.',
46
+ description: 'Get details, verification status, and the exact install command for a specific DeepSeek Harness plugin from the dshbase directory.',
38
47
  parameters: {
39
48
  name: { type: 'string', required: true, description: 'Plugin name (e.g. "dsh-memory")' },
40
49
  },
41
- output: {
42
- schema: { type: 'string' },
43
- render: (_a, v) => text(v),
44
- },
50
+ output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
45
51
  async execute(args) {
46
52
  const p = plugins.find((x) => x.name === args.name);
47
53
  if (!p)
48
54
  return `Plugin "${args.name}" not found. Use search_dsh_plugins to find it.`;
49
- return `${p.name} (${p.category})\nStatus: ${p.test} · Stars: ${p.stars || 0}\n${p.desc}\n\nInstall:\n ${p.install}\n\nMore: ${p.url}`;
55
+ const status = p.test === 'verified' ? '✅ 已验证 (verified)' : p.test === 'broken' ? '❌ 异常 (broken)' : '⏳ 待验证 (pending)';
56
+ const src = p.npm ? `npm (${p.pkg})` : 'GitHub source';
57
+ return [
58
+ `${p.name} (${p.category})`,
59
+ `Status: ${status} · ★${p.stars || 0} · ${src}`,
60
+ '',
61
+ p.desc,
62
+ p.desc_zh ? `中文: ${p.desc_zh}` : '',
63
+ '',
64
+ 'Install:',
65
+ ` ${p.install}`,
66
+ '',
67
+ `More: ${p.url}`,
68
+ ].filter((l) => l !== '').join('\n');
69
+ },
70
+ }));
71
+ // 3. 列出插件(热门 / 新收录 / 分类)
72
+ ctx.tools.register(defineTool({
73
+ name: 'list_dsh_plugins',
74
+ description: 'List DeepSeek Harness plugins from dshbase. Use sort="hot" for most-starred, sort="new" for recently added, or pass a category to list plugins in that category.',
75
+ parameters: {
76
+ category: { type: 'string', description: 'Category name (e.g. "Tools & Capabilities"). Omit for all categories.' },
77
+ sort: { type: 'string', description: 'Sort: "hot" (by stars, default) or "new" (recently added)' },
78
+ limit: { type: 'string', description: 'Max results (default 20)' },
79
+ },
80
+ output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
81
+ async execute(args) {
82
+ const lim = parseInt(args.limit || '20', 10) || 20;
83
+ let pool = args.sort === 'new' ? byNew : byStars;
84
+ if (args.category) {
85
+ const cat = String(args.category);
86
+ pool = pool.filter((p) => p.category === cat || p.category.toLowerCase().includes(cat.toLowerCase()));
87
+ }
88
+ const hits = pool.slice(0, lim);
89
+ if (!hits.length)
90
+ return `No plugins found${args.category ? ` in category "${args.category}"` : ''}.`;
91
+ const label = args.sort === 'new' ? 'recently added' : 'most-starred';
92
+ return `Top ${hits.length} ${label} plugins${args.category ? ` in "${args.category}"` : ''}:\n\n${hits.map((p, i) => fmtHit(p, i)).join('\n\n')}`;
93
+ },
94
+ }));
95
+ // 4. 站点统计
96
+ ctx.tools.register(defineTool({
97
+ name: 'get_dsh_stats',
98
+ description: 'Get live stats of the dshbase plugin directory: total plugins, verification status counts, and category distribution.',
99
+ parameters: {},
100
+ output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
101
+ async execute() {
102
+ const total = plugins.length;
103
+ const verified = plugins.filter((p) => p.test === 'verified').length;
104
+ const pending = plugins.filter((p) => p.test === 'pending').length;
105
+ const broken = plugins.filter((p) => p.test === 'broken').length;
106
+ const npmCount = plugins.filter((p) => p.npm).length;
107
+ const catLines = CATEGORIES.map((c) => {
108
+ const n = plugins.filter((p) => p.category === c).length;
109
+ return ` ${c}: ${n}`;
110
+ }).join('\n');
111
+ return [
112
+ 'dshbase plugin directory stats:',
113
+ ` Total: ${total}`,
114
+ ` ✅ Verified: ${verified}`,
115
+ ` ⏳ Pending: ${pending}`,
116
+ ` ❌ Broken: ${broken}`,
117
+ ` On npm: ${npmCount} · GitHub source: ${total - npmCount}`,
118
+ '',
119
+ 'By category:',
120
+ catLines,
121
+ ].join('\n');
122
+ },
123
+ }));
124
+ // 5. 分类列表
125
+ ctx.tools.register(defineTool({
126
+ name: 'get_dsh_categories',
127
+ description: 'List the plugin categories in the dshbase directory with their plugin counts. Use this to discover what categories exist before listing plugins.',
128
+ parameters: {},
129
+ output: { schema: { type: 'string' }, render: (_a, v) => text(v) },
130
+ async execute() {
131
+ const lines = CATEGORIES.map((c) => {
132
+ const n = plugins.filter((p) => p.category === c).length;
133
+ return `${c}: ${n} plugins`;
134
+ });
135
+ return `dshbase categories:\n\n${lines.join('\n')}`;
50
136
  },
51
137
  }));
52
138
  }
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
- {
2
- "name": "dshbase-catalog",
3
- "version": "0.1.0",
4
- "description": "Search the dshbase plugin directory from inside DeepSeek Harness — find plugins by keyword, get install commands and test status.",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist",
10
- "cordis.patch.yml"
11
- ],
12
- "dsh": {
13
- "bundle": {
14
- "patch": "./cordis.patch.yml"
15
- }
16
- },
17
- "license": "MIT",
18
- "keywords": ["dsh-plugin", "deepseek-harness", "plugin-directory", "catalog"],
19
- "dependencies": {
20
- "@deepseek-ai/cordis": "^4.0.1",
21
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.6"
22
- },
23
- "devDependencies": {
24
- "typescript": "^5.0.0"
25
- },
26
- "scripts": {
27
- "build": "tsc"
28
- }
29
- }
1
+ {
2
+ "name": "dshbase-catalog",
3
+ "version": "0.2.0",
4
+ "description": "Query the dshbase plugin directory from inside DeepSeek Harness — search, list, and get install commands for 1100+ plugins.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "cordis.patch.yml"
11
+ ],
12
+ "dsh": {
13
+ "bundle": {
14
+ "patch": "./cordis.patch.yml"
15
+ }
16
+ },
17
+ "license": "MIT",
18
+ "keywords": ["dsh-plugin", "deepseek-harness", "plugin-directory", "catalog"],
19
+ "dependencies": {
20
+ "@deepseek-ai/cordis": "^4.0.1",
21
+ "@deepseek-ai/dsh-tools": "^0.1.0-rc.6"
22
+ },
23
+ "devDependencies": {
24
+ "typescript": "^5.0.0"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc && node -e \"require('fs').copyFileSync('src/catalog.json','dist/catalog.json')\""
28
+ }
29
+ }