Skip to content

Enable optional DeepWiki integration for advanced repository analysis and UI library research.#1072

Closed
armelhbobdad wants to merge 2 commits intobmad-code-org:mainfrom
armelhbobdad:feature/deepwiki-research-integration
Closed

Enable optional DeepWiki integration for advanced repository analysis and UI library research.#1072
armelhbobdad wants to merge 2 commits intobmad-code-org:mainfrom
armelhbobdad:feature/deepwiki-research-integration

Conversation

@armelhbobdad
Copy link
Copy Markdown
Contributor

Idea: Add DeepWiki MCP integration to Technical Research workflow for authoritative repository documentation

PASS Framework

Problem:

The Technical Research workflow relies solely on web search, which provides general information but lacks authoritative, up-to-date documentation directly from source repositories. When researching framework integrations (e.g., Tauri + Next.js) or UI libraries (e.g., shadcn/ui), users cannot get verified API signatures, composition patterns, or accessibility features without manually reading repository docs.

Audience:

All BMAD users conducting Technical Research for framework integrations or UI library selection. Downstream agents (Architect, DEV, UX Designer) are severely affected as they receive unverified patterns that may not reflect actual repository documentation, leading to implementation errors and rework.

Solution:

Add optional DeepWiki MCP integration to the Technical Research workflow with:

  • Phase 1: Explicit opt-in with repository validation
  • Phase 2: Structured per-repository extraction (5 queries per repo)
  • Phase 3: LLM synthesis with confidence labeling ([REPO-VERIFIED] vs [LLM-SYNTHESIZED])
  • Phase 3.5: UI library-specific queries (components, theming, accessibility)
  • Phase 4: POC validation checklists for synthesized patterns
  • "For UX Designer" section with component capability matrices

Acceptance Criteria:

  • DeepWiki opt-in prompt appears in Step 1 for framework integration research
  • Repository type classification correctly identifies ui-library, ui-primitive, framework, auth-library, general
  • Phase 3.5 UI queries execute only when deepwiki_has_ui_repos: true
  • All synthesized patterns are labeled with [LLM-SYNTHESIZED] and include POC checklists
  • "For UX Designer" section generates with component availability and theming compatibility matrices
  • Query budget tracking displays usage (e.g., "9/15 queries used")
  • Compliance check passes with 0 critical/major issues

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 8, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@armelhbobdad
Copy link
Copy Markdown
Contributor Author

armelhbobdad commented Dec 8, 2025

🔍 What's New

DeepWiki MCP Integration enables authoritative GitHub repository documentation queries directly within research workflows.


⭐ Phase 1: Cross-Repository Reasoning

The Challenge: DeepWiki only supports single-repo queries - no native cross-repo analysis.

The Solution: A 4-phase query protocol that enables intelligent cross-repository synthesis:

  1. Phase 1: Cross-Reference Detection - Find actual integration docs between repos
  2. Phase 2: Structured Per-Repository Extraction - 5 queries per repo (APIs, protocols, extension points, adapters, ecosystem)
  3. Phase 3: LLM Cross-Repository Synthesis - Combine per-repo facts with explicit confidence labeling
  4. Phase 4: POC Validation Checklists - Mandatory proof-of-concept requirements for synthesized patterns

Confidence Labeling System:

  • 🟢 [REPO-VERIFIED] - Direct from repo docs
  • 🟡 [CROSS-REPO-DOCUMENTED] - Actual integration docs found (rare)
  • 🟠 [LLM-SYNTHESIZED] - Combined from per-repo facts - POC required
  • 🔴 [HYPOTHESIS-ONLY] - Speculative - Do not use without validation

Additional Features:

  • Explicit opt-in (not auto-detect)
  • Query budget tracking (max 15 queries, max 3 repos)
  • Downstream agent instructions for Architect and DEV
  • Data freshness warnings
  • Full audit trail for transparency

⭐ Phase 2: UI Library Support for UX Designers

