🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(tasks): align CLI assignment and listing with persisted handlers
Rudy Celeklib7691d0fe218
diff --git a/v3/@claude-flow/cli/__tests__/task-create-assignment-parity.test.ts b/v3/@claude-flow/cli/__tests__/task-create-assignment-parity.test.tsnew file mode 100644index 0000000000..e78e749d02--- /dev/null+++ b/v3/@claude-flow/cli/__tests__/task-create-assignment-parity.test.ts@@ -0,0 +1,38 @@+import { afterEach, describe, expect, it, vi } from 'vitest';+import { mkdtempSync, readFileSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+const state = vi.hoisted(() => ({ cwd: '' }));+vi.mock('../src/mcp-tools/types.js', () => ({ getProjectCwd: () => state.cwd }));+vi.mock('../src/mcp-client.js', async () => {+ const { taskTools } = await import('../src/mcp-tools/task-tools.js');+ return { MCPClientError: class extends Error {}, callMCPTool: async (name: string, input: any) => taskTools.find(t => t.name === name)!.handler(input) };+});+import { taskCommand } from '../src/commands/task.js';+afterEach(() => { if (state.cwd) rmSync(state.cwd, { recursive: true, force: true }); });+describe('task create CLI/MCP assignment parity', () => {+ it.each(['agent-one', 'agent-one, agent-two', ''])('persists --assign %s', async (assign) => {+ state.cwd = mkdtempSync(join(tmpdir(), 'ruflo-task-create-'));+ const action = taskCommand.subcommands!.find(c => c.name === 'create')!.action!;+ const result = await action({ args: [], flags: { _: [], type: 'implementation', description: 'Implement feature', assign }, cwd: state.cwd, interactive: false });+ expect(result.success).toBe(true);+ const store = JSON.parse(readFileSync(join(state.cwd, '.claude-flow/tasks/store.json'), 'utf8'));+ expect(Object.values(store.tasks)).toEqual([expect.objectContaining({ assignedTo: assign.split(',').map(s => s.trim()).filter(Boolean) })]);+ });+});++import { taskTools } from '../src/mcp-tools/task-tools.js';+it('lists all, running and agent-filtered tasks using the persisted handler contract', async () => {+ state.cwd = mkdtempSync(join(tmpdir(), 'ruflo-task-list-'));+ const call = (name: string, input: any): Promise<any> => taskTools.find(t=>t.name===name)!.handler(input) as Promise<any>;+ const active=await call('task_create',{type:'test',description:'active',assignTo:['alice']});+ const done=await call('task_create',{type:'test',description:'done',assignTo:['bob']});+ await call('task_update',{taskId:active.taskId,status:'in_progress'});+ await call('task_complete',{taskId:done.taskId});+ const action=taskCommand.subcommands!.find(c=>c.name==='list')!.action!;+ const list=async(flags:any)=>{ const r=await action({args:[],flags:{_:[],format:'json',...flags},cwd:state.cwd,interactive:false});return (r.data as any).tasks; };+ expect(await list({})).toEqual([expect.objectContaining({taskId:active.taskId})]);+ expect(await list({status:'running'})).toHaveLength(1);+ expect(await list({all:true})).toHaveLength(2);+ expect(await list({all:true,agent:'bob'})).toEqual([expect.objectContaining({taskId:done.taskId})]);+});diff --git a/v3/@claude-flow/cli/src/commands/task.ts b/v3/@claude-flow/cli/src/commands/task.tsindex 2bf55c822f..4c231035cc 100644--- a/v3/@claude-flow/cli/src/commands/task.ts+++ b/v3/@claude-flow/cli/src/commands/task.ts@@ -177,7 +177,7 @@ const createCommand: Command = {type: taskType,description,priority: priority || 'normal',- assignedTo: ctx.flags.assign ? [ctx.flags.assign] : undefined,+ assignTo: ctx.flags.assign ? String(ctx.flags.assign).split(',').map(id => id.trim()).filter(Boolean) : undefined,parentId: ctx.flags.parent,dependencies,tags,@@ -271,13 +271,14 @@ const listCommand: Command = {}],action: async (ctx: CommandContext): Promise<CommandResult> => {- const status = ctx.flags.all ? 'all' : (ctx.flags.status as string) || 'pending,running';+ const requestedStatus = ctx.flags.all ? 'all' : (ctx.flags.status as string) || 'pending,in_progress';+ const status = requestedStatus === 'all' ? undefined : requestedStatus.replace(/\brunning\b/g, 'in_progress');const limit = ctx.flags.limit as number;try {const result = await callMCPTool<{tasks: Array<{- id: string;+ taskId: string;type: string;description: string;priority: string;@@ -291,7 +292,7 @@ const listCommand: Command = {status,type: ctx.flags.type,priority: ctx.flags.priority,- agentId: ctx.flags.agent,+ assignedTo: ctx.flags.agent,limit,offset: 0});@@ -320,7 +321,7 @@ const listCommand: Command = {{ key: 'progress', header: 'Progress', width: 10 }],data: result.tasks.map(t => ({- id: t.id,+ id: t.taskId,type: t.type,description: t.description.length > 27? t.description.slice(0, 27) + '...'