Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 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

fix(cli): show the task id in the task status header instead of undefined (#4332)

kevin80c5955db378
diff --git a/v3/@claude-flow/cli/__tests__/task-status-header.test.ts b/v3/@claude-flow/cli/__tests__/task-status-header.test.ts
new file mode 100644
index 0000000000..7cdde8d33f
--- /dev/null
+++ b/v3/@claude-flow/cli/__tests__/task-status-header.test.ts
@@ -0,0 +1,47 @@
+/**
+ * `task status` titled its box with `result.id`, but task_status returns
+ * `taskId`, so every task was shown as "Task: undefined".
+ */
+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
+import { mkdtempSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { taskTools } from '../src/mcp-tools/task-tools.js';
+import { taskCommand } from '../src/commands/task.js';
+import { output } from '../src/output.js';
+import type { CommandContext } from '../src/types.js';
+
+const statusCommand = taskCommand.subcommands!.find(c => c.name === 'status')!;
+
+describe('task status', () => {
+ let dir: string;
+ let prevCwd: string | undefined;
+
+ beforeEach(() => {
+ dir = mkdtempSync(join(tmpdir(), 'ruflo-task-status-'));
+ prevCwd = process.env.CLAUDE_FLOW_CWD;
+ process.env.CLAUDE_FLOW_CWD = dir;
+ vi.spyOn(output, 'writeln').mockImplementation(() => {});
+ vi.spyOn(output, 'printTable').mockImplementation(() => {});
+ });
+
+ afterEach(() => {
+ vi.restoreAllMocks();
+ if (prevCwd === undefined) delete process.env.CLAUDE_FLOW_CWD;
+ else process.env.CLAUDE_FLOW_CWD = prevCwd;
+ rmSync(dir, { recursive: true, force: true });
+ });
+
+ it('titles the status box with the task id', async () => {
+ const create = taskTools.find(t => t.name === 'task_create')!.handler;
+ const { taskId } = await create({ type: 'feature', description: 'work' }) as { taskId: string };
+ const printBox = vi.spyOn(output, 'printBox').mockImplementation(() => {});
+
+ const ctx = { args: [taskId], flags: {}, cwd: dir, interactive: false } as unknown as CommandContext;
+ const result = await statusCommand.action!(ctx);
+
+ expect(result?.success).toBe(true);
+ expect(printBox).toHaveBeenCalledTimes(1);
+ expect(printBox.mock.calls[0][1]).toBe(`Task: ${taskId}`);
+ });
+});
diff --git a/v3/@claude-flow/cli/src/commands/task.ts b/v3/@claude-flow/cli/src/commands/task.ts
index 29cadd7db3..0a8857e2c5 100644
--- a/v3/@claude-flow/cli/src/commands/task.ts
+++ b/v3/@claude-flow/cli/src/commands/task.ts
@@ -382,7 +382,7 @@ const statusCommand: Command = {
try {
const result = await callMCPTool<{
- id: string;
+ taskId: string;
type: string;
description: string;
priority: string;
@@ -437,7 +437,7 @@ const statusCommand: Command = {
'',
`Description: ${result.description}`
].join('\n'),
- `Task: ${result.id}`
+ `Task: ${result.taskId}`
);
// Assignment info