diff --git a/packages/commands/src/commands/knowledge/file-get.ts b/packages/commands/src/commands/knowledge/file-get.ts index d52a05f..3ff414f 100644 --- a/packages/commands/src/commands/knowledge/file-get.ts +++ b/packages/commands/src/commands/knowledge/file-get.ts @@ -45,8 +45,12 @@ export default defineCommand({ }); const file = response.data; - if (settings.quiet || format !== "text") { - emitResult(response, format === "text" ? "json" : format); + if (settings.quiet) { + emitBare(file?.fileId ?? ""); + return; + } + if (format !== "text") { + emitResult(response, format); return; } emitBare(`id: ${file?.fileId ?? "-"}`); diff --git a/packages/commands/src/commands/knowledge/kb-info.ts b/packages/commands/src/commands/knowledge/kb-info.ts index 81fc5c4..e7ae801 100644 --- a/packages/commands/src/commands/knowledge/kb-info.ts +++ b/packages/commands/src/commands/knowledge/kb-info.ts @@ -92,8 +92,12 @@ export default defineCommand({ const row = await fetchIndexDetail(ctx.client, workspaceId, flags.indexId); - if (settings.quiet || format !== "text") { - emitResult(row, format === "text" ? "json" : format); + if (settings.quiet) { + emitBare(row.id ?? ""); + return; + } + if (format !== "text") { + emitResult(row, format); return; } diff --git a/packages/commands/src/commands/knowledge/kb-stats.ts b/packages/commands/src/commands/knowledge/kb-stats.ts index 45f7a8f..aa238c6 100644 --- a/packages/commands/src/commands/knowledge/kb-stats.ts +++ b/packages/commands/src/commands/knowledge/kb-stats.ts @@ -102,8 +102,8 @@ export default defineCommand({ body, }); - if (settings.quiet || format !== "text") { - emitResult(response, format === "text" ? "json" : format); + if (format !== "text") { + emitResult(response, format); return; } if (clampedEnd) { diff --git a/packages/commands/src/commands/knowledge/service-get.ts b/packages/commands/src/commands/knowledge/service-get.ts index 93e8c52..f885424 100644 --- a/packages/commands/src/commands/knowledge/service-get.ts +++ b/packages/commands/src/commands/knowledge/service-get.ts @@ -77,8 +77,12 @@ export default defineCommand({ }); const data = response.data; - if (settings.quiet || format !== "text") { - emitResult(response, format === "text" ? "json" : format); + if (settings.quiet) { + emitBare(data?.agent_id ?? ""); + return; + } + if (format !== "text") { + emitResult(response, format); return; } emitBare("Basic:");