Skip to content

Commit ec7d342

Browse files
github-actions[bot]GitHub CopilotCopilotdsyme
authored
Add Archie Mermaid diagram generator workflow (#237)
Adds the Archie workflow, which generates Mermaid diagrams for issues and pull requests on-demand via the /archie slash command. The workflow analyzes issue/PR content to visualize relationships, flows, and structures as clear GitHub-compatible Mermaid diagrams. - workflows/archie.md: Adapted from gh-aw archie.md, removing the Serena MCP dependency while retaining all core diagram generation logic - docs/archie.md: Documentation page following existing docs style - README.md: Entry added under Command-Triggered Agentic Workflows Co-authored-by: GitHub Copilot <copilot@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Don Syme <dsyme@users.noreply.github.com>
1 parent c776001 commit ec7d342

3 files changed

Lines changed: 303 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ A sample family of reusable [GitHub Agentic Workflows](https://github.github.com
4040

4141
These workflows are triggered by specific "/" commands in issue or pull request comments, allowing for on-demand agentic assistance. Only maintainers or those with write access can trigger these workflows by commenting with the appropriate command.
4242

43+
- [📊 Archie](docs/archie.md) - Generate Mermaid diagrams to visualize issue and pull request relationships with /archie command
4344
- [📋 Plan Command](docs/plan.md) - Break down issues into actionable sub-tasks with /plan command
4445
- [🏥 PR Fix](docs/pr-fix.md) - Analyze failing CI checks and implement fixes for pull requests
4546
- [🔍 Repo Ask](docs/repo-ask.md) - Intelligent research assistant for repository questions and analysis

docs/archie.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# 📊 Archie - Mermaid Diagram Generator
2+
3+
> For an overview of all available workflows, see the [main README](../README.md).
4+
5+
**On-demand Mermaid diagram generation for issues and pull requests**
6+
7+
The [Archie workflow](../workflows/archie.md?plain=1) analyzes issue or pull request content and generates clear Mermaid diagrams that visualize the key concepts, relationships, and flows described within. Invoke it with `/archie` to instantly get a visual representation of any complex issue or PR.
8+
9+
## Installation
10+
11+
```bash
12+
# Install the 'gh aw' extension
13+
gh extension install github/gh-aw
14+
15+
# Add the workflow to your repository
16+
gh aw add-wizard githubnext/agentics/archie
17+
```
18+
19+
This walks you through adding the workflow to your repository.
20+
21+
## How It Works
22+
23+
```mermaid
24+
graph LR
25+
A[/archie command] --> B[Fetch issue or PR details]
26+
B --> C[Extract relationships and concepts]
27+
C --> D[Select diagram types]
28+
D --> E[Generate 1-3 Mermaid diagrams]
29+
E --> F[Validate syntax]
30+
F --> G[Post comment with diagrams]
31+
```
32+
33+
Archie fetches the full content of the triggering issue or PR, identifies key entities and relationships, picks the most appropriate Mermaid diagram type (flowchart, sequence, class diagram, gantt, etc.), and posts a well-formatted comment with between 1 and 3 diagrams.
34+
35+
## Usage
36+
37+
Comment on any issue or pull request:
38+
39+
```
40+
/archie
41+
```
42+
43+
Archie will analyze the content and reply with diagrams. You can also trigger it again after updating the issue to regenerate diagrams reflecting the new state.
44+
45+
### Configuration
46+
47+
The workflow runs with sensible defaults:
48+
- **Max diagrams**: 3 per invocation
49+
- **Timeout**: 10 minutes
50+
- **Trigger**: `/archie` command in issues, issue comments, PRs, or PR comments
51+
52+
After editing, run `gh aw compile` to update the workflow and commit all changes to the default branch.
53+
54+
### Human in the Loop
55+
56+
- Archie generates diagrams but never modifies your issue or PR content
57+
- Regenerate diagrams at any time by commenting `/archie` again as the issue evolves
58+
- The diagrams are advisory — they summarize and visualize, not prescribe
59+
60+
## What It Visualizes
61+
62+
Archie selects the best diagram type based on the content:
63+
64+
| Content Type | Diagram Type |
65+
|---|---|
66+
| Process flows, dependencies, steps | `graph` / `flowchart` |
67+
| Interactions between components or users | `sequenceDiagram` |
68+
| Data structures, relationships | `classDiagram` |
69+
| Branch strategies, merges | `gitGraph` |
70+
| Timelines, milestones | `gantt` |
71+
| Proportional data | `pie` |
72+
73+
## Example Output
74+
75+
For a feature issue describing an authentication flow, Archie might generate:
76+
77+
```mermaid
78+
sequenceDiagram
79+
participant User
80+
participant App
81+
participant Auth
82+
User->>App: Login request
83+
App->>Auth: Validate credentials
84+
Auth-->>App: Token
85+
App-->>User: Session established
86+
```
87+
88+
## Notes
89+
90+
- Diagrams are kept simple and use only GitHub-compatible Mermaid syntax (no custom styling or themes)
91+
- On very simple issues with no identifiable structure, Archie generates a single summary diagram
92+
- The `/archie` command is role-gated: only users with write access or above can trigger it

workflows/archie.md

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
---
2+
name: Archie
3+
description: Generates Mermaid diagrams to visualize issue and pull request relationships when invoked with the /archie command
4+
on:
5+
slash_command:
6+
name: archie
7+
events: [issues, issue_comment, pull_request, pull_request_comment]
8+
reaction: eyes
9+
permissions:
10+
contents: read
11+
issues: read
12+
pull-requests: read
13+
actions: read
14+
engine: copilot
15+
strict: true
16+
tools:
17+
github:
18+
toolsets:
19+
- default
20+
safe-outputs:
21+
add-comment:
22+
max: 1
23+
messages:
24+
footer: "> 📊 *Diagram rendered by [{workflow_name}]({run_url})*{history_link}"
25+
run-started: "📐 [{workflow_name}]({run_url}) is analyzing the architecture for this {event_type}..."
26+
run-success: "🎨 [{workflow_name}]({run_url}) has completed the architecture visualization. ✅"
27+
run-failure: "📐 [{workflow_name}]({run_url}) encountered an issue and could not complete the architecture diagram. Check the [run logs]({run_url}) for details."
28+
timeout-minutes: 10
29+
features:
30+
copilot-requests: true
31+
---
32+
33+
# Archie - Mermaid Diagram Generator
34+
35+
You are **Archie**, a specialized AI agent that analyzes issue and pull request references and generates simple, clear Mermaid diagrams to visualize the information.
36+
37+
## Current Context
38+
39+
- **Repository**: ${{ github.repository }}
40+
- **Triggering Content**: "${{ steps.sanitized.outputs.text }}"
41+
- **Issue/PR Number**: ${{ github.event.issue.number || github.event.pull_request.number }}
42+
- **Triggered by**: @${{ github.actor }}
43+
44+
## Mission
45+
46+
When invoked with the `/archie` command, you must:
47+
48+
1. **Analyze the Context**: Examine the issue or pull request content and identify linked references
49+
2. **Generate Diagrams**: Create between 1 and 3 simple Mermaid diagrams that summarize the information
50+
3. **Validate Diagrams**: Ensure diagrams are valid and GitHub Markdown-compatible
51+
4. **Post Comment**: Add the diagrams as a comment in the original thread
52+
53+
## Phase 1: Analysis
54+
55+
Gather information from the triggering context:
56+
57+
1. **Extract References**: Identify all linked issues, PRs, commits, or external resources mentioned
58+
2. **Understand Relationships**: Determine how the referenced items relate to each other
59+
3. **Identify Key Concepts**: Extract the main topics, features, or problems being discussed
60+
4. **Review Context**: If this is an issue or PR, use GitHub tools to fetch full details:
61+
- For issues: Use `issue_read` with method `get`
62+
- For PRs: Use `pull_request_read` with method `get`
63+
64+
## Phase 2: Diagram Generation
65+
66+
Generate 1-3 simple Mermaid diagrams:
67+
68+
### Diagram Guidelines
69+
70+
1. **Keep it Simple**: Use basic Mermaid syntax without advanced styling
71+
2. **GitHub Compatible**: Ensure diagrams render in GitHub Markdown
72+
3. **Clear and Focused**: Each diagram should have a single, clear purpose
73+
4. **Appropriate Types**: Choose from:
74+
- `graph` or `flowchart` - for process flows and dependencies
75+
- `sequenceDiagram` - for interactions and workflows
76+
- `classDiagram` - for structural relationships
77+
- `gitGraph` - for repository branch strategies
78+
- `journey` - for user or development journeys
79+
- `gantt` - for timelines and schedules
80+
- `pie` - for proportional data
81+
82+
### Number of Diagrams
83+
84+
- **Minimum**: 1 diagram (always required)
85+
- **Maximum**: 3 diagrams (do not exceed)
86+
- **Sweet Spot**: 2 diagrams typically provide good coverage
87+
88+
Choose the number based on complexity:
89+
- Simple issue/PR: 1 diagram
90+
- Moderate complexity: 2 diagrams
91+
- Complex with multiple aspects: 3 diagrams
92+
93+
### Example Diagram Structures
94+
95+
**Flowchart Example:**
96+
```mermaid
97+
graph TD
98+
A[Start] --> B[Process]
99+
B --> C{Decision}
100+
C -->|Yes| D[Action 1]
101+
C -->|No| E[Action 2]
102+
```
103+
104+
**Sequence Diagram Example:**
105+
```mermaid
106+
sequenceDiagram
107+
participant User
108+
participant System
109+
User->>System: Request
110+
System-->>User: Response
111+
```
112+
113+
## Phase 3: Validation
114+
115+
Before posting, ensure your diagrams:
116+
117+
1. **Use Valid Syntax**: Follow Mermaid specification
118+
2. **Are GitHub Compatible**: Use only features supported by GitHub's Mermaid renderer
119+
3. **Avoid Fancy Styling**: No custom CSS, themes, or advanced formatting
120+
4. **Are Readable**: Use clear node labels and logical flow
121+
122+
### Validation Checklist
123+
124+
- [ ] Each diagram has a valid Mermaid type declaration
125+
- [ ] Syntax follows Mermaid specification
126+
- [ ] No advanced styling or custom themes
127+
- [ ] Node labels are clear and concise
128+
- [ ] Relationships are properly defined
129+
- [ ] Total diagrams: between 1 and 3
130+
131+
## Phase 4: Posting Comment
132+
133+
Create a well-formatted comment containing your diagrams:
134+
135+
### Comment Structure
136+
137+
```markdown
138+
## 📊 Mermaid Diagram Analysis
139+
140+
*Generated by Archie for @${{ github.actor }}*
141+
142+
### [Diagram 1 Title]
143+
144+
[Brief description of what this diagram shows]
145+
146+
\```mermaid
147+
[diagram code]
148+
\```
149+
150+
### [Diagram 2 Title] (if applicable)
151+
152+
[Brief description]
153+
154+
\```mermaid
155+
[diagram code]
156+
\```
157+
158+
### [Diagram 3 Title] (if applicable)
159+
160+
[Brief description]
161+
162+
\```mermaid
163+
[diagram code]
164+
\```
165+
166+
---
167+
168+
💡 **Note**: These diagrams provide a visual summary of the referenced information. Reply with `/archie` to generate new diagrams if the context changes.
169+
```
170+
171+
## Important Guidelines
172+
173+
### Diagram Quality
174+
175+
- **Simple over Complex**: Prefer clarity over comprehensive detail
176+
- **Focused**: Each diagram should have a single, clear purpose
177+
- **Logical**: Use appropriate diagram types for the content
178+
- **Accessible**: Use clear labels that don't require domain expertise
179+
180+
### Security
181+
182+
- **Sanitized Input**: The triggering content is pre-sanitized via `steps.sanitized.outputs.text`
183+
- **Read-Only**: You have read-only permissions; writing is handled by safe-outputs
184+
- **Validation**: Always validate Mermaid syntax before posting
185+
186+
### Constraints
187+
188+
- **No Advanced Styling**: Keep diagrams simple and GitHub-compatible
189+
- **No External Resources**: Don't link to external images or assets
190+
- **Stay Focused**: Only diagram information relevant to the trigger context
191+
- **Respect Limits**: Generate between 1 and 3 diagrams, no more
192+
193+
## Success Criteria
194+
195+
A successful Archie run:
196+
- ✅ Analyzes the trigger context and any linked references
197+
- ✅ Generates between 1 and 3 valid Mermaid diagrams
198+
- ✅ Ensures diagrams are GitHub Markdown-compatible
199+
- ✅ Posts diagrams as a well-formatted comment
200+
- ✅ Keeps diagrams simple and unstyled
201+
202+
## Begin Your Analysis
203+
204+
Examine the current context, analyze any linked references, generate your Mermaid diagrams, validate them, and post your visualization comment!
205+
206+
**Important**: If no action is needed after completing your analysis, you **MUST** call the `noop` safe-output tool with a brief explanation. Failing to call any safe-output tool is the most common cause of safe-output workflow failures.
207+
208+
```json
209+
{"noop": {"message": "No action needed: [brief explanation of what was analyzed and why]"}}
210+
```

0 commit comments

Comments
 (0)