AI
Mermaid Diagram Sync Assistant
Keep Mermaid diagrams automatically in sync with source code changes in pull requests.
The Mermaid Diagram Sync Assistant is an intelligent GitHub app that monitors your pull requests and updates Mermaid diagrams when related source files are modified. When a PR is opened, synchronized, or reopened, the app scans the changed files, finds diagrams connected to those files, regenerates the affected diagrams, and adds the updates back to the PR with clear bot attribution — so your docs stay current during review.
.mermaidignore Configuration
Control which files and diagrams are considered using .mermaidignore files (similar to .gitignore):
Key Features:
- Source file filtering - Exclude source files from triggering diagram updates
- Diagram file filtering - Completely exclude specific
.mmdfiles from processing - Standard gitignore syntax - Supports
*wildcards,**recursive matching,?single character - Negation patterns - Use
!patternto create exceptions and include previously excluded files - Pattern precedence - Later patterns override earlier ones for complex filtering rules
Example .mermaidignore :
# Ignore temporary and build files
*.log
*.tmp
build/
node_modules/
# Ignore test files but keep integration tests
**/*test*
!src/tests/integration.test.js
# Ignore draft diagrams except important ones
draft/**/*.mmd
!temp-important.mmd
Mermaid Diagram Sync Assistant Configuration
Control which PR branches the bot processes using .smart-mermaid-updates.yml:
Key Features:
- Branch filtering - Exclude PR head branches using exact names or wildcard patterns
- Flexible patterns - Supports exact matches (
main), wildcards (feature/*), negation (!pattern) - Multiple syntax - Both
excludeBranches(camelCase) andexclude-branches(kebab-case) - Smart processing - If branch matches exclusion pattern, entire PR is skipped
Example configurations:
# Basic exclusions
excludeBranches:
- experimental
- draft/*
- temp/*
- wip/*
# Advanced: exclude all except specific branches
excludeBranches:
- '*' # Exclude all branches
- '!feature/*' # Except feature/* branches
- '!main' # And except main branch
Real-World Example
Scenario: You modify src/auth/UserService.js to add two-factor authentication and update src/api/AuthController.js for new endpoints.
Bot Process:
- Detects changes in your PR
- Finds
docs/authentication-flow.mmdreferences both modified files - Analyzes code changes and understands new 2FA flow
- Regenerates Mermaid diagram with new authentication steps and API calls
- Commits updated diagram: “Automated diagram update”
Result: Your architecture documentation accurately reflects your implementation before PR review.