mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
7bc1c49cb6
复用同一个 Publish workflow 入口(package 下拉多一项 bailian-kb-dsh),路由到 独立的 publish-kb-dsh.mjs 处理: - 版本读自身 package.json(不广播全套 bl 版本) - stable 打 bailian-kb-dsh-v<version> tag(与 bl 的 v<version> 错开命名空间) - channel 临时 bump 到 0.0.0-beta-<sha>-<stamp>(形态与 bl channel 一致), finally 还原 package.json - 走自身的 tsc + tsdown build,无 binary,无 OSS CDN - 复用 lib/git.mjs / lib/npm.mjs / lib/proc.mjs 三个薄工具 - 复用 workflow 入口 UI 与 setup 步骤(checkout / pnpm / node 24 / gitleaks / install),stable 走 environment: production Required Reviewers gate 不复用 publish-stable.mjs / publish-channel.mjs:它们的 loadAndValidatePackages 会广播 core 版本给全套锁步包并强校验一致性,把 kb-dsh 塞进去第一步就 throw。 故意分开是为了保住这个隔离。 本地 --dry-run 端到端跑通:build → 幂等性查重 → pack + publint + gitleaks → pnpm publish --tag latest|<channel> --provenance --dry-run;channel 模式的 finally 还原后 git diff 干净。 文档:dsh-plugin.md 补发布小节 + 已知待办(publint 那条 web bundle CJS/ESM warning);publish.md 加 bailian-kb-dsh 定位;packages.mjs 与 AGENTS.md 的 注释同步指向新的 job 与 script 名。
52 lines
2.0 KiB
JavaScript
52 lines
2.0 KiB
JavaScript
import { readFileSync, writeFileSync } from "fs";
|
|
import { dirname, join, resolve } from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
export const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
|
|
|
|
export const PACKAGES = [
|
|
{ key: "core", dir: "packages/core", name: "bailian-cli-core" },
|
|
{ key: "runtime", dir: "packages/runtime", name: "bailian-cli-runtime" },
|
|
{ key: "commands", dir: "packages/commands", name: "bailian-cli-commands" },
|
|
{ key: "cli", dir: "packages/cli", name: "bailian-cli" },
|
|
];
|
|
|
|
// knowledge-studio-cli shares the same library deps as bailian-cli.
|
|
// Published via publish.yml with package=knowledge-studio-cli (passes --knowledge flag).
|
|
export const KSCLI_PACKAGE = { key: "kscli", dir: "packages/kscli", name: "knowledge-studio-cli" };
|
|
export const ALL_PACKAGES = [...PACKAGES, KSCLI_PACKAGE];
|
|
|
|
// Deliberately absent from every list above: packages/bailian-kb-dsh (bailian-kb-dsh).
|
|
// It is a dsh plugin — a downstream host adapter, not part of the bl release closure:
|
|
// its version tracks the dsh rc cadence instead of the locked core/runtime/commands/cli/kscli
|
|
// version, and it ships through publish.yml's separate `package=bailian-kb-dsh`
|
|
// job (tools/release/publish-kb-dsh.mjs). So it is exempt from
|
|
// loadAndValidatePackages' version-consistency check and from packAndScan. Not an oversight;
|
|
// see docs/agents/dsh-plugin.md before adding it here.
|
|
|
|
export function readJson(path) {
|
|
return JSON.parse(readFileSync(path, "utf-8"));
|
|
}
|
|
|
|
export function packageJsonPath(pkg) {
|
|
return join(ROOT, pkg.dir, "package.json");
|
|
}
|
|
|
|
export function readPackageJson(pkg) {
|
|
return readJson(packageJsonPath(pkg));
|
|
}
|
|
|
|
export function writePackageJson(pkg, json) {
|
|
writeFileSync(packageJsonPath(pkg), `${JSON.stringify(json, null, 2)}\n`);
|
|
}
|
|
|
|
export function tarballFileName(name, version) {
|
|
return `${name.replace(/^@/, "").replace("/", "-")}-${version}.tgz`;
|
|
}
|
|
|
|
export function findPackage(key) {
|
|
const pkg = PACKAGES.find((p) => p.key === key);
|
|
if (!pkg) throw new Error(`unknown package key: ${key}`);
|
|
return pkg;
|
|
}
|