mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-15 09:11:18 +00:00
Some checks failed
Deploy Docs / build (push) Has been cancelled
Security / Dependency Review (push) Has been cancelled
Security / CodeQL (java-kotlin) (push) Has been cancelled
Security / CodeQL (javascript-typescript) (push) Has been cancelled
Security / CodeQL (python) (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
Add the native SkillHub plugin for DeepSeek Harness with a scoped skill center, conversation search/install tools, exact-version installation and protected lifecycle management. Prepare the independently versioned 0.1.0 npm candidate with an empty default Registry and documented compatibility limits. Keep formal specifications and executable regression tests; remove archived development screenshots and runtime reports from the final tree. Review fixes cover independent scopes, installed references, pre-staging recovery and idempotent discovery. Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
23 lines
1.7 KiB
TypeScript
23 lines
1.7 KiB
TypeScript
import { readFileSync, appendFileSync } from 'node:fs';
|
|
import { pathToFileURL } from 'node:url';
|
|
import { resolve } from 'node:path';
|
|
|
|
export function releasePolicy(pkg: { name: unknown; version: unknown; private?: unknown }, tag: string | undefined, publish: boolean) {
|
|
const number = '(?:0|[1-9][0-9]*)';
|
|
const versionPattern = new RegExp(`^${number}\\.${number}\\.${number}(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?$`);
|
|
const match = typeof pkg.version === 'string' && versionPattern.exec(pkg.version);
|
|
if (!match || match[0] !== pkg.version || match[1]?.split('.').some(part => /^0[0-9]+$/.test(part))) throw new Error('Invalid release version');
|
|
if (tag !== `dsh-v${pkg.version}`) throw new Error('Tag must exactly match the plugin version');
|
|
if (pkg.name !== '@astron-team/skillhub-dsh') throw new Error('Unexpected DSH package name');
|
|
if (publish && pkg.private !== false) throw new Error('Release package must explicitly set private: false');
|
|
return { version: pkg.version, package_name: pkg.name, dist_tag: match[1] ? 'next' : 'latest' };
|
|
}
|
|
|
|
if (process.argv[1] && pathToFileURL(resolve(process.argv[1])).href === import.meta.url) {
|
|
const manifest = process.argv[2] ? resolve(process.argv[2]) : new URL('../package.json', import.meta.url);
|
|
const pkg = JSON.parse(readFileSync(manifest, 'utf8'));
|
|
if (process.env.GITHUB_REF_TYPE !== 'tag') throw new Error('Run this workflow on the release tag');
|
|
const result = releasePolicy(pkg, process.env.RELEASE_TAG, process.env.PUBLISH === 'true');
|
|
if (!process.env.GITHUB_OUTPUT) throw new Error('Missing workflow output file');
|
|
appendFileSync(process.env.GITHUB_OUTPUT, Object.entries(result).map(([key, value]) => `${key}=${value}\n`).join(''));
|
|
}
|