import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { mkdtempSync, rmSync } from 'fs'; import { tmpdir } from 'os'; import { join } from 'path'; import { taskCreate, taskList, taskDone } from '../src/cli/commands/task.js'; import { init } from '../src/cli/commands/init.js'; describe('task commands', () => { let cwd: string; beforeEach(async () => { cwd = mkdtempSync(join(tmpdir(), 'agenthub-')); await init(cwd, { yes: true, projectName: 'test' }); }); afterEach(() => { rmSync(cwd, { recursive: true, force: true }); }); it('creates and lists tasks', async () => { await taskCreate(cwd, { title: 'Test task', role: 'implementer', priority: 'high' }); const logs: string[] = []; const original = console.log; console.log = (msg: string) => logs.push(msg); taskList(cwd); console.log = original; expect(logs.some((m) => m.includes('TSK-0001'))).toBe(true); }); });