feat(wave3): @mosaic/prdy TypeScript PRD wizard (#7)

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #7.
This commit is contained in:
2026-03-07 02:21:54 +00:00
committed by jason.woltje
parent 7f7109fc09
commit 95eed0739d
11 changed files with 690 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { promises as fs } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { describe, expect, it } from 'vitest';
import { createPrd, listPrds, loadPrd } from '../src/prd.js';
describe('prd document lifecycle', () => {
it('creates and loads PRD documents', async () => {
const projectDir = await fs.mkdtemp(path.join(os.tmpdir(), 'prdy-project-'));
try {
const created = await createPrd({
name: 'User Authentication',
projectPath: projectDir,
template: 'feature',
});
expect(created.title).toBe('User Authentication');
expect(created.status).toBe('draft');
expect(created.id).toMatch(/^user-authentication-\d{8}-\d{6}$/);
const loaded = await loadPrd(projectDir);
expect(loaded.id).toBe(created.id);
expect(loaded.title).toBe(created.title);
expect(loaded.sections.length).toBeGreaterThan(0);
const listed = await listPrds(projectDir);
expect(listed).toHaveLength(1);
expect(listed[0]?.id).toBe(created.id);
} finally {
await fs.rm(projectDir, { recursive: true, force: true });
}
});
});