diff --git a/make-index.mjs b/make-index.mjs new file mode 100644 index 0000000..9cae07b --- /dev/null +++ b/make-index.mjs @@ -0,0 +1,105 @@ +// Regenerate the QQ plugin market index (DSH plugin-market index format 1). +// +// The index lists the QQ-dsh bundle and its four components. Each entry's +// install source is the bundle's Gitea repository pinned to the branch HEAD +// commit at generation time, so re-running this after a release is the whole +// maintenance story. The Gitea repos are public, so the branch endpoints are +// read anonymously. Output: ./index.json next to this script. +// +// node make-index.mjs +import { writeFileSync } from 'node:fs' +import { dirname, join } from 'node:path' +import { fileURLToPath } from 'node:url' + +const API = 'https://git.qyhhh.top/api/v1' +const WEB = 'https://git.qyhhh.top/DeepsSeekHarness' + +const PLUGINS = [ + { + name: 'qq-dsh', + repo: 'QQ-dsh', + branch: 'main', + version: '1.3.0', + title: 'QQ-dsh 全家桶', + description: 'QQ 的 DSH 插件全家桶:三省六部工作台、云端记忆 dsh-brain、工作区分组与远程、聊天增强,一次装齐。', + keywords: ['bundle', 'qq-dsh', '全家桶'], + }, + { + name: 'dsh-sansheng-liubu-mode', + repo: 'dsh-sansheng-liubu', + branch: 'master', + version: '0.12.1', + title: '三省六部工作台', + description: '十个独立部门会话的派发、审批与三层记忆(部门 / 项目 / 长期),原生 DSH 工作台。', + keywords: ['workbench', 'sansheng', '三省六部'], + }, + { + name: 'dsh-brain', + repo: 'dsh-brain', + branch: 'main', + version: '0.9.0', + title: 'dsh-brain · 云端记忆', + description: '把 DSH 接到自托管的 LongMemory:Mnemon 供应方、技能双向同步、从其他软件导入技能。', + keywords: ['memory', 'longmemory', 'mnemon', 'skills'], + }, + { + name: 'workspace-groups-remote', + repo: 'workspace-groups-remote', + branch: 'main', + version: '1.0.0', + title: '工作区分组与远程', + description: '多文件夹分组与远程 SSH 工作区:镜像、终端直连与重复目录防护。', + keywords: ['workspace', 'ssh', 'remote', 'groups'], + }, + { + name: 'dsh-better-chat', + repo: 'dsh-better-chat', + branch: 'main', + version: '0.2.0', + title: 'dsh-better-chat · 聊天增强', + description: '审批卡回车确认 / Esc 拒绝;默认自动审查,并从界面移除「完全权限」选项。', + keywords: ['chat', 'approval', 'permission'], + }, +] + +async function headOf(repo, branch) { + const response = await fetch(`${API}/repos/DeepsSeekHarness/${repo}/branches/${branch}`) + if (!response.ok) throw new Error(`branch lookup failed for ${repo}/${branch}: HTTP ${response.status}`) + const body = await response.json() + return { commit: body.commit.id, timestamp: Math.floor(Date.parse(body.commit.timestamp) / 1000) } +} + +const plugins = [] +for (const plugin of PLUGINS) { + const head = await headOf(plugin.repo, plugin.branch) + plugins.push({ + name: plugin.name, + title: plugin.title, + description: plugin.description, + author: 'newbie', + homepage: `${WEB}/${plugin.repo}`, + repository: { url: `${WEB}/${plugin.repo}` }, + metadata: { keywords: plugin.keywords, labels: [], sortKeys: {} }, + versions: [ + { + version: plugin.version, + publishTimestamp: head.timestamp, + source: { type: 'git', url: `${WEB}/${plugin.repo}`, commit: head.commit }, + engines: {}, + }, + ], + }) + console.log(`${plugin.name} ${plugin.version} @ ${head.commit.slice(0, 8)}`) +} + +const index = { + format: 1, + title: 'QQ 插件索引', + description: 'newbie 的 DSH 插件索引:QQ-dsh 全家桶及其四个组件,源码托管在 git.qyhhh.top 的 DeepsSeekHarness 组织。', + metadata: { categories: {}, labels: {}, sortKeys: {} }, + plugins, +} + +const out = join(dirname(fileURLToPath(import.meta.url)), 'index.json') +writeFileSync(out, `${JSON.stringify(index, null, 2)}\n`, 'utf8') +console.log(`wrote ${out}`)