|
1
|
"""Skill: Generate a product/project roadmap.""" |
|
2
|
|
|
3
|
from video_processor.agent.skills.base import ( |
|
4
|
AgentContext, |
|
5
|
Artifact, |
|
6
|
Skill, |
|
7
|
register_skill, |
|
8
|
) |
|
9
|
|
|
10
|
|
|
11
|
class RoadmapSkill(Skill): |
|
12
|
name = "roadmap" |
|
13
|
description = "Generate a product/project roadmap" |
|
14
|
|
|
15
|
def execute(self, context: AgentContext, **kwargs) -> Artifact: |
|
16
|
stats = context.query_engine.stats() |
|
17
|
entities = context.query_engine.entities() |
|
18
|
relationships = context.query_engine.relationships() |
|
19
|
|
|
20
|
roadmap_types = {"milestone", "feature", "dependency"} |
|
21
|
relevant = [ |
|
22
|
e for e in context.planning_entities if getattr(e, "type", "").lower() in roadmap_types |
|
23
|
] |
|
24
|
|
|
25
|
parts = [ |
|
26
|
"You are a product strategist. Using the following " |
|
27
|
"knowledge graph context, generate a product roadmap.", |
|
28
|
"", |
|
29
|
"## Knowledge Graph Overview", |
|
30
|
stats.to_text(), |
|
31
|
"", |
|
32
|
"## Entities", |
|
33
|
entities.to_text(), |
|
34
|
"", |
|
35
|
"## Relationships", |
|
36
|
relationships.to_text(), |
|
37
|
"", |
|
38
|
"## Milestones, Features & Dependencies", |
|
39
|
] |
|
40
|
for e in relevant: |
|
41
|
parts.append(f"- [{getattr(e, 'type', 'unknown')}] {e}") |
|
42
|
|
|
43
|
if not relevant: |
|
44
|
parts.append( |
|
45
|
"(No pre-filtered entities; derive roadmap items from the full context above.)" |
|
46
|
) |
|
47
|
|
|
48
|
parts.append( |
|
49
|
"\nGenerate a markdown roadmap with:\n" |
|
50
|
"1. Vision & Strategy\n" |
|
51
|
"2. Phases (with timeline estimates)\n" |
|
52
|
"3. Key Dependencies\n" |
|
53
|
"4. A Mermaid Gantt chart summarizing the timeline\n\n" |
|
54
|
"Return ONLY the markdown." |
|
55
|
) |
|
56
|
|
|
57
|
prompt = "\n".join(parts) |
|
58
|
response = context.provider_manager.chat(messages=[{"role": "user", "content": prompt}]) |
|
59
|
|
|
60
|
return Artifact( |
|
61
|
name="Roadmap", |
|
62
|
content=response, |
|
63
|
artifact_type="roadmap", |
|
64
|
format="markdown", |
|
65
|
) |
|
66
|
|
|
67
|
|
|
68
|
register_skill(RoadmapSkill()) |
|
69
|
|