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 npmGlobalBin = path.join(os.homedir(), '.npm-global', 'bin');
const currentPath = cleanEnv.PATH || '/usr/local/bin:/usr/bin:/bin'; const currentPath = cleanEnv.PATH || '/usr/local/bin:/usr/bin:/bin';
const extraPaths = [nodeBin, npmGlobalBin].filter( const extraPaths = [nodeBin, npmGlobalBin].filter(
(candidate) => (candidate) => !currentPath.includes(candidate) && fs.existsSync(candidate),
!currentPath.includes(candidate) && fs.existsSync(candidate),
); );
return { return {

View File

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

View File

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

View File

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