-rオプションをOmitし、デフォルトを会話継続に

This commit is contained in:
nrslib 2026-01-27 10:36:11 +09:00
parent 0c6d74af8a
commit 665b5187be
5 changed files with 20 additions and 43 deletions

View File

@ -4,11 +4,10 @@
* TAKT CLI - Task Agent Koordination Tool * TAKT CLI - Task Agent Koordination Tool
* *
* Usage: * Usage:
* takt {task} - Execute task with current workflow (new session) * takt {task} - Execute task with current workflow (continues session)
* takt -r {task} - Execute task, resuming previous session
* takt /run-tasks - Run all pending tasks from .takt/tasks/ * takt /run-tasks - Run all pending tasks from .takt/tasks/
* takt /switch - Switch workflow interactively * takt /switch - Switch workflow interactively
* takt /clear - Clear agent conversation sessions * takt /clear - Clear agent conversation sessions (reset to initial state)
* takt /help - Show help * takt /help - Show help
* takt /config - Select permission mode interactively * takt /config - Select permission mode interactively
*/ */
@ -46,9 +45,7 @@ program
program program
.argument('[task]', 'Task to execute or slash command') .argument('[task]', 'Task to execute or slash command')
.option('-r, --resume', 'Resume previous session (continue agent conversations)') .action(async (task) => {
.action(async (task, options: { resume?: boolean }) => {
const resumeSession = options.resume ?? false;
const cwd = resolve(process.cwd()); const cwd = resolve(process.cwd());
// Initialize global directories first // Initialize global directories first
@ -150,8 +147,8 @@ program
); );
} }
log.info('Starting task execution', { task, workflow: selectedWorkflow, resumeSession }); log.info('Starting task execution', { task, workflow: selectedWorkflow });
const taskSuccess = await executeTask(task, cwd, selectedWorkflow, { resumeSession }); const taskSuccess = await executeTask(task, cwd, selectedWorkflow);
if (!taskSuccess) { if (!taskSuccess) {
process.exit(1); process.exit(1);
} }

View File

