diff --git a/README.md b/README.md index 4e9508f..76438e3 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,16 @@ ## 维护 -发新版后重新生成索引(自动读取各仓库分支 HEAD 的提交号与时间): +发布批次统一记录在 `release-manifest.json`(组件版本、固定提交、全家桶版本)。 +`make-index.mjs` 优先从该清单生成索引;清单不存在时才回退到读取各仓库分支 HEAD。 +发版后: ```sh node make-index.mjs +node verify-release.mjs --qq-dsh ../QQ-dsh --sources .. ``` -生成后把 `index.json` 提交到本仓库即可。索引格式由 DSH 自带的 -`@deepseek-ai/dsh-plugin-market-index` 校验器定义。 +`verify-release.mjs` 同时检查独立插件索引与 QQ-dsh 全家桶的版本、固定提交和 +构建产物是否存在,两个安装渠道不一致时直接失败。生成/校验后把 `index.json` +提交到本仓库即可。索引格式由 DSH 自带的 `@deepseek-ai/dsh-plugin-market-index` +校验器定义。 diff --git a/index.json b/index.json index 913d112..2cb2cfd 100644 --- a/index.json +++ b/index.json @@ -29,12 +29,12 @@ }, "versions": [ { - "version": "0.13.3", - "publishTimestamp": 1794469350, + "version": "0.14.0", + "publishTimestamp": 1794480735, "source": { "type": "git", "url": "https://git.qyhhh.top/DeepsSeekHarness/dsh-sansheng-liubu", - "commit": "257c47f78c163fd992518b506af0b10978003792" + "commit": "efc4a32c758d1df9bb3c22bb53f1359e0d433ab1" }, "engines": {} } @@ -62,12 +62,12 @@ }, "versions": [ { - "version": "0.9.0", - "publishTimestamp": 1794446658, + "version": "0.9.1", + "publishTimestamp": 1794480737, "source": { "type": "git", "url": "https://git.qyhhh.top/DeepsSeekHarness/dsh-brain", - "commit": "e12b28cfd247187be695ae691df2429cc9c82973" + "commit": "89af1f4c7c6acf65be93792f68eade383ec0d794" }, "engines": {} } @@ -95,12 +95,12 @@ }, "versions": [ { - "version": "1.0.3", - "publishTimestamp": 1794473231, + "version": "1.1.0", + "publishTimestamp": 1794480736, "source": { "type": "git", "url": "https://git.qyhhh.top/DeepsSeekHarness/workspace-groups-remote", - "commit": "a2acb2905ef4e26fc3e80e20dc9aa6f0715f6b90" + "commit": "fb88fd2d3ed4423817cb6409491f1cbc2bc0f9f6" }, "engines": {} } @@ -110,7 +110,7 @@ "name": "dsh-better-chat", "title": "dsh-better-chat · 聊天增强", "icon": "icons/chat.png", - "description": "审批卡回车确认 / Esc 拒绝;默认自动审查,并从界面移除「完全权限」选项。", + "description": "审批卡回车确认 / Esc 拒绝;权限界面移除「完全权限」,且不再改写已有会话的权限选择。", "author": "newbie", "homepage": "https://git.qyhhh.top/DeepsSeekHarness/dsh-better-chat", "repository": { @@ -127,12 +127,12 @@ }, "versions": [ { - "version": "0.3.0", - "publishTimestamp": 1794456760, + "version": "0.3.1", + "publishTimestamp": 1794480736, "source": { "type": "git", "url": "https://git.qyhhh.top/DeepsSeekHarness/dsh-better-chat", - "commit": "40acdd2b5cc26a5225ef0d7c9c15dfc9b5f4a788" + "commit": "f2f11528bdd8779b247265ca8ba667287af12cd7" }, "engines": {} } diff --git a/make-index.mjs b/make-index.mjs index 6970313..b06ba92 100644 --- a/make-index.mjs +++ b/make-index.mjs @@ -17,12 +17,14 @@ // overwrite); DSH's native update button does not apply to git sources. // // node make-index.mjs -import { writeFileSync } from 'node:fs' +import { existsSync, readFileSync, 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 ROOT = dirname(fileURLToPath(import.meta.url)) +const MANIFEST = join(ROOT, 'release-manifest.json') const PLUGINS = [ { @@ -58,7 +60,7 @@ const PLUGINS = [ repo: 'dsh-better-chat', branch: 'main', title: 'dsh-better-chat · 聊天增强', - description: '审批卡回车确认 / Esc 拒绝;默认自动审查,并从界面移除「完全权限」选项。', + description: '审批卡回车确认 / Esc 拒绝;权限界面移除「完全权限」,且不再改写已有会话的权限选择。', keywords: ['chat', 'approval', 'permission'], }, ] @@ -70,15 +72,35 @@ async function headOf(repo, branch) { return { commit: body.commit.id, timestamp: Math.floor(Date.parse(body.commit.timestamp) / 1000) } } +const release = existsSync(MANIFEST) ? JSON.parse(readFileSync(MANIFEST, 'utf8')) : null +const componentByRepo = new Map() +for (const component of release?.components ?? []) componentByRepo.set(component.repo, component) + const plugins = [] for (const plugin of PLUGINS) { - const head = await headOf(plugin.repo, plugin.branch) - const pkgResponse = await fetch(`${API}/repos/DeepsSeekHarness/${plugin.repo}/contents/package.json?ref=${plugin.branch}`) - if (!pkgResponse.ok) throw new Error(`package.json fetch failed for ${plugin.repo}: HTTP ${pkgResponse.status}`) - const pkgFile = await pkgResponse.json() - const pkg = JSON.parse(Buffer.from(pkgFile.content, 'base64').toString('utf8')) - if (pkg.name !== plugin.name) throw new Error(`name mismatch for ${plugin.repo}: index says ${plugin.name}, package.json says ${pkg.name}`) - const version = pkg.version + let version + let commit + let timestamp + const pinned = componentByRepo.get(plugin.repo) + if (pinned !== undefined) { + // The checked-in release manifest is the source of truth for a published + // batch: version, commit and index entry are generated from the SAME record. + if (pinned.package !== plugin.name) throw new Error(`release manifest package mismatch for ${plugin.repo}: ${pinned.package} vs ${plugin.name}`) + version = pinned.version + commit = pinned.sourceCommit + timestamp = pinned.publishTimestamp ?? Math.floor(Date.now() / 1000) + if (!/^[0-9a-f]{40}$/i.test(commit)) throw new Error(`release manifest has no pinned commit for ${plugin.repo}`) + } else { + const head = await headOf(plugin.repo, plugin.branch) + const pkgResponse = await fetch(`${API}/repos/DeepsSeekHarness/${plugin.repo}/contents/package.json?ref=${plugin.branch}`) + if (!pkgResponse.ok) throw new Error(`package.json fetch failed for ${plugin.repo}: HTTP ${pkgResponse.status}`) + const pkgFile = await pkgResponse.json() + const pkg = JSON.parse(Buffer.from(pkgFile.content, 'base64').toString('utf8')) + if (pkg.name !== plugin.name) throw new Error(`name mismatch for ${plugin.repo}: index says ${plugin.name}, package.json says ${pkg.name}`) + version = pkg.version + commit = head.commit + timestamp = head.timestamp + } plugins.push({ name: plugin.name, title: plugin.title, @@ -91,13 +113,13 @@ for (const plugin of PLUGINS) { versions: [ { version: version, - publishTimestamp: head.timestamp, - source: { type: 'git', url: `${WEB}/${plugin.repo}`, commit: head.commit }, + publishTimestamp: timestamp, + source: { type: 'git', url: `${WEB}/${plugin.repo}`, commit: commit }, engines: {}, }, ], }) - console.log(`${plugin.name} ${version} @ ${head.commit.slice(0, 8)}`) + console.log(`${plugin.name} ${version} @ ${String(commit).slice(0, 8)}${pinned ? ' (release-manifest)' : ' (live)'}`) } const index = { diff --git a/release-manifest.json b/release-manifest.json new file mode 100644 index 0000000..1a905ab --- /dev/null +++ b/release-manifest.json @@ -0,0 +1,50 @@ +{ + "format": 1, + "generatedAt": "2026-11-12T18:53:45+08:00", + "components": [ + { + "id": "dsh-sansheng-liubu", + "package": "dsh-sansheng-liubu-mode", + "version": "0.14.0", + "repo": "dsh-sansheng-liubu", + "branch": "fix/workbench-entry-project-isolation", + "sourceCommit": "efc4a32c758d1df9bb3c22bb53f1359e0d433ab1", + "publishTimestamp": 1794480735 + }, + { + "id": "dsh-brain", + "package": "dsh-brain", + "version": "0.9.1", + "repo": "dsh-brain", + "branch": "fix/skill-sync-source-state", + "sourceCommit": "89af1f4c7c6acf65be93792f68eade383ec0d794", + "publishTimestamp": 1794480737 + }, + { + "id": "workspace-groups-remote", + "package": "workspace-groups-remote", + "version": "1.1.0", + "repo": "workspace-groups-remote", + "branch": "fix/folders-state-display-dedupe", + "sourceCommit": "fb88fd2d3ed4423817cb6409491f1cbc2bc0f9f6", + "publishTimestamp": 1794480736 + }, + { + "id": "dsh-better-chat", + "package": "dsh-better-chat", + "version": "0.3.1", + "repo": "dsh-better-chat", + "branch": "fix/permission-no-overwrite", + "sourceCommit": "f2f11528bdd8779b247265ca8ba667287af12cd7", + "publishTimestamp": 1794480736 + } + ], + "bundle": { + "name": "qq-dsh", + "package": "qq-dsh", + "version": "1.4.0", + "repo": "QQ-dsh", + "branch": "feat/components-0.14", + "sourceCommit": "27a1adfe7746e188d2fc9338e02c047ed46f36d0" + } +} diff --git a/verify-release.mjs b/verify-release.mjs new file mode 100644 index 0000000..0e612a0 --- /dev/null +++ b/verify-release.mjs @@ -0,0 +1,118 @@ +#!/usr/bin/env node +/** + * Verify the release manifest against BOTH install channels: + * - dsh-market-index/index.json (standalone component installs) + * - QQ-dsh/components.json + vendored package.json (bundle installs) + * + * Usage: + * node verify-release.mjs --qq-dsh ../QQ-dsh + * + * This is a static consistency check. It does not build, publish, or modify + * anything; build artifacts are checked for presence only. + */ +import { existsSync, readFileSync } from 'node:fs' +import { dirname, join, resolve } from 'node:path' +import { fileURLToPath } from 'node:url' + +const ROOT = dirname(fileURLToPath(import.meta.url)) +const args = process.argv.slice(2) +const qqAt = args.indexOf('--qq-dsh') +const QQ = resolve(qqAt >= 0 ? args[qqAt + 1] : join(ROOT, '..', 'QQ-dsh')) +const sourcesAt = args.indexOf('--sources') +const SOURCES = sourcesAt >= 0 ? resolve(args[sourcesAt + 1]) : null + +let checks = 0 +let failures = 0 +function check(condition, label) { + checks += 1 + if (condition) console.log(`PASS ${label}`) + else { failures += 1; console.log(`FAIL ${label}`) } +} +function readJson(path) { return JSON.parse(readFileSync(path, 'utf8')) } +function gitHead(dir) { + try { + let head = readFileSync(join(dir, '.git', 'HEAD'), 'utf8').trim() + if (head.startsWith('ref: ')) head = readFileSync(join(dir, '.git', head.slice(5)), 'utf8').trim() + return /^[0-9a-f]{40}$/i.test(head) ? head : null + } catch { + return null + } +} + +const manifestPath = join(ROOT, 'release-manifest.json') +check(existsSync(manifestPath), 'release-manifest.json exists') +if (!existsSync(manifestPath)) process.exit(1) +const manifest = readJson(manifestPath) +const components = Array.isArray(manifest.components) ? manifest.components : [] +check(components.length === 4, `release manifest lists four components (${components.length})`) + +const indexPath = join(ROOT, 'index.json') +check(existsSync(indexPath), 'index.json exists') +if (existsSync(indexPath)) { + const index = readJson(indexPath) + for (const component of components) { + const plugin = (index.plugins ?? []).find((item) => item.name === component.package) + check(plugin !== undefined, `index has ${component.package}`) + if (plugin === undefined) continue + const version = plugin.versions?.[0] + check(version?.version === component.version, `index version ${component.package} = ${component.version}`) + check(version?.source?.commit === component.sourceCommit, `index commit ${component.package} = ${String(component.sourceCommit).slice(0, 8)}…`) + check(version?.source?.url?.endsWith(`/${component.repo}`), `index repo ${component.package} -> ${component.repo}`) + } +} + +const qqPkgPath = join(QQ, 'package.json') +const qqComponentsPath = join(QQ, 'components.json') +check(existsSync(qqPkgPath), `QQ-dsh package.json exists at ${QQ}`) +check(existsSync(qqComponentsPath), 'QQ-dsh components.json exists') +if (existsSync(qqPkgPath) && existsSync(qqComponentsPath)) { + const qqPkg = readJson(qqPkgPath) + const qqComponents = readJson(qqComponentsPath) + const qqHead = gitHead(QQ) + check(qqHead !== null, 'QQ-dsh is a Git checkout with a resolvable HEAD') + if (qqHead !== null && manifest.bundle?.sourceCommit) { + check(qqHead === manifest.bundle.sourceCommit, `QQ-dsh HEAD = ${String(manifest.bundle.sourceCommit).slice(0, 8)}…`) + } + check(qqComponents.length === components.length, `QQ-dsh vendors ${components.length} components`) + check(qqPkg.version === manifest.bundle?.version, `QQ-dsh bundle version = ${manifest.bundle?.version}`) + for (const component of components) { + const vendored = qqComponents.find((item) => item.id === component.id) + check(vendored !== undefined, `QQ-dsh has component ${component.id}`) + if (vendored === undefined) continue + check(vendored.package === component.package, `QQ-dsh package ${component.id} = ${component.package}`) + check(vendored.version === component.version, `QQ-dsh version ${component.id} = ${component.version}`) + check(vendored.sourceCommit === component.sourceCommit, `QQ-dsh commit ${component.id} = ${String(component.sourceCommit).slice(0, 8)}…`) + const vendorPkg = join(QQ, vendored.vendorPath, 'package.json') + check(existsSync(vendorPkg), `QQ-dsh vendored package exists: ${vendored.vendorPath}`) + if (existsSync(vendorPkg)) { + const pkg = readJson(vendorPkg) + check(pkg.name === component.package && pkg.version === component.version, `QQ-dsh vendored ${component.id} version matches`) + } + } + // Optional: verify the source checkouts actually contain the pinned commits + // and declared package versions (run with --sources /path/to/dsh-org-fixes). + if (SOURCES !== null) { + for (const component of components) { + const dir = join(SOURCES, component.repo) + check(existsSync(join(dir, 'package.json')), `source checkout exists: ${component.repo}`) + if (!existsSync(join(dir, 'package.json'))) continue + const pkg = readJson(join(dir, 'package.json')) + check(pkg.name === component.package && pkg.version === component.version, `source package ${component.repo} = ${component.package} ${component.version}`) + check(gitHead(dir) === component.sourceCommit, `source HEAD ${component.repo} = ${String(component.sourceCommit).slice(0, 8)}…`) + } + } + // Build artifacts both channels install must be present. + for (const artifact of [ + join(QQ, 'vendor', 'dsh-sansheng-liubu', 'workbench', 'panel', 'lib', 'client.js'), + join(QQ, 'vendor', 'dsh-brain', 'lib', 'index.js'), + join(QQ, 'vendor', 'dsh-brain', 'client', 'index.js'), + join(QQ, 'vendor', 'workspace-groups-remote', 'lib', 'client.js'), + join(QQ, 'vendor', 'workspace-groups-remote', 'lib', 'remote-ssh', 'index.js'), + join(QQ, 'vendor', 'dsh-better-chat', 'lib', 'client.js'), + ]) { + check(existsSync(artifact), `artifact present: ${artifact.slice(QQ.length + 1)}`) + } +} + +console.log(`\nverify-release: ${checks - failures}/${checks} checks passed`) +process.exit(failures === 0 ? 0 : 1)