From 0fba1ec3cc41c2f5744d8dfc87763d5c3a268ec6 Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Tue, 27 Jan 2026 10:01:48 +0900 Subject: [PATCH] =?UTF-8?q?=E7=B7=8F=E5=AE=9F=E8=A1=8C=E6=99=82=E9=96=93?= =?UTF-8?q?=E3=82=92=E5=87=BA=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/workflowExecution.ts | 34 +++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/commands/workflowExecution.ts b/src/commands/workflowExecution.ts index cfae3fa..b911b34 100644 --- a/src/commands/workflowExecution.ts +++ b/src/commands/workflowExecution.ts @@ -28,6 +28,24 @@ import { selectOption, promptInput } from '../prompt/index.js'; const log = createLogger('workflow'); +/** + * Format elapsed time in human-readable format + */ +function formatElapsedTime(startTime: string, endTime: string): string { + const start = new Date(startTime).getTime(); + const end = new Date(endTime).getTime(); + const elapsedMs = end - start; + const elapsedSec = elapsedMs / 1000; + + if (elapsedSec < 60) { + return `${elapsedSec.toFixed(1)}s`; + } + + const minutes = Math.floor(elapsedSec / 60); + const seconds = Math.floor(elapsedSec % 60); + return `${minutes}m ${seconds}s`; +} + /** Result of workflow execution */ export interface WorkflowExecutionResult { success: boolean; @@ -167,7 +185,13 @@ export async function executeWorkflow( finalizeSessionLog(sessionLog, 'completed'); // Save log to original cwd so user can find it easily const logPath = saveSessionLog(sessionLog, workflowSessionId, cwd); - success(`Workflow completed (${state.iteration} iterations)`); + + const elapsed = sessionLog.endTime + ? formatElapsedTime(sessionLog.startTime, sessionLog.endTime) + : ''; + const elapsedDisplay = elapsed ? `, ${elapsed}` : ''; + + success(`Workflow completed (${state.iteration} iterations${elapsedDisplay})`); info(`Session log: ${logPath}`); notifySuccess('TAKT', `ワークフロー完了 (${state.iteration} iterations)`); }); @@ -182,7 +206,13 @@ export async function executeWorkflow( finalizeSessionLog(sessionLog, 'aborted'); // Save log to original cwd so user can find it easily const logPath = saveSessionLog(sessionLog, workflowSessionId, cwd); - error(`Workflow aborted after ${state.iteration} iterations: ${reason}`); + + const elapsed = sessionLog.endTime + ? formatElapsedTime(sessionLog.startTime, sessionLog.endTime) + : ''; + const elapsedDisplay = elapsed ? ` (${elapsed})` : ''; + + error(`Workflow aborted after ${state.iteration} iterations${elapsedDisplay}: ${reason}`); info(`Session log: ${logPath}`); notifyError('TAKT', `中断: ${reason}`); });