Skip to content

Commit 8623391

Browse files
authored
refactor(status): remove redundant report section wrappers (#117777)
1 parent 564c6de commit 8623391

3 files changed

Lines changed: 77 additions & 265 deletions

File tree

‎src/commands/status-all/report-lines.ts‎

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
55
import { getTerminalTableWidth, renderTable } from "../../../packages/terminal-core/src/table.js";
66
import { isRich, theme } from "../../../packages/terminal-core/src/theme.js";
77
import type { ProgressReporter } from "../../cli/progress.js";
8+
import { buildStatusChannelsTableRows, statusChannelsTableColumns } from "./channels-table.js";
89
import { appendStatusAllDiagnosis } from "./diagnosis.js";
910
import {
10-
buildStatusAgentsSection,
11-
buildStatusChannelDetailsSections,
12-
buildStatusChannelsSection,
13-
buildStatusOverviewSection,
14-
} from "./report-sections.js";
11+
buildStatusAgentTableRows,
12+
buildStatusChannelDetailSections,
13+
statusAgentsTableColumns,
14+
statusOverviewTableColumns,
15+
} from "./report-tables.js";
1516
import { appendStatusReportSections, appendStatusSectionHeading } from "./text-report.js";
1617

1718
type OverviewRow = { Item: string; Value: string };
@@ -75,36 +76,52 @@ export async function buildStatusAllReportLines(params: {
7576
lines,
7677
heading,
7778
sections: [
78-
buildStatusOverviewSection({
79+
{
80+
kind: "table",
81+
title: "Overview",
7982
width: tableWidth,
8083
renderTable,
84+
columns: [...statusOverviewTableColumns],
8185
rows: params.overviewRows,
82-
}),
83-
buildStatusChannelsSection({
86+
},
87+
{
88+
kind: "table",
89+
title: "Channels",
8490
width: tableWidth,
8591
renderTable,
86-
rows: params.channels.rows,
87-
channelIssues: params.channelIssues,
88-
ok,
89-
warn,
90-
muted,
91-
accentDim: theme.accentDim,
92-
formatIssueMessage: (message) => truncateUtf16Safe(message, 90),
93-
}),
94-
...buildStatusChannelDetailsSections({
92+
// The status-all report has more horizontal space than compact status output.
93+
columns: statusChannelsTableColumns.map((column) =>
94+
column.key === "Detail" ? Object.assign({}, column, { minWidth: 28 }) : column,
95+
),
96+
rows: buildStatusChannelsTableRows({
97+
rows: params.channels.rows,
98+
channelIssues: params.channelIssues,
99+
ok,
100+
warn,
101+
muted,
102+
accentDim: theme.accentDim,
103+
formatIssueMessage: (message) => truncateUtf16Safe(message, 90),
104+
}),
105+
},
106+
...buildStatusChannelDetailSections({
95107
details: params.channels.details,
96108
width: tableWidth,
97109
renderTable,
98110
ok,
99111
warn,
100112
}),
101-
buildStatusAgentsSection({
113+
{
114+
kind: "table",
115+
title: "Agents",
102116
width: tableWidth,
103117
renderTable,
104-
agentStatus: params.agentStatus,
105-
ok,
106-
warn,
107-
}),
118+
columns: [...statusAgentsTableColumns],
119+
rows: buildStatusAgentTableRows({
120+
agentStatus: params.agentStatus,
121+
ok,
122+
warn,
123+
}),
124+
},
108125
],
109126
});
110127
appendStatusSectionHeading({

‎src/commands/status-all/report-sections.ts‎

Lines changed: 0 additions & 205 deletions
This file was deleted.

0 commit comments

Comments
 (0)