feat: Deep Reverse mode — detailed prompts via DeepWiki analysis#27
Open
beekamai wants to merge 1 commit into
Open
feat: Deep Reverse mode — detailed prompts via DeepWiki analysis#27beekamai wants to merge 1 commit into
beekamai wants to merge 1 commit into
Conversation
|
@beekamai is attempting to deploy a commit to the filiksyos' projects Team on Vercel. A member of the Team first needs to authorize it. |
4f9d428 to
3ed9084
Compare
Deep Reverse produces detailed, comprehensive prompts (2000-4000 words) by combining DeepWiki documentation analysis with LLM synthesis. Pipeline: wiki structure → LLM selects key topics → fetch full wiki → extract selected sections → LLM synthesizes actionable prompt. Includes: SSE streaming progress, combined browser + server-side fingerprint rate limiting (3/week), gradual rollout toggle, Supabase caching, in-flight dedup, and shared LLM client refactor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Added Deep Reverse — an optional mode that generates detailed, comprehensive prompts (2000–4000 words) by combining DeepWiki documentation analysis with LLM synthesis.
New files
lib/deepwiki-client.ts— DeepWiki MCP client (wiki structure, full wiki fetch, section extraction, error detection)lib/fingerprint.ts— Client-side browser fingerprint (SHA-256 from stable signals)lib/fingerprint-server.ts— Server-side combined fingerprint (IP + UA + client hash)lib/deep-reverse-prompts.ts— System prompts for analysis and synthesis phaseslib/llm-client.ts— Shared LLM client extracted fromreverse-prompt/route.ts(eliminates duplication)app/api/deep-reverse/route.ts— GET eligibility + POST SSE streaming pipeline.env.example— Documents all environment variables (was referenced in README but missing)Modified files
app/api/reverse-prompt/route.ts— Refactored to use sharedlib/llm-client.tsapp/api/library/route.ts— Deep prompts shown in priority over standard onescomponents/reverse-prompt-home.tsx— Deep Reverse toggle, SSE progress reader, DeepWiki linkREADME.md— Deep Reverse documentation and env var reference.gitignore— Added!.env.exampleexceptionHow it works
read_wiki_structure)read_wiki_contents) and extracts the selected sections by page title matchingProgress is streamed to the client via SSE events (
progress→complete/error).If a repository is not indexed by DeepWiki, the request is declined and the usage attempt is refunded. A DeepWiki link is shown next to the toggle so users can index the repo themselves before retrying.
Rate limiting & rollout
SHA-256(IP + User-Agent + Accept-Language + client_hash)— resistant to both incognito and VPN bypass.X-Fingerprintheader is required.DEEP_REVERSE_ROLLOUT_PERCENTenv var (0–100, default 50) — deterministic per fingerprint, no reshuffling when expandingSetup required
1. Environment variables (optional)
2. Supabase tables (required for Deep Reverse)
Run the following SQL in your Supabase SQL Editor:
Deep Reverse gracefully degrades — if Supabase is not configured, the toggle simply won't appear and standard reverse works as before.
Design note
DeepWiki's MCP
ask_questionendpoint is currently returning "Repository not found" for all public repositories (confirmed across facebook/react, vercel/next.js, torvalds/linux and others). This appears to be a DeepWiki-side outage. The implementation usesread_wiki_contentsinstead, which reliably returns full documentation for indexed repos. Section extraction is done server-side by parsing page titles — no extra API calls needed. If/whenask_questionis restored, it could be added as an alternative path without code changes to the current flow.Why This Change
The current reverse prompt is ~150 words based only on README + root file tree. For complex projects, this is too shallow to faithfully recreate the codebase. Deep Reverse leverages DeepWiki's repository analysis to produce prompts that cover architecture, data models, API design, and implementation details.
Testing Done
Type of Change
feat:New featurerefactor:Code refactoring (shared LLM client)Security & Quality Checklist