chore(cli): drop scene from the package

This commit is contained in:
若麒
2026-05-28 18:48:58 +08:00
parent 1533e2013e
commit 896eee64c5
2 changed files with 37 additions and 50 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ git diff --name-only <base>...<head>
- [README.md](README.md) + [README_CN.md](README_CN.md)(中英文都要,常漏 `_CN`)
- (SKILL.md 已迁出本仓库,由 `npx add skills` 机制独立维护,不在本仓库 review 范围)
- [ ] **`bl <cmd> --help`** 文案完整:`description` / `examples` / `apiDocs` 都填了
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例(参考 [packages/cli/scene/](packages/cli/scene/) 的组织方式)
- [ ] **demo / quickstart**:用户可调用的新命令至少有一个示例
- [ ] **行为变化的老命令**:在 commit message / CHANGELOG 注明用户感知的差异
- [ ] **错误信息 / 提示文案**:面向用户的字符串通顺、双语(项目主体是中文场景)
+36 -49
View File
@@ -2,39 +2,41 @@ import { afterAll, beforeAll, describe, expect, test } from "vite-plus/test";
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { cliPackageRoot, parseStdoutJson, runCli } from "./helpers.ts";
const DEMO_WORKFLOWS = [
"chat-basic.json",
"chained-text.json",
"chained-text.yaml",
"image-generate.json",
"image-gen/image-gen-workflow.json",
"image-to-video.json",
"image2video/lego/lego-build-sequence.json",
"image2video/nine-grid-storyboard.json",
"image2video/virtual-tryon/virtual-tryon-workflow.json",
"logic-nodes.json",
"commerce/amazon-listing/amazon-listing-workflow.json",
"commerce/audio-meeting-summary/workflow.json",
"commerce/cool-background/cool-background-workflow.json",
"commerce/dress-on-model/dress-on-model-workflow.json",
"commerce/flatlay/flatlay-workflow.json",
"commerce/poster-i18n/poster-i18n-workflow.json",
"commerce/scatter-flatlay/scatter-flatlay-workflow.json",
"commerce/six-view-product/six-view-workflow.json",
"commerce/valentine-marketing/valentine-marketing-workflow.json",
];
import { parseStdoutJson, runCli } from "./helpers.ts";
describe("e2e: pipeline", () => {
let tempDir: string;
let chatBasicPath: string;
let invalidPipelinePath: string;
const sceneRoot = join(cliPackageRoot, "scene");
const scenePipelinePath = join(sceneRoot, "chat-basic.json");
beforeAll(async () => {
tempDir = await mkdtemp(join(tmpdir(), "bailian-cli-pipeline-"));
chatBasicPath = join(tempDir, "chat-basic.json");
await writeFile(
chatBasicPath,
JSON.stringify({
version: "workflow/v1",
inputs: {
type: "object",
properties: {
message: { type: "string", default: "Hello from the demo pipeline." },
},
additionalProperties: false,
},
steps: [
{
id: "chat",
type: "text/chat",
input: {
message: { $input: "/message" },
system: "You are a concise assistant for pipeline demos.",
temperature: 0.2,
},
},
],
}),
);
invalidPipelinePath = join(tempDir, "invalid-dependency-pipeline.json");
await writeFile(
invalidPipelinePath,
@@ -83,11 +85,11 @@ describe("e2e: pipeline", () => {
expect(stderr).toMatch(/pipeline validate|workflow\.json|output json/i);
});
test("pipeline validate --output json 校验 scene workflow", async () => {
test("pipeline validate --output json 校验合法 workflow", async () => {
const { stdout, stderr, exitCode } = await runCli([
"pipeline",
"validate",
scenePipelinePath,
chatBasicPath,
"--output",
"json",
]);
@@ -98,28 +100,13 @@ describe("e2e: pipeline", () => {
});
test("pipeline validate 使用 config 输出格式", async () => {
const { stdout, stderr, exitCode } = await runCli(["pipeline", "validate", scenePipelinePath], {
const { stdout, stderr, exitCode } = await runCli(["pipeline", "validate", chatBasicPath], {
DASHSCOPE_OUTPUT: "text",
});
expect(exitCode, stderr).toBe(0);
expect(stdout).toBe("Pipeline definition is valid.\n");
});
test("pipeline validate --output json 校验迁移后的全部 scene workflows", async () => {
for (const workflow of DEMO_WORKFLOWS) {
const { stdout, stderr, exitCode } = await runCli([
"pipeline",
"validate",
join(sceneRoot, workflow),
"--output",
"json",
]);
expect(exitCode, `${workflow}\n${stderr}`).toBe(0);
const data = parseStdoutJson<{ valid?: boolean; issues?: string[] }>(stdout);
expect(data, workflow).toEqual({ valid: true, issues: [] });
}
});
test("pipeline validate 拒绝非法依赖 workflow", async () => {
const { stdout, stderr, exitCode } = await runCli([
"pipeline",
@@ -145,7 +132,7 @@ describe("e2e: pipeline", () => {
const { stdout, stderr, exitCode } = await runCli([
"pipeline",
"run",
scenePipelinePath,
chatBasicPath,
"--input",
'{"message":"hello"}',
"--dry-run",
@@ -179,7 +166,7 @@ describe("e2e: pipeline", () => {
[
"pipeline",
"run",
scenePipelinePath,
chatBasicPath,
"--input",
'{"message":"hello"}',
"--dry-run",
@@ -196,7 +183,7 @@ describe("e2e: pipeline", () => {
const { stderr, exitCode } = await runCli([
"pipeline",
"run",
scenePipelinePath,
chatBasicPath,
"--input",
'{"message":"hello"}',
"--dry-run",
@@ -212,7 +199,7 @@ describe("e2e: pipeline", () => {
const { stdout, stderr, exitCode } = await runCli([
"pipeline",
"run",
scenePipelinePath,
chatBasicPath,
"--input",
'{"message":"hello"}',
"--dry-run",
@@ -240,7 +227,7 @@ describe("e2e: pipeline", () => {
const { stdout, stderr, exitCode } = await runCli([
"pipeline",
"run",
scenePipelinePath,
chatBasicPath,
"--dry-run",
"--events",
"bogus",