import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { mkdtempSync, rmSync, existsSync } from 'fs'; import { tmpdir } from 'os'; import { join } from 'path'; import { generateStatus } from '../src/core/status.js'; import { writeEntity } from '../src/core/files.js'; import { getEntityDir } from '../src/core/paths.js'; describe('status', () => { let cwd: string; beforeEach(() => { cwd = mkdtempSync(join(tmpdir(), 'agenthub-')); }); afterEach(() => { rmSync(cwd, { recursive: true, force: true }); }); it('generates a status file', () => { const taskDir = getEntityDir(cwd, 'tasks'); writeEntity(join(taskDir, 'TSK-0001.md'), { id: 'TSK-0001', title: 'Open task', status: 'open', createdAt: '2026-06-24T10:00:00Z', updatedAt: '2026-06-24T10:00:00Z' }, 'desc'); const status = generateStatus(cwd); expect(status.activeTasks).toContain('TSK-0001'); expect(existsSync(join(cwd, '.agenthub', 'status', 'latest.md'))).toBe(true); }); });