chore: optimize platform records error response and hose-use skill guidelines

This commit is contained in:
gitea committed 2026-11-18 15:25:33 +08:00
1 parent edafe8d086
commit 4ea73ef322
1 file changed
+18 -3
+18 -3
View File
@@ -63,9 +63,24 @@ export async function handleRecords(parsed: CliParsedArgs, runtime: CliRuntime):
// 全量 JSON/表格很容易把几十万条记录倒进 stdout 或内存;全量导出必须显式走文件流。
if (isAll && !isProfileStats && !sumOption) {
if (!isStream || !runtime.outputOptions?.outputFile) {
throw usageError(
"--all 不再直接返回全量 JSON/表格。请使用 --page/--count 分页查询,或使用 --ndjson --output-file <path> 流式导出;大范围检索建议交给脚本处理。"
);
const message =
"--all 不再直接返回全量 JSON/表格。请使用 --page/--count 分页查询,或使用 --ndjson --output-file <path> 流式导出;大范围检索建议交给脚本处理。";
if (runtime.jsonMode) {
return {
stdout: JSON.stringify({
error: true,
code: "DATASET_TOO_LARGE",
message: message,
suggestions: [
{ type: "paginate", command: "--page=1 --pageSize=500" },
{ type: "stream_export", command: "--ndjson --output-file=<path>" },
],
}),
stderr: "",
exitCode: 2,
};
}
throw usageError(message);
}
}