From 3967683049791ebce3c14b29e4ff4950038ff7be Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 07:42:43 +0100 Subject: [PATCH] refactor: trim command helper exports --- src/commands/agents.config.ts | 10 +--------- src/commands/channels/shared.ts | 2 +- src/commands/message-format.ts | 20 +------------------- src/commands/status-all/text-report.ts | 4 ++-- src/commands/tasks-json.ts | 4 ++-- 5 files changed, 7 insertions(+), 33 deletions(-) diff --git a/src/commands/agents.config.ts b/src/commands/agents.config.ts index 5b8f7b76e00..3f968f28347 100644 --- a/src/commands/agents.config.ts +++ b/src/commands/agents.config.ts @@ -5,11 +5,7 @@ import { resolveDefaultAgentId, } from "../agents/agent-scope.js"; import type { AgentIdentityFile } from "../agents/identity-file.js"; -import { - identityHasValues, - loadAgentIdentityFromWorkspace, - parseIdentityMarkdown as parseIdentityMarkdownFile, -} from "../agents/identity-file.js"; +import { identityHasValues, loadAgentIdentityFromWorkspace } from "../agents/identity-file.js"; import { listRouteBindings } from "../config/bindings.js"; import type { IdentityConfig } from "../config/types.base.js"; import type { OpenClawConfig } from "../config/types.openclaw.js"; @@ -53,10 +49,6 @@ function resolveAgentModel(cfg: OpenClawConfig, agentId: string) { return resolvePrimaryStringValue(cfg.agents?.defaults?.model); } -export function parseIdentityMarkdown(content: string): AgentIdentity { - return parseIdentityMarkdownFile(content); -} - export function loadAgentIdentity(workspace: string): AgentIdentity | null { const parsed = loadAgentIdentityFromWorkspace(workspace); if (!parsed) { diff --git a/src/commands/channels/shared.ts b/src/commands/channels/shared.ts index e7427c4eb2f..4b8c50cb08e 100644 --- a/src/commands/channels/shared.ts +++ b/src/commands/channels/shared.ts @@ -37,7 +37,7 @@ export async function requireValidConfig( return effectiveConfig; } -export function formatAccountLabel(params: { accountId: string; name?: string }) { +function formatAccountLabel(params: { accountId: string; name?: string }) { const base = params.accountId || DEFAULT_ACCOUNT_ID; if (params.name?.trim()) { return `${base} (${params.name.trim()})`; diff --git a/src/commands/message-format.ts b/src/commands/message-format.ts index 1c7384f64af..907bf0dda68 100644 --- a/src/commands/message-format.ts +++ b/src/commands/message-format.ts @@ -1,5 +1,5 @@ import { getLoadedChannelPlugin } from "../channels/plugins/index.js"; -import type { ChannelId, ChannelMessageActionName } from "../channels/plugins/types.public.js"; +import type { ChannelId } from "../channels/plugins/types.public.js"; import type { OutboundDeliveryResult } from "../infra/outbound/deliver.js"; import { formatGatewaySummary, formatOutboundDeliverySummary } from "../infra/outbound/format.js"; import type { MessageActionRunResult } from "../infra/outbound/message-action-runner.js"; @@ -33,24 +33,6 @@ function extractMessageId(payload: unknown): string | null { return null; } -export type MessageCliJsonEnvelope = { - action: ChannelMessageActionName; - channel: ChannelId; - dryRun: boolean; - handledBy: "plugin" | "core" | "dry-run"; - payload: unknown; -}; - -export function buildMessageCliJson(result: MessageActionRunResult): MessageCliJsonEnvelope { - return { - action: result.action, - channel: result.channel, - dryRun: result.dryRun, - handledBy: result.handledBy, - payload: result.payload, - }; -} - type FormatOpts = { width: number; }; diff --git a/src/commands/status-all/text-report.ts b/src/commands/status-all/text-report.ts index eaf2b0cde31..5f405a3d95c 100644 --- a/src/commands/status-all/text-report.ts +++ b/src/commands/status-all/text-report.ts @@ -37,7 +37,7 @@ export function appendStatusSectionHeading(params: { params.lines.push(params.heading(params.title)); } -export function appendStatusLinesSection(params: { +function appendStatusLinesSection(params: { lines: string[]; heading: HeadingFn; title: string; @@ -47,7 +47,7 @@ export function appendStatusLinesSection(params: { params.lines.push(...params.body); } -export function appendStatusTableSection>(params: { +function appendStatusTableSection>(params: { lines: string[]; heading: HeadingFn; title: string; diff --git a/src/commands/tasks-json.ts b/src/commands/tasks-json.ts index 991cf173bbf..ca9efd39569 100644 --- a/src/commands/tasks-json.ts +++ b/src/commands/tasks-json.ts @@ -122,7 +122,7 @@ function toSystemAuditFindings(params: { }; } -export function buildTasksListJsonPayload(opts: TasksListJsonArgs) { +function buildTasksListJsonPayload(opts: TasksListJsonArgs) { const runtimeFilter = opts.runtime?.trim(); const statusFilter = opts.status?.trim(); const tasks = listTaskJsonRecords().filter((task) => { @@ -142,7 +142,7 @@ export function buildTasksListJsonPayload(opts: TasksListJsonArgs) { }; } -export function buildTasksAuditJsonPayload(opts: TasksAuditJsonArgs) { +function buildTasksAuditJsonPayload(opts: TasksAuditJsonArgs) { const severityFilter = opts.severity?.trim() as TaskSystemAuditSeverity | undefined; const codeFilter = opts.code?.trim() as TaskSystemAuditCode | undefined; const { allFindings, filteredFindings, taskFindings, summary } = toSystemAuditFindings({