-rオプションをOmitし、デフォルトを会話継続に
This commit is contained in:
parent
0c6d74af8a
commit
665b5187be
13
src/cli.ts
13
src/cli.ts
@ -4,11 +4,10 @@
|
||||
* TAKT CLI - Task Agent Koordination Tool
|
||||
*
|
||||
* Usage:
|
||||
* takt {task} - Execute task with current workflow (new session)
|
||||
* takt -r {task} - Execute task, resuming previous session
|
||||
* takt {task} - Execute task with current workflow (continues session)
|
||||
* takt /run-tasks - Run all pending tasks from .takt/tasks/
|
||||
* 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 /config - Select permission mode interactively
|
||||
*/
|
||||
@ -46,9 +45,7 @@ program
|
||||
|
||||
program
|
||||
.argument('[task]', 'Task to execute or slash command')
|
||||
.option('-r, --resume', 'Resume previous session (continue agent conversations)')
|
||||
.action(async (task, options: { resume?: boolean }) => {
|
||||
const resumeSession = options.resume ?? false;
|
||||
.action(async (task) => {
|
||||
const cwd = resolve(process.cwd());
|
||||
|
||||
// Initialize global directories first
|
||||
@ -150,8 +147,8 @@ program
|
||||
);
|
||||
}
|
||||
|
||||
log.info('Starting task execution', { task, workflow: selectedWorkflow, resumeSession });
|
||||
const taskSuccess = await executeTask(task, cwd, selectedWorkflow, { resumeSession });
|
||||
log.info('Starting task execution', { task, workflow: selectedWorkflow });
|
||||
const taskSuccess = await executeTask(task, cwd, selectedWorkflow);
|
||||
if (!taskSuccess) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@ -13,19 +13,15 @@ export function showHelp(): void {
|
||||
|
||||
console.log(`
|
||||
Usage:
|
||||
takt {task} Execute task with current workflow (new session)
|
||||
takt -r {task} Execute task, resuming previous agent sessions
|
||||
takt {task} Execute task with current workflow (continues session)
|
||||
takt /run-tasks Run all pending tasks from .takt/tasks/
|
||||
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
|
||||
|
||||
Options:
|
||||
-r, --resume Resume previous session (continue agent conversations)
|
||||
|
||||
Examples:
|
||||
takt "Fix the bug in main.ts" # Start fresh
|
||||
takt -r "Continue the fix" # Resume previous session
|
||||
takt "Fix the bug in main.ts" # Execute task (continues session)
|
||||
takt /clear # Clear sessions, start fresh
|
||||
takt /switch
|
||||
takt /run-tasks
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
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 { withAgentSession } from './session.js';
|
||||
export { switchWorkflow } from './workflow.js';
|
||||
|
||||
@ -18,23 +18,14 @@ import { DEFAULT_WORKFLOW_NAME } from '../constants.js';
|
||||
|
||||
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
|
||||
*/
|
||||
export async function executeTask(
|
||||
task: string,
|
||||
cwd: string,
|
||||
workflowName: string = DEFAULT_WORKFLOW_NAME,
|
||||
options: ExecuteTaskOptions = {}
|
||||
workflowName: string = DEFAULT_WORKFLOW_NAME
|
||||
): Promise<boolean> {
|
||||
const { resumeSession = false } = options;
|
||||
|
||||
const workflowConfig = loadWorkflow(workflowName);
|
||||
|
||||
if (!workflowConfig) {
|
||||
@ -47,12 +38,9 @@ export async function executeTask(
|
||||
log.debug('Running workflow', {
|
||||
name: workflowConfig.name,
|
||||
steps: workflowConfig.steps.map(s => s.name),
|
||||
resumeSession,
|
||||
});
|
||||
|
||||
const result = await executeWorkflow(workflowConfig, task, cwd, {
|
||||
resumeSession,
|
||||
});
|
||||
const result = await executeWorkflow(workflowConfig, task, cwd);
|
||||
return result.success;
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import { WorkflowEngine } from '../workflow/engine.js';
|
||||
import type { WorkflowConfig } from '../models/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 {
|
||||
header,
|
||||
info,
|
||||
@ -54,8 +54,6 @@ export interface WorkflowExecutionResult {
|
||||
|
||||
/** Options for workflow execution */
|
||||
export interface WorkflowExecutionOptions {
|
||||
/** Resume previous session instead of starting fresh */
|
||||
resumeSession?: boolean;
|
||||
/** Header prefix for display */
|
||||
headerPrefix?: string;
|
||||
}
|
||||
@ -70,19 +68,13 @@ export async function executeWorkflow(
|
||||
options: WorkflowExecutionOptions = {}
|
||||
): Promise<WorkflowExecutionResult> {
|
||||
const {
|
||||
resumeSession = false,
|
||||
headerPrefix = 'Running Workflow:',
|
||||
} = options;
|
||||
|
||||
// Clear previous sessions if not resuming
|
||||
if (!resumeSession) {
|
||||
log.debug('Starting fresh session (clearing previous agent sessions)');
|
||||
clearAgentSessions(cwd);
|
||||
} else {
|
||||
log.debug('Resuming previous session');
|
||||
}
|
||||
// Always continue from previous sessions (use /clear to reset)
|
||||
log.debug('Continuing session (use /clear to reset)');
|
||||
|
||||
header(`${headerPrefix} ${workflowConfig.name}${resumeSession ? ' (resuming)' : ''}`);
|
||||
header(`${headerPrefix} ${workflowConfig.name}`);
|
||||
|
||||
const workflowSessionId = generateSessionId();
|
||||
const sessionLog = createSessionLog(task, cwd, workflowConfig.name);
|
||||
@ -170,6 +162,7 @@ export async function executeWorkflow(
|
||||
step: step.name,
|
||||
status: response.status,
|
||||
contentLength: response.content.length,
|
||||
sessionId: response.sessionId,
|
||||
});
|
||||
if (displayRef.current) {
|
||||
displayRef.current.flush();
|
||||
@ -177,6 +170,9 @@ export async function executeWorkflow(
|
||||
}
|
||||
console.log();
|
||||
status('Status', response.status);
|
||||
if (response.sessionId) {
|
||||
status('Session', response.sessionId);
|
||||
}
|
||||
addToSessionLog(sessionLog, step.name, response);
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user