mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
d24104f7dc
包名 @ali/bailian-kb-dsh → bailian-kb-dsh(公开 npm):package.json name + cordis.patch.yml insert.name + tsdown PLUGIN_ID 三处同步(漏一处即 dsh 运行时崩)。 产物 lib/ → dist/(本仓 .gitignore 忽略 dist 不忽略 lib),连带 main/types/ exports/files/tsdown outDir 同步;.gitignore 补 *.tsbuildinfo。 依赖接 catalog(yaml/typescript/@types/node/vite-plus);测试导入 vitest → vite-plus/test(全仓统一约定,消掉唯一的 vitest 依赖漂移)。 tsconfig 拆三件套:tsconfig.json 纯类型检查覆盖 src+tests(供 oxlint 自动发现, 含 jsx/DOM),tsconfig.build.json 产出 node 半,tsconfig.web.json 隔离检查 web 半。 补齐 tests 从未被类型检查暴露的一处 partial 输入类型错误。 根 vite.config.ts 新增两条 override:web 半 no-restricted-imports 把 tsdown 构建期 的 bundle purity gate 提前到 lint 期;全包放开 _ 前缀的 no-unused-vars。 文档:新增 docs/agents/dsh-plugin.md,AGENTS.md 项目地图/版本锁步例外/分层边界/ 场景索引同步,packages.mjs 注释说明故意不进发布白名单。 格式化(单引号无分号 → 双引号加分号)由 pre-commit 的 vp check --fix 自动完成, 无法单独成 commit,一并纳入。 全仓 vp check 0 error;插件 13 文件 85 测试全绿;build + typecheck 通过。
51 lines
2.0 KiB
JavaScript
51 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 .github/workflows/publish-kb-dsh.yml. 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;
|
|
}
|