@ -13,19 +13,15 @@ export function showHelp(): void {
console.log(` console.log(`
Usage: Usage:
takt {task} Execute task with current workflow (new session) takt {task} Execute task with current workflow (continues session)
takt -r {task} Execute task, resuming previous agent sessions
takt /run-tasks Run all pending tasks from .takt/tasks/ takt /run-tasks Run all pending tasks from .takt/tasks/
takt /switch Switch workflow interactively takt /switch Switch workflow interactively
takt /clear Clear agent conversation sessions takt /clear Clear agent conversation sessions (reset to initial state)
takt /help Show this help takt /help Show this help
Options:
-r, --resume Resume previous session (continue agent conversations)
Examples: Examples:
takt "Fix the bug in main.ts" # Start fresh takt "Fix the bug in main.ts" # Execute task (continues session)
takt -r "Continue the fix" # Resume previous session takt /clear # Clear sessions, start fresh
takt /switch takt /switch
takt /run-tasks takt /run-tasks

View File

@ -3,7 +3,7 @@
*/ */
export { executeWorkflow, type WorkflowExecutionResult, type WorkflowExecutionOptions } from './workflowExecution.js'; export { executeWorkflow, type WorkflowExecutionResult, type WorkflowExecutionOptions } from './workflowExecution.js';
export { executeTask, runAllTasks, type ExecuteTaskOptions } from './taskExecution.js'; export { executeTask, runAllTasks } from './taskExecution.js';
export { showHelp } from './help.js'; export { showHelp } from './help.js';
export { withAgentSession } from './session.js'; export { withAgentSession } from './session.js';
export { switchWorkflow } from './workflow.js'; export { switchWorkflow } from './workflow.js';

View File

@ -18,23 +18,14 @@ import { DEFAULT_WORKFLOW_NAME } from '../constants.js';
const log = createLogger('task'); const log = createLogger('task');
/** Options for task execution */
export interface ExecuteTaskOptions {
/** Resume previous session instead of starting fresh */
resumeSession?: boolean;
}
/** /**
* Execute a single task with workflow * Execute a single task with workflow
*/ */
export async function executeTask( export async function executeTask(
task: string, task: string,
cwd: string, cwd: string,
workflowName: string = DEFAULT_WORKFLOW_NAME, workflowName: string = DEFAULT_WORKFLOW_NAME
options: ExecuteTaskOptions = {}
): Promise<boolean> { ): Promise<boolean> {
const { resumeSession = false } = options;
const workflowConfig = loadWorkflow(workflowName); const workflowConfig = loadWorkflow(workflowName);
if (!workflowConfig) { if (!workflowConfig) {
@ -47,12 +38,9 @@ export async function executeTask(
log.debug('Running workflow', { log.debug('Running workflow', {
name: workflowConfig.name, name: workflowConfig.name,
steps: workflowConfig.steps.map(s => s.name), steps: workflowConfig.steps.map(s => s.name),
resumeSession,
}); });
const result = await executeWorkflow(workflowConfig, task, cwd, { const result = await executeWorkflow(workflowConfig, task, cwd);
resumeSession,
});
return result.success; return result.success;
} }

View File

@ -5,7 +5,7 @@
import { WorkflowEngine } from '../workflow/engine.js'; import { WorkflowEngine } from '../workflow/engine.js';
import type { WorkflowConfig } from '../models/types.js'; import type { WorkflowConfig } from '../models/types.js';
import type { IterationLimitRequest } from '../workflow/types.js'; import type { IterationLimitRequest } from '../workflow/types.js';
import { loadAgentSessions, updateAgentSession, clearAgentSessions } from '../config/paths.js'; import { loadAgentSessions, updateAgentSession } from '../config/paths.js';
import { import {
header, header,
info, info,
@ -54,8 +54,6 @@ export interface WorkflowExecutionResult {
/** Options for workflow execution */ /** Options for workflow execution */
export interface WorkflowExecutionOptions { export interface WorkflowExecutionOptions {
/** Resume previous session instead of starting fresh */
resumeSession?: boolean;
/** Header prefix for display */ /** Header prefix for display */
headerPrefix?: string; headerPrefix?: string;
} }
@ -70,19 +68,13 @@ export async function executeWorkflow(
options: WorkflowExecutionOptions = {} options: WorkflowExecutionOptions = {}
): Promise<WorkflowExecutionResult> { ): Promise<WorkflowExecutionResult> {
const { const {
resumeSession = false,
headerPrefix = 'Running Workflow:', headerPrefix = 'Running Workflow:',
} = options; } = options;
// Clear previous sessions if not resuming // Always continue from previous sessions (use /clear to reset)
if (!resumeSession) { log.debug('Continuing session (use /clear to reset)');
log.debug('Starting fresh session (clearing previous agent sessions)');
clearAgentSessions(cwd);
} else {
log.debug('Resuming previous session');
}
header(`${headerPrefix} ${workflowConfig.name}${resumeSession ? ' (resuming)' : ''}`); header(`${headerPrefix} ${workflowConfig.name}`);
const workflowSessionId = generateSessionId(); const workflowSessionId = generateSessionId();
const sessionLog = createSessionLog(task, cwd, workflowConfig.name); const sessionLog = createSessionLog(task, cwd, workflowConfig.name);
@ -170,6 +162,7 @@ export async function executeWorkflow(
step: step.name, step: step.name,
status: response.status, status: response.status,
contentLength: response.content.length, contentLength: response.content.length,
sessionId: response.sessionId,
}); });
if (displayRef.current) { if (displayRef.current) {
displayRef.current.flush(); displayRef.current.flush();
@ -177,6 +170,9 @@ export async function executeWorkflow(
} }
console.log(); console.log();
status('Status', response.status); status('Status', response.status);
if (response.sessionId) {
status('Session', response.sessionId);
}
addToSessionLog(sessionLog, step.name, response); addToSessionLog(sessionLog, step.name, response);
}); });