Skip to content

Commit 39f9256

Browse files
Merge pull request #106 from modelstudioai/fix/windows-stdin
fix(text): support piped messages on Windows
2 parents 88fcda6 + 8b91b9f commit 39f9256

11 files changed

Lines changed: 24 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
66

77
[中文版](CHANGELOG.zh.md) · [README](README.md) · [Contributing](CONTRIBUTING.md)
88

9+
## [1.8.3] - 2026-07-16
10+
11+
### Fixed
12+
13+
- Fixed `bl text chat --messages-file -` failing on Windows by treating standard input as a `/dev/stdin` file path; piped JSON messages are now read from standard input correctly. (#103)
14+
915
## [1.8.2] - 2026-07-15
1016

1117
### Changed

CHANGELOG.zh.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
[English](CHANGELOG.md) · [README](README.zh.md) · [参与贡献](CONTRIBUTING.zh.md)
88

9+
## [1.8.3] - 2026-07-16
10+
11+
### 修复
12+
13+
- 修复 Windows 上 `bl text chat --messages-file -` 将标准输入当作 `/dev/stdin` 文件路径读取的问题;通过管道传入的 JSON 消息现在可以从标准输入正常读取。(#103
14+
915
## [1.8.2] - 2026-07-15
1016

1117
### 变更

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-cli",
3-
"version": "1.8.2",
3+
"version": "1.8.3",
44
"description": "CLI for Aliyun Model Studio (DashScope) AI Platform.",
55
"keywords": [
66
"agent",

packages/commands/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-cli-commands",
3-
"version": "1.8.2",
3+
"version": "1.8.3",
44
"description": "Command library for bailian-cli products (knowledge, memory, media, …). See https://www.npmjs.com/package/bailian-cli for usage.",
55
"homepage": "https://bailian.console.aliyun.com/cli",
66
"bugs": {

packages/commands/src/commands/text/chat.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
chatPath,
44
parseSSE,
55
detectOutputFormat,
6+
readTextFromPathOrStdin,
67
type ChatMessage,
78
type ChatRequest,
89
type ChatResponse,
@@ -69,9 +70,7 @@ function parseMessages(flags: ChatFlags): ParsedMessages {
6970
}
7071

7172
if (flags.messagesFile) {
72-
const filePath = flags.messagesFile;
73-
const raw =
74-
filePath === "-" ? readFileSync("/dev/stdin", "utf-8") : readFileSync(filePath, "utf-8");
73+
const raw = readTextFromPathOrStdin(flags.messagesFile);
7574
const parsed = JSON.parse(raw) as Array<{ role: string; content: string }>;
7675
for (const m of parsed) {
7776
if (m.role === "system") {

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-cli-core",
3-
"version": "1.8.2",
3+
"version": "1.8.3",
44
"description": "Core SDK for bailian-cli. See https://www.npmjs.com/package/bailian-cli for usage.",
55
"homepage": "https://bailian.console.aliyun.com/cli",
66
"bugs": {

packages/core/src/utils/fs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { readFileSync } from "fs";
22

3+
const STDIN_FILE_DESCRIPTOR = 0;
4+
35
export function readTextFromPathOrStdin(path: string): string {
4-
return readFileSync(path === "-" ? "/dev/stdin" : path, "utf-8");
6+
return readFileSync(path === "-" ? STDIN_FILE_DESCRIPTOR : path, "utf-8");
57
}

packages/core/src/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export { generateFilename } from "./filename.ts";
22
export { resolveOutputDir } from "./output-dir.ts";
33
export { maskToken } from "./token.ts";
44
export { stripUndefined } from "./object.ts";
5+
export { readTextFromPathOrStdin } from "./fs.ts";
56
export {
67
parseBooleanValue,
78
parseOptionalBooleanValue,

packages/kscli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "knowledge-studio-cli",
3-
"version": "1.8.2",
3+
"version": "1.8.3",
44
"description": "Lightweight RAG CLI for Aliyun Model Studio — focused on knowledge-base retrieval.",
55
"keywords": [
66
"alibaba-cloud",

packages/runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bailian-cli-runtime",
3-
"version": "1.8.2",
3+
"version": "1.8.3",
44
"description": "Runtime framework for bailian-cli (createCli, registry, args, output, pipeline). See https://www.npmjs.com/package/bailian-cli for usage.",
55
"homepage": "https://bailian.console.aliyun.com/cli",
66
"bugs": {

0 commit comments

Comments
 (0)