Skip to content

qwadratic/deepwiki-cli

Repository files navigation

deepwiki-cli

CLI for DeepWiki — query, explore, and manage public GitHub repo documentation from the terminal.

Built on reverse-engineered api.devin.ai endpoints. No auth required for public repos.

Install

npm install -g @qwadratic/deepwiki-cli

Or use directly with npx:

npx @qwadratic/deepwiki-cli query "How does routing work?" -r facebook/react

From source

git clone https://github.com/qwadratic/deepwiki-cli.git
cd deepwiki-cli
pnpm install
pnpm build

Commands

query

Ask a question about one or more repos.

# Fast mode (default)
deepwiki query "How does auth work?" -r facebook/react

# Multiple repos
deepwiki query "Compare routing approaches" -r facebook/react -r remix-run/react-router

# Deep research mode
deepwiki query "Explain the build system" -r vercel/next.js -m deep

# Codemap mode with Mermaid output
deepwiki query "Show the hooks execution flow" -r facebook/react -m codemap --mermaid

# Stream response as NDJSON
deepwiki query "What is React?" -r facebook/react --stream

# Thread follow-up (reuse query ID)
deepwiki query "Tell me more about that" -r facebook/react --id <previous-query-id>

Flags:

Flag Description
-r, --repo <repos...> owner/repo to query (required, repeatable)
-m, --mode <mode> fast | deep | codemap (default: fast)
-s, --stream Stream response chunks as NDJSON via WebSocket
-c, --context <text> Additional context for the query
--id <queryId> Reuse query ID for thread follow-ups
--no-summary Disable summary generation
--mermaid Output Mermaid diagram (codemap mode only)

get

Retrieve results of a previous query by ID.

deepwiki get <queryId>

status

Check if a repo is indexed.

deepwiki status facebook/react

list

Search for indexed repos.

deepwiki list react

warm

Pre-warm a repo's cache (throttled to once per 10 min server-side).

deepwiki warm facebook/react

Output

All commands output JSON to stdout. Errors go to stderr as JSON with exit code 1.

# Pipe to jq
deepwiki list react | jq '.indices[].repo_name'

# Save codemap as Mermaid
deepwiki query "Show data flow" -r org/repo -m codemap --mermaid > diagram.mmd

Modes

Mode Engine ID Description
fast multihop_faster Multi-hop RAG, quick answers
deep agent Agentic research loop, thorough investigation
codemap codemap Structured code traces with file locations

Environment Variables

Variable Default Description
DEEPWIKI_API_URL https://api.devin.ai Override API base URL

Why not use DeepWiki MCP?

The DeepWiki MCP exposes two tools: ask a question and retrieve a full wiki page. That covers the simplest use case but loses what makes DeepWiki actually useful — iterating on queries, switching between fast/deep/codemap modes, drawing code trace diagrams, and threading follow-up questions to narrow down an answer. This CLI reproduces that full workflow and makes it agent-friendly: a coding agent can warm a repo, check indexing status, query in codemap mode, pipe the result through jq, and follow up — all as composable shell commands.

Why not use existing deepwiki-cli?

The deepwiki-cli package on npm retrieves docs via the DeepWiki MCP SSE protocol. It adds an intermediate layer (MCP) between you and the API, supports only basic Q&A, and doesn't expose mode selection, codemap traces, streaming, or any of the management commands. This package calls the API directly.

On MCP wrappers in general

MCP servers load all tool descriptions into the context window on every session. Popular ones consume 7-9% of the context before any work begins, and this overhead compounds on every turn. When a CLI already exists, wrapping it in MCP adds a protocol layer that costs tokens without adding capability.

LLMs already know standard CLI tools from training data. A CLI that outputs JSON to stdout is composable (| jq, | grep), needs no protocol negotiation, and lets agents pay the token cost only when they actually invoke the tool — not on every turn.

As Mario Zechner (pi-coding-agent) puts it: "Just like a lot of meetings could have been emails, a lot of MCPs could have been CLI invocations." His benchmarks show CLI tools run ~30% cheaper than equivalent MCP wrappers at the same success rate.

References:

Disclaimer

This tool uses reverse-engineered, undocumented API endpoints. It may break at any time if Cognition changes their API. No auth is required for public repos, but rate limits may apply. Use responsibly.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors