feat(ultraplan-local): extend project-discovery with review.md

This commit is contained in:
Kjell Tore Guttormsen 2026-05-01 16:43:08 +02:00
commit ebeae010c1
2 changed files with 61 additions and 2 deletions

View file

@ -104,3 +104,45 @@ test('checkPhaseRequirements — happy path', () => {
const r = checkPhaseRequirements({ brief: 'x', plan: 'y' }, 'plan');
assert.equal(r.valid, true);
});
test('discoverProject — finds review.md when present', () => {
const root = setupProject({
'brief.md': 'b',
'review.md': 'r',
});
try {
const a = discoverProject(root);
assert.equal(a.review, join(root, 'review.md'));
} finally {
rmSync(root, { recursive: true, force: true });
}
});
test('discoverProject — review null when absent', () => {
const root = setupProject({
'brief.md': 'b',
});
try {
const a = discoverProject(root);
assert.equal(a.review, null);
} finally {
rmSync(root, { recursive: true, force: true });
}
});
test('checkPhaseRequirements — review phase needs brief (error) and tolerates missing progress (warning)', () => {
// Missing brief → error
const r1 = checkPhaseRequirements({ brief: null, progress: null }, 'review');
assert.equal(r1.valid, false);
assert.ok(r1.errors.find(e => e.code === 'PROJECT_NO_BRIEF'));
// Has brief, no progress → valid (with warning)
const r2 = checkPhaseRequirements({ brief: 'x', progress: null }, 'review');
assert.equal(r2.valid, true, JSON.stringify(r2));
assert.ok(r2.warnings.find(w => w.code === 'PROJECT_NO_PROGRESS'));
// Has both → valid, no warning
const r3 = checkPhaseRequirements({ brief: 'x', progress: 'p' }, 'review');
assert.equal(r3.valid, true);
assert.equal(r3.warnings.length, 0);
});