Repository Type Classification:

  • ui-library (shadcn-ui, etc.)
  • ui-primitive (radix-ui, etc.)
  • framework (tauri-apps, vercel, etc.)
  • auth-library (better-auth, etc.)
  • general

Phase 3.5: UI Component Analysis (5 specialized queries):

  1. Component Inventory
  2. Theming & Customization
  3. Composition Patterns
  4. Accessibility Features
  5. Variant & State System

"For UX Designer" Section Output:

  • UI Library Summary table
  • Component Availability Quick Reference
  • Theming Compatibility matrix
  • Design System Recommendations (with [LLM-SYNTHESIZED] label)

🧪 Tested With

  • Phase 1: Tauri + Next.js + BetterAuth integration research
  • Phase 2: shadcn-ui/ui + vercel/ai-elements UI library comparison

Both passed validation with 100% compliance score.


📁 Files Changed

  • step-01-init.md - DeepWiki opt-in, repo validation, type classification
  • step-03-integration-patterns.md - 4-phase protocol, UI component queries
  • step-06-research-synthesis.md - Output synthesis, UX Designer section

~700 lines added across 3 files.

The workflow edit:
workflow-edit-research-technical.md

Tested files:

@armelhbobdad
Copy link
Copy Markdown
Contributor Author

It uses DeepWiki MCP for public repo and Devin MCP for private repo:

Note: The service is totally free for public and private repo.

@bmadcode
Copy link
Copy Markdown
Collaborator

is this the same or similar MCP to context-7 mcp?

I like the idea here, but I think a few changes are needed. Workflow step files are meant to be small, I think the research steps already need some reduction. but to keep them smaller when this is used vs not used, this would be better split into distinct step files if used vs not used.

re use distinction, this could be a bmad installer question instead of configuring during research. init step 1 possibly. Thinking about it...

@armelhbobdad
Copy link
Copy Markdown
Contributor Author

You’re completely right @bmadcode . I just wanted to share an idea. Honestly, I don’t yet know the best way to integrate it into the existing BMM workflows. However, I manually reviewed my PRD and architecture documents using DeepWiki + Otocode, and they caught some very useful missing information. Here are screenshots.

1- Example of a DeepWiki MCP enhancement:
image

2- Final review with Octocode MCP:
octocode result

I also attached a terminal output for more details.
octocode_outpout.txt

Overall, before jumping into the solutioning phase, I now feel confident about my PRD and architecture document.


Context7 MCP vs DeepWiki MCP vs Octocode MCP (Comparative Scenarios)

Here’s how they typically stack up in real usage:

Scenario: Generate current REST API code
Use Context7 MCP — pulls correct, latest docs and avoids hallucinated API usage.

Scenario: Understand entire repository architecture
Use DeepWiki MCP — structural documentation + search answers.

Scenario: Find semantic code patterns across repos
Use Octocode MCP — advanced semantic search and exploration.

Scenario: Cross-repo analysis and pattern synthesis
Octocode > DeepWiki > Context7 (in that order of depth).


Summary Highlights

  • Context7 MCP = documentation precision for coding workflows.
  • DeepWiki MCP = rich documentation access + structured QA over GitHub repos.
  • Octocode MCP = deep code research engine with semantic power and structural insight.

@armelhbobdad
Copy link
Copy Markdown
Contributor Author

@bmadcode new validation summary for the UX-Spec

image

New validation summary for the UX-Spec.

Deepwiki + Octocode make me feel so confident in every step.

Here is the prompt:

Now, we need to make sure the whole application shares the same design (the existing + the new interface we are going to implement). Review the whole UX design specification using Octocode tools or Deepwiki tool where it really needs to validate critical aspects.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds optional DeepWiki MCP integration to the Technical Research workflow, enabling authoritative repository documentation extraction for framework integration research and UI library analysis. The enhancement introduces a structured multi-phase query system with confidence labeling to distinguish repository-verified facts from LLM-synthesized integration patterns.

