Skip to content

Commit c984ad9

Browse files
Improve output format clarity and remove JSON
- Add legend explaining node types (epic, batch, task, pr) - Rename 'EDGES' to 'SUB-ISSUES' with explicit parent→child label - Rename 'RELATED' to 'CROSS-REFERENCES' with mentioned/referenced label - Use ↔ symbol for bidirectional cross-references - Show '(none)' for empty sections instead of blank - Remove redundant JSON output to reduce token usage
1 parent 5353b6b commit c984ad9

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

pkg/github/issue_graph.go

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,9 @@ func formatGraphOutput(graph *IssueGraph) string {
791791
sb.WriteString(graph.Summary)
792792
sb.WriteString("\n")
793793

794+
// Legend for node types
795+
sb.WriteString("Node types: epic (large initiative), batch (has sub-issues), task (regular issue), pr (pull request)\n\n")
796+
794797
// Nodes section
795798
sb.WriteString(fmt.Sprintf("NODES (%d total)\n", len(graph.Nodes)))
796799
sb.WriteString("===============\n")
@@ -807,9 +810,9 @@ func formatGraphOutput(graph *IssueGraph) string {
807810
}
808811
}
809812

810-
// Edges section - parent/child relationships
811-
sb.WriteString("\nEDGES (parent → child)\n")
812-
sb.WriteString("======================\n")
813+
// Edges section - parent/child relationships (sub-issues, closes/fixes)
814+
sb.WriteString("\nSUB-ISSUES (parent → child)\n")
815+
sb.WriteString("===========================\n")
813816
parentChildEdges := make([]GraphEdge, 0)
814817
relatedEdges := make([]GraphEdge, 0)
815818
for _, edge := range graph.Edges {
@@ -833,20 +836,26 @@ func formatGraphOutput(graph *IssueGraph) string {
833836
}
834837
}
835838

836-
for _, edge := range parentChildEdges {
837-
fromRef := formatNodeRef(edge.FromOwner, edge.FromRepo, edge.FromNumber, graph.FocusOwner, graph.FocusRepo)
838-
toRef := formatNodeRef(edge.ToOwner, edge.ToRepo, edge.ToNumber, graph.FocusOwner, graph.FocusRepo)
839-
sb.WriteString(fmt.Sprintf("%s → %s\n", fromRef, toRef))
839+
if len(parentChildEdges) == 0 {
840+
sb.WriteString("(none)\n")
841+
} else {
842+
for _, edge := range parentChildEdges {
843+
fromRef := formatNodeRef(edge.FromOwner, edge.FromRepo, edge.FromNumber, graph.FocusOwner, graph.FocusRepo)
844+
toRef := formatNodeRef(edge.ToOwner, edge.ToRepo, edge.ToNumber, graph.FocusOwner, graph.FocusRepo)
845+
sb.WriteString(fmt.Sprintf("%s → %s\n", fromRef, toRef))
846+
}
840847
}
841848

842-
// Related section
843-
if len(relatedEdges) > 0 {
844-
sb.WriteString("\nRELATED\n")
845-
sb.WriteString("=======\n")
849+
// Related section (cross-references from timeline, body mentions)
850+
sb.WriteString("\nCROSS-REFERENCES (mentioned/referenced)\n")
851+
sb.WriteString("=======================================\n")
852+
if len(relatedEdges) == 0 {
853+
sb.WriteString("(none)\n")
854+
} else {
846855
for _, edge := range relatedEdges {
847856
fromRef := formatNodeRef(edge.FromOwner, edge.FromRepo, edge.FromNumber, graph.FocusOwner, graph.FocusRepo)
848857
toRef := formatNodeRef(edge.ToOwner, edge.ToRepo, edge.ToNumber, graph.FocusOwner, graph.FocusRepo)
849-
sb.WriteString(fmt.Sprintf("%s ~ %s\n", fromRef, toRef))
858+
sb.WriteString(fmt.Sprintf("%s %s\n", fromRef, toRef))
850859
}
851860
}
852861

0 commit comments

Comments
 (0)