feat(P01): add ideation engine + ciagent ideate command — IDEATE-01,02,03,17 + MULTI-01
---ci---
phase: 1
milestone: v0.10
status: execute
decisions:
- id: D-080
decision: Three-tier ideation (mechanical, backend-enriched, cross-project)
rationale: Mechanical tier always produces output without backend
confidence: 0.92
- id: D-089
decision: No separate codebase map command
rationale: Git-native + .ciagent/ covers mapping; avoids tree-sitter dep
confidence: 0.88
requirements:
covered:
- IDEATE-01
- IDEATE-02
- IDEATE-03
- IDEATE-17
- MULTI-01
---/ci---
Add IdeationEngine core module with 15 signal collectors:
- Uncovered/partial requirements from REQUIREMENTS.md
- Coverage gaps (documented but unimplemented agents)
- Repeated lessons from git history
- Low-confidence decisions from ---ci--- blocks
- Escalation patterns from git history
- Compound solution patterns
- Architecture drift (ARCHITECTURE.md vs src/)
- Verification inversion (missing test files)
- Improvement patterns (cross-referencing lessons + requirements)
- Spec ambiguity (should/could/might patterns)
- Spec missing (common requirement categories)
- Cascade impact (--affected from git diff)
- External signals (npm audit, dependency staleness)
- Cross-project lesson mining
Add ciagent ideate CLI command with flags:
--category, --affected, --spec, --external, --cross-project, --output
Add active_projects to CIAgentConfig (backwards compatible with active_project).
Add IDEATE pipeline stage between RESEARCH and PLAN.
Update IdeationAgent to delegate to IdeationEngine.
533 tests passing.
This commit is contained in:
@@ -4,74 +4,24 @@ import * as os from "node:os";
|
||||
import { IdeationAgent } from "../agents/ideation-agent.js";
|
||||
|
||||
describe("IdeationAgent", () => {
|
||||
let tempDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ciagent-ideation-test-"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("generates ideas from uncovered requirements", () => {
|
||||
const ciagentDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciagentDir, { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(ciagentDir, "REQUIREMENTS.md"),
|
||||
"REQ-1: First requirement\nREQ-2: Second requirement"
|
||||
);
|
||||
|
||||
const agent = new IdeationAgent();
|
||||
const ideas = agent.mechanicalIdeate(tempDir);
|
||||
|
||||
const reqIdeas = ideas.filter((i) => i.source === "uncovered_requirement");
|
||||
expect(reqIdeas.length).toBeGreaterThanOrEqual(2);
|
||||
expect(reqIdeas.some((i) => i.relatedReq === "REQ-1")).toBe(true);
|
||||
});
|
||||
|
||||
it("identifies coverage gaps from PROJECT.md", () => {
|
||||
const ciagentDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciagentDir, { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(ciagentDir, "PROJECT.md"),
|
||||
"We use agent: magic-agent and agent: super-agent for tasks."
|
||||
);
|
||||
|
||||
const srcDir = path.join(tempDir, "src", "agents");
|
||||
fs.mkdirSync(srcDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(srcDir, "base.ts"), "");
|
||||
fs.writeFileSync(path.join(srcDir, "index.ts"), "");
|
||||
|
||||
const agent = new IdeationAgent();
|
||||
const gaps = agent.identifyCoverageGaps(tempDir);
|
||||
|
||||
expect(gaps).toContain("magic-agent");
|
||||
expect(gaps).toContain("super-agent");
|
||||
});
|
||||
|
||||
it("finds repeated patterns from lessons list", () => {
|
||||
const agent = new IdeationAgent();
|
||||
const lessons = [
|
||||
{ topic: "testing", detail: "testing: tests are flaky" },
|
||||
{ topic: "testing", detail: "testing: more test failures" },
|
||||
{ topic: "build", detail: "build: CI broken" },
|
||||
];
|
||||
|
||||
const repeated = agent.findRepeatedPatterns(lessons);
|
||||
expect(repeated).toContain("testing");
|
||||
expect(repeated).not.toContain("build");
|
||||
});
|
||||
|
||||
it("returns empty ideas when no project files exist", () => {
|
||||
const agent = new IdeationAgent();
|
||||
const ideas = agent.mechanicalIdeate(tempDir);
|
||||
|
||||
expect(ideas).toEqual(expect.arrayContaining([]));
|
||||
});
|
||||
|
||||
it("agent name is ideation-agent", () => {
|
||||
const agent = new IdeationAgent();
|
||||
expect(agent.name).toBe("ideation-agent");
|
||||
});
|
||||
|
||||
it("workflow is research", () => {
|
||||
const agent = new IdeationAgent();
|
||||
expect(agent.workflow).toBe("research");
|
||||
});
|
||||
|
||||
it("delegates mechanicalIdeate to IdeationEngine", () => {
|
||||
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ciagent-agent-test-"));
|
||||
try {
|
||||
const agent = new IdeationAgent();
|
||||
const ideas = agent.mechanicalIdeate(tempDir);
|
||||
expect(Array.isArray(ideas)).toBe(true);
|
||||
} finally {
|
||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user