Key changes:

  • Three-phase opt-in workflow with repository validation, structured extraction (5 queries per repo), and LLM synthesis with mandatory confidence labels
  • Specialized UI library analysis (Phase 3.5) with component capability matrices, theming compatibility, and accessibility documentation for UX Designer downstream use
  • POC validation checklists for synthesized patterns with clear warnings to Architect and DEV agents about validation requirements

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
step-01-init.md Adds DeepWiki opt-in prompt, repository type classification (ui-library, ui-primitive, framework, auth-library, general), validation via read_wiki_structure(), and frontmatter configuration with query budget tracking
step-03-integration-patterns.md Implements 4-phase DeepWiki query protocol: cross-reference detection, structured per-repo extraction (5 queries), LLM synthesis with [LLM-SYNTHESIZED] labels, and conditional UI Component Analysis (Phase 3.5) with capability matrices
step-06-research-synthesis.md Adds conditional Integration Research Findings section with data source summary, confidence legend, framework compatibility matrix, downstream agent guidance (Architect/DEV/UX Designer), POC validation summary, and DeepWiki query audit trail

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{Repo A} → {mechanism} → {Repo B}
{Repo B} → {mechanism} → {Repo A} (if bidirectional)

````
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mismatched code fence delimiters. The code block opens with three backticks on line 470, but closes with four backticks on line 475. This creates an unclosed code block, and the subsequent code fence on line 478 won't work as expected.

Suggested change
````

Copilot uses AI. Check for mistakes.
```{language}
// Integration pattern - REQUIRES VALIDATION
{conceptual code based on extracted APIs}
````
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent code fence delimiter usage. This code block closes with four backticks, but markdown code blocks should use three backticks consistently for opening and closing delimiters.

Copilot uses AI. Check for mistakes.
After user selects 'C', load `./step-04-architectural-patterns.md` to analyze architectural patterns, design decisions, and system structures for {{research_topic}}.

Remember: Always write research content to document immediately and emphasize current integration data with rigorous source verification!
```
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extraneous closing code fence delimiter. There is an extra closing code fence (```) at line 616 that doesn't have a corresponding opening delimiter. This appears at the end of the file and will cause markdown rendering issues.

Suggested change
```

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +105
| `shadcn/*`, `shadcn-ui/*`, `radix-ui/*` | `ui-primitive` | Primitives, composition, accessibility |
| `chakra-ui/*`, `mui/*`, `ant-design/*` | `ui-library` | Components, theming, variants |
| `*-ui/*`, `*ui/*` (general) | `ui-library` | Components, props, customization |
| `tauri-apps/*`, `vercel/*`, `electron/*` | `framework` | APIs, protocols, extensions |
| `*auth*`, `*-auth/*` | `auth-library` | Sessions, providers, security |
| Other | `general` | Standard technical queries |

Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern match for shadcn repositories uses shadcn/* and shadcn-ui/*, but the actual shadcn/ui repository is typically referenced as shadcn-ui/ui or shadcn/ui. The pattern should include consideration for the exact repository naming convention. Consider adding documentation or examples that clarify which specific repositories match these patterns, as shadcn/ui is not an organization but a design system where the actual repository might be structured differently.

Suggested change
| `shadcn/*`, `shadcn-ui/*`, `radix-ui/*` | `ui-primitive` | Primitives, composition, accessibility |
| `chakra-ui/*`, `mui/*`, `ant-design/*` | `ui-library` | Components, theming, variants |
| `*-ui/*`, `*ui/*` (general) | `ui-library` | Components, props, customization |
| `tauri-apps/*`, `vercel/*`, `electron/*` | `framework` | APIs, protocols, extensions |
| `*auth*`, `*-auth/*` | `auth-library` | Sessions, providers, security |
| Other | `general` | Standard technical queries |
| `shadcn-ui/ui`, `shadcn-ui/*`, `radix-ui/*` | `ui-primitive` | Primitives, composition, accessibility |
| `chakra-ui/*`, `mui/*`, `ant-design/*` | `ui-library` | Components, theming, variants |
| `*-ui/*`, `*ui/*` (general) | `ui-library` | Components, props, customization |
| `tauri-apps/*`, `vercel/*`, `electron/*` | `framework` | APIs, protocols, extensions |
| `*auth*`, `*-auth/*` | `auth-library` | Sessions, providers, security |
| Other | `general` | Standard technical queries |
> **Note:** The canonical shadcn repository is [`shadcn-ui/ui`](https://github.com/shadcn-ui/ui). There is no `shadcn/ui` repository or `shadcn` organization. Use `shadcn-ui/ui` or other repositories under `shadcn-ui/*` for shadcn-related queries.

Copilot uses AI. Check for mistakes.
Comment on lines +130 to +131
**Query Budget:** This session will use approximately {estimated} queries. Maximum recommended: 15 queries."

Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query budget estimation is mentioned as "{estimated} queries" but there's no clear guidance on how to calculate this estimation. Based on the Phase 2 logic (5 queries per repo) and Phase 3.5 logic (5 queries per UI library repo), the estimation formula should be documented. For example, if all 3 repos are queried in Phase 2, that's 15 queries. If cross-reference detection is performed for repo pairs, that could be up to 3 additional queries. If any repos are UI libraries, that's another 5 queries each. The maximum could easily exceed 15 queries, which contradicts the stated maximum.

Suggested change
**Query Budget:** This session will use approximately {estimated} queries. Maximum recommended: 15 queries."
**Query Budget:** This session will use approximately {estimated} queries.
_Query budget estimation formula:_
- 5 queries per repository (Phase 2)
- Plus 5 additional queries for each UI library or UI primitive repository (Phase 3.5)
- Plus up to 1 query per unique pair of repositories for cross-reference detection
_Example:_ For 3 repositories (including 1 UI library), the maximum could be: (3 × 5) + (1 × 5) + (3 pairs × 1) = 23 queries.
**Maximum recommended:** 25 queries per session (soft limit; adjust as needed based on actual repo count and types).

Copilot uses AI. Check for mistakes.
Comment on lines +510 to +525
| Library | Components | Theming | Dark Mode | Accessibility |
| ---------- | ---------- | ---------- | ----------- | ------------- |
| {{repo_1}} | {{count}} | {{method}} | {{support}} | {{level}} |
| {{repo_2}} | {{count}} | {{method}} | {{support}} | {{level}} |

##### Component Availability Quick Reference

| Component Type | {{repo_1}} | {{repo_2}} | Notes |
| --------------- | ---------- | ---------- | --------- |
| Buttons | ✅/❌ | ✅/❌ | {{notes}} |
| Forms/Inputs | ✅/❌ | ✅/❌ | {{notes}} |
| Navigation | ✅/❌ | ✅/❌ | {{notes}} |
| Data Display | ✅/❌ | ✅/❌ | {{notes}} |
| Feedback/Alerts | ✅/❌ | ✅/❌ | {{notes}} |
| Layout | ✅/❌ | ✅/❌ | {{notes}} |
| Overlay/Modal | ✅/❌ | ✅/❌ | {{notes}} |
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table templates assume exactly 2 UI library repositories ({{repo_1}} and {{repo_2}}), but the system allows up to 3 repositories total. If only 1 UI library is provided or if all 3 repositories are UI libraries, these tables won't render correctly. The template should either be flexible to handle variable numbers of repositories (1-3), or there should be guidance on how to handle different scenarios.

Copilot uses AI. Check for mistakes.
**Q5 - Variant & State System:**

```
ask_question(repo, "How does {repo} handle component variants and states? What props control visual variations (size, color, disabled, etc.)?"
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing closing double quote in the query string. The query string starts with a double quote but ends without one, which will cause a syntax error when this template is used.

Suggested change
ask_question(repo, "How does {repo} handle component variants and states? What props control visual variations (size, color, disabled, etc.)?"
ask_question(repo, "How does {repo} handle component variants and states? What props control visual variations (size, color, disabled, etc.)?")

Copilot uses AI. Check for mistakes.
@armelhbobdad
Copy link
Copy Markdown
Contributor Author

Hi @muratkeremozcan . This PR needs to be reworked completely. Maybe I should close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants