Revision: 2 Last modified: 2026-12-04T16:05:44Z
Thin shell front end for the DeepWiki "Ask DeepWiki" badge engine. It is the interface callers use — hook
steps, schedulers, operators — so nothing outside scripts/deepwiki/ needs to know the implementation is
Python.
It deliberately adds nothing: no argument re-parsing, no defaults, no error translation, no exit-code
remapping. Every decision, including the measured detection contract, lives in deepwiki.py, and the shell
wrapper only locates the sibling module and execs the interpreter. That keeps exactly one place where the
oracle logic can be wrong, and one place to test it.
The feature it fronts: if a project's own repository — or one of its declared upstreams — is genuinely indexed on DeepWiki, put this line in the project's README:
[](https://deepwiki.com/<owner>/<repo>)The image is shields.io; only the link points at DeepWiki. That split is not cosmetic — see Edge cases.
bash(4.x or newer) andpython33.10 or newer, standard library only.PYTHONoverrides the interpreter.- Outbound HTTPS to
mcp.deepwiki.com:443for a real probe. No token, no account, no authentication. - For
syncon a real project: a git working tree with at least one remote, or an enabledupstreams/*.shrecipe, or arepo = owner/namedeclaration inconfig/deepwiki_badge.conf.
Ask about one repository (the detection contract):
scripts/deepwiki/deepwiki.sh detect HelixDevelopment/constitution
# DEEPWIKI_DETECT state=INDEXED repo=HelixDevelopment/constitution exit=0 http=200 reason="index present"Exit codes are the contract: 0 INDEXED, 1 NOT_INDEXED, 2 CANNOT_DETERMINE, 3 INVALID_IDENTIFIER,
64 usage. 2 is never a disguised 1: a blind or unreachable instrument withholds the badge instead of
claiming absence.
Write the badge into a project, idempotently:
scripts/deepwiki/deepwiki.sh sync --root /path/to/project
# DEEPWIKI_SYNC verdict=PASS repo=acme/widget action=noop source=remote:origin:url probes=1action is one of noop, inserted-row, appended-to-row, corrected, slot-updated. A second run on an
already-correct README is a byte-identical no-op — it does not even touch the file's mtime.
See what the engine thinks your identity is, in probe order, without any network call:
scripts/deepwiki/deepwiki.sh candidates --root /path/to/projectPrint the canonical badge line for a repository (no network, no file):
scripts/deepwiki/deepwiki.sh badge acme/widgetDry run — resolve and plan, write nothing:
scripts/deepwiki/deepwiki.sh sync --root . --dry-runA NULL is not an absence. The only thing separating "not indexed" from a malformed response is prose from
the remote service. So unknown prose, an unparseable frame, a non-200 status, a missing structuredContent, or
a response naming a different repository than the one asked for all yield CANNOT_DETERMINE, never
NOT_INDEXED. The engine withholds the badge and says so.
A negative needs a control. When no candidate answers INDEXED, the engine probes a known-indexed control
repository (facebook/react by default) with the same instrument in the same run. If the control is not seen
as indexed, the instrument is blind and the verdict is CANNOT_DETERMINE, not a negative.
A three-segment identifier never reaches the network. The server accepts a/b/c as a host-qualified custom
domain and answers the "Repository not found" prose, so it would become a false negative. REPO_RE rejects it
locally first (exit 3).
A non-http(s) endpoint is refused. file:, ftp: and friends are rejected before any opener sees them.
A third-party outage never fails the caller. sync exits 0 on every verdict (PASS, SKIP,
CANNOT-DETERMINE, DEFERRED). Only --strict (opt-in, never used by the hook wiring) turns a non-PASS into
exit 1. An existing badge is never removed on a transient failure.
The badge image must be an actual image endpoint. https://deepwiki.com/badge.svg answers HTTP 429
text/html (a bot-protection page), so GitHub renders a broken picture. That was a real defect in this
repository. The emitted image is always shields.io, which is why the output passes
scripts/testing/verify_readme_badge_images.sh.
--offline touches no network at all and reports SKIP reason=feature_disabled_by_config. Offline is a
deliberate opt-out, not a claim that the repository is unindexed.
Concurrency. A per-root advisory lock serialises runs; a second concurrent run reports
verdict=DEFERRED reason=concurrent-run rather than racing the README.
- Locate
deepwiki.pynext to itself viaBASH_SOURCE, verifypython3exists, andexecit with every argument unchanged. - The interpreter's exit code becomes the wrapper's exit code by virtue of
exec— there is no wrapper-level status handling to drift. - If the interpreter is missing, print an actionable diagnostic and exit
64(usage class), never a "not indexed" verdict and never a crash: a caller that wired this into a hook must see a configuration problem, not a fabricated repository verdict.
scripts/deepwiki/deepwiki.py— the engine: oracle, identity resolution, README writer, CLI.scripts/deepwiki/test_deepwiki.sh— the hermetic test suite (62 cases).scripts/deepwiki/mutation_test_deepwiki.sh— the paired §1.1 mutation test (11 mutations).scripts/testing/verify_readme_badge_images.sh— proves a badge image is renderable; the emitted badge must pass it.scripts/sync/verify_upstream_parity.sh— the upstream enumeration and URL normaliser this engine follows.docs/guides/deepwiki_badge.md— the consumer-facing guide.
2026-12-05 — bash scripts/deepwiki/test_deepwiki.sh → test_deepwiki: PASS 62/62 cases 0 failed.
Live probe against mcp.deepwiki.com returned state=INDEXED for HelixDevelopment/constitution and
state=NOT_INDEXED exit=1 for a fabricated repository.