style: format extracted helpers

This commit is contained in:
Eyejoker
2026-03-23 07:00:22 +09:00
parent a2db8f6c0e
commit 867a6a80ef
4 changed files with 18 additions and 20 deletions

View File

@@ -107,8 +107,7 @@ function buildBaseRunnerEnv(args: {
const npmGlobalBin = path.join(os.homedir(), '.npm-global', 'bin');
const currentPath = cleanEnv.PATH || '/usr/local/bin:/usr/bin:/bin';
const extraPaths = [nodeBin, npmGlobalBin].filter(
(candidate) =>
!currentPath.includes(candidate) && fs.existsSync(candidate),
(candidate) => !currentPath.includes(candidate) && fs.existsSync(candidate),
);
return {

View File

@@ -52,10 +52,12 @@ export function buildStatusContent(opts: DashboardOptions): string {
.filter((line): line is DashboardRoomLine => Boolean(line));
return composeDashboardContent([
`**에이전트 상태** (${opts.assistantName}) — 활성 ${totalActive} | 큐대기 ${totalWaiting} | 전체 ${roomLines.length}\n\n${renderCategorizedRoomSections({
lines: roomLines,
showCategoryHeaders: false,
})}`,
`**에이전트 상태** (${opts.assistantName}) — 활성 ${totalActive} | 큐대기 ${totalWaiting} | 전체 ${roomLines.length}\n\n${renderCategorizedRoomSections(
{
lines: roomLines,
showCategoryHeaders: false,
},
)}`,
]);
}

View File

@@ -18,10 +18,7 @@ export interface TaskStatusTrackerTransport {
export interface TaskStatusTracker {
enabled: boolean;
update: (
phase: WatcherStatusPhase,
nextRun?: string | null,
) => Promise<void>;
update: (phase: WatcherStatusPhase, nextRun?: string | null) => Promise<void>;
}
export function createTaskStatusTracker(
@@ -44,10 +41,7 @@ export function createTaskStatusTracker(
});
};
const update = async (
phase: WatcherStatusPhase,
nextRun?: string | null,
) => {
const update = async (phase: WatcherStatusPhase, nextRun?: string | null) => {
if (!enabled) return;
const checkedAt = new Date().toISOString();

View File

@@ -3,10 +3,7 @@ import fs from 'fs';
import os from 'os';
import path from 'path';
import {
STATUS_SHOW_ROOMS,
USAGE_DASHBOARD_ENABLED,
} from './config.js';
import { STATUS_SHOW_ROOMS, USAGE_DASHBOARD_ENABLED } from './config.js';
import {
fetchClaudeUsageViaCli,
type ClaudeUsageData,
@@ -135,7 +132,9 @@ async function refreshChannelMeta(
const channel = opts.channels.find(
(item) =>
item.name.startsWith('discord') && item.isConnected() && item.getChannelMeta,
item.name.startsWith('discord') &&
item.isConnected() &&
item.getChannelMeta,
);
if (!channel?.getChannelMeta) return;
@@ -307,7 +306,11 @@ function buildStatusContent(): string {
rooms.sort((a, b) => (a.meta?.position ?? 999) - (b.meta?.position ?? 999));
for (const room of rooms) {
room.agents.sort((a, b) =>
a.agentType === b.agentType ? 0 : a.agentType === 'claude-code' ? -1 : 1,
a.agentType === b.agentType
? 0
: a.agentType === 'claude-code'
? -1
: 1,
);
const agentParts = room.agents.map((agent) => {
const icon = STATUS_ICONS[agent.status] || '⚪';