From 4ea73ef322b042aa2399bed3d414931da4471ea5 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Wed, 18 Nov 2026 14:58:01 +0800 Subject: [PATCH] chore: optimize platform records error response and hose-use skill guidelines --- src/cli/commands/platform/records.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/cli/commands/platform/records.ts b/src/cli/commands/platform/records.ts index 2c54251..54c1d94 100644 --- a/src/cli/commands/platform/records.ts +++ b/src/cli/commands/platform/records.ts @@ -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 流式导出;大范围检索建议交给脚本处理。" - ); + const message = + "--all 不再直接返回全量 JSON/表格。请使用 --page/--count 分页查询,或使用 --ndjson --output-file 流式导出;大范围检索建议交给脚本处理。"; + 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=" }, + ], + }), + stderr: "", + exitCode: 2, + }; + } + throw usageError(message); } }