npx githits@latest unless you are inside an MCP config that already uses the JSON command form.
This reference covers githits 0.40.1. Use npx githits@latest --version to check the version you are running.
For package, GitHub, GitLab.com, Codeberg, Launchpad, and Googlesource addressing, see target syntax. Pass known targets directly to search and navigation commands; use resolve for a dependency name or a mutable Launchpad default.
Global options
Global options can appear before any command.Setup and configuration
npx githits@latest init
Authenticate and configure GitHits for supported AI coding tools.
npx githits@latest init
Authenticate and configure GitHits for supported AI coding tools.
init runs the browser login flow first, then auto-detects which supported tools are installed and writes MCP configuration for each one.init performs a guided MCP setup: alongside the MCP server config, it drops the four GitHits Agent Skills (githits-onboarding, githits-mcp, githits-code, and githits-package) and a managed instruction block (delimited by <!-- githits --> markers in files like AGENTS.md, CLAUDE.md, or GEMINI.md) into each selected tool. The skills and instructions help the agent decide when to reach for GitHits without bloating its base context. Rerunning guided init repairs any missing skill files. Interactive setup, --yes, and staged --install-agents all default to guided MCP unless --no-guidance is passed. Pass --no-guidance for a plain MCP-only install.After init completes, each detected tool is configured to start the GitHits MCP server automatically. No further manual configuration is needed.Flags--no-guidance is set.--detect-agents. Defaults to guided MCP unless --no-guidance is set.npx githits@latest uninstall
Remove GitHits MCP configuration and guidance from detected coding tools.
npx githits@latest uninstall
Remove GitHits MCP configuration and guidance from detected coding tools.
<!-- githits --> markers) is removed from files like AGENTS.md, CLAUDE.md, and GEMINI.md, and all four GitHits skills (githits-code, githits-mcp, githits-onboarding, and githits-package) are deleted from tool-native and shared skill folders, including stale copies left by earlier versions. Unrelated skills and directories are preserved. Stored credentials are preserved — only MCP config, guidance blocks, and skill files are removed.uninstall first asks whether to remove user-level or project-level configuration. githits init uninstall remains supported as a compatibility alias with the same flags and behavior.Flags--project for non-interactive project-level removal.npx githits@latest logout separately after uninstalling.Authentication
npx githits@latest login
Log in to your GitHits account with browser OAuth.
npx githits@latest login
Log in to your GitHits account with browser OAuth.
--port and an SSH tunnel.npx githits@latest logout
Remove stored OAuth credentials from this machine.
npx githits@latest logout
Remove stored OAuth credentials from this machine.
npx githits@latest auth status
Check the current authentication status and credential source.
npx githits@latest auth status
Check the current authentication status and credential source.
GITHITS_API_TOKEN is set in your environment, the command reports that source without reading local OAuth storage. If the stored token is expired, GitHits attempts to refresh it before reporting.npx githits@latest auth token
Print the current bearer token for scripts and command substitution.
npx githits@latest auth token
Print the current bearer token for scripts and command substitution.
- If
GITHITS_API_TOKENis set, its value is printed as-is without reading local OAuth storage. - Otherwise, the stored OAuth token is read from the system keychain. If it is expired, GitHits refreshes it on demand and prints the new access token.
GITHITS_API_TOKEN nor stored OAuth credentials), the command exits non-zero with a clear message instead of starting an interactive login. This keeps automated scripts predictable — run npx githits@latest login once on the machine before relying on auth token.Scripting exampleUse command substitution to hand the current session token off to another tool:npx githits@latest settings
View and update account preferences, privacy, terms, and limits.
npx githits@latest settings
View and update account preferences, privacy, terms, and limits.
settings show print the full canonical settings object: preferences (default language, license mode, blocked license IDs), privacy and terms (marketing emails, Terms of Service acceptance state), and account limits.get, set, and clear subcommands to read or update individual settings using their public CLI names. Every mutation sends exactly one selective PATCH, so unrelated settings are never touched.Supported keysdefault-language-id and blocked-license-ids can be cleared. clear default-language-id unsets the default; clear blocked-license-ids replaces the list with an empty list.npx githits@latest settings get
Read one writable account setting.
npx githits@latest settings get
Read one writable account setting.
npx githits@latest settings set
Update one account setting.
npx githits@latest settings set
Update one account setting.
blocked-license-ids accepts one or more UUIDs and replaces the stored list atomically; all other keys take exactly one value.npx githits@latest settings clear
Clear the default language or blocked license IDs.
npx githits@latest settings clear
Clear the default language or blocked license IDs.
clear default-language-id sends an explicit null; clear blocked-license-ids replaces the list with an empty list.default-language-id or blocked-license-ids. Other keys cannot be cleared and must be updated with settings set.npx githits@latest settings terms
Show Terms of Service acceptance status.
npx githits@latest settings terms
Show Terms of Service acceptance status.
npx githits@latest settings terms accept
Accept the current Terms of Service.
npx githits@latest settings terms accept
Accept the current Terms of Service.
--yes for non-interactive use.ghi-* API tokens set via GITHITS_API_TOKEN. When acceptance succeeds on an OAuth session, GitHits force-refreshes the stored session so subsequent requests carry the updated terms claim. Static API tokens are not refreshed; their acceptance state is re-evaluated server-side on the next request.If acceptance succeeds but the OAuth refresh fails, the command reports the saved acceptance and asks you to run npx githits@latest login --force before retrying other commands.FlagsMCP server
npx githits@latest mcp
Show manual MCP setup instructions or start stdio mode in non-TTY contexts.
npx githits@latest mcp
Show manual MCP setup instructions or start stdio mode in non-TTY contexts.
npx githits@latest mcp start
Start the GitHits MCP server over stdio for coding tool configs.
npx githits@latest mcp start
Start the GitHits MCP server over stdio for coding tool configs.
Deterministic
Code
npx githits@latest list
List files and documentation in a package, repository, or hosted site.
npx githits@latest list
List files and documentation in a package, repository, or hosted site.
githits list, added in 0.23.0. Package and repository targets list source files, including repository documentation. Use an explicit site: target for hosted documentation; a package inventory does not combine its source tree with its hosted docs.[paths...]. --recursive traverses matched directories. Text output starts with a Sources: section, including the commit and known UTC commit date for repository snapshots. A Read files: or Read pages: line with the read template follows, then one path per line; directories end in /. An empty inventory prints No files. or No pages. instead, or No files available yet. while the source is still indexing. When more entries exist, a More results: footer shows the --after cursor. Follow the Read files: or Read pages: guidance or each JSON entry’s read action. For site pages, preserve the emitted site: target and target-relative page path as separate arguments.Flagssource or doc. Repeat for multiple types. Not accepted for site targets.production, test, benchmark, example, generated, fixture, build, or vendor. Repeat for multiple intents. Not accepted for site targets.nextCursor in JSON. Replay the same target, paths, filters, recursion, and limit with the cursor unchanged.0 to return immediately.Sources: section, read guidance, or spinner. Does not change JSON output.<nextCursor> with the exact value from the first response when hasMore is true. If the cursor is rejected, restart without --after and use the new result’s cursor.githits code files remains available for compatibility and is deprecated in its help. Its flags and output differ from list. githits docs list still browses a package’s combined hosted and repository documentation. MCP 0.24.0 replaces code_files and docs_list with list. Refresh local tool discovery after upgrading.npx githits@latest search
Search indexed package or repository code, docs, and symbols.
npx githits@latest search
Search indexed package or repository code, docs, and symbols.
searchRef and continuation guidance, pass it to npx githits@latest search-status. See search results and JSON migration for the 0.23.0 result fields.Flagsnpm:react@18.2.0, github:owner/repo@ref, and site:react.dev.docs, code, or symbol. Omit to let GitHits choose the best indexed sources.function, method, class, interface, module, or doc_section.production, test, benchmark, example, generated, fixture, build, or vendor.searchRef (0–120000, default 30000). Pass 0 to return immediately. Seconds values such as 30s are rejected; use --wait 30000 instead. When the response carries indexing-time estimates, GitHits suggests a longer follow-up wait up to the 120000 ms ceiling.npx githits@latest search-status
Poll a prior async indexed search by its searchRef.
npx githits@latest search-status
Poll a prior async indexed search by its searchRef.
npx githits@latest search using the searchRef returned in the initial response.0 to return immediately. Seconds values such as 30s are rejected. GitHits also uses indexing-time estimates from the initial search to suggest a longer wait, up to the 120000 ms ceiling.npx githits@latest read
Read an indexed source file, code symbol, or documentation section.
npx githits@latest read
Read an indexed source file, code symbol, or documentation section.
<target> <path> for a source file, an emitted <site-target> <path> for a hosted page, or a docsReadTarget/page ID alone for a documentation page. The CLI writes complete content to stdout without the MCP surface’s 150/300-line cap so you can pipe it into other tools. Repository documentation resolves to indexed file content with snapshot identity; hosted documentation reads current indexed page content.list, with an optional --selector <heading-id>.Since githits 0.22.0, --selector reads an indexed code symbol or a documentation heading by its logical ID. A code symbol read returns the symbol’s definition range. An optional <path> restricts symbol lookup to that exact file. When a symbol selection is ambiguous, missing, or unsupported by the indexed snapshot, the CLI prints a typed AMBIGUOUS, NOT_FOUND, or SNAPSHOT_UNSUPPORTED outcome with candidates, suggestions, or an exact-path workaround. See the read tool for details.npx githits@latest code read and npx githits@latest docs read remain available as deprecated commands with their existing flags. Use read for site paths, compact symbol targets, and --selector.120-200, 120-, or -200. From 0.38.0, --lines 120 reads exactly one line. You can also append :120-200 to the file path.createApplication or expressjson. The path is optional for code symbols. Do not combine with a docs URL fragment. With --repo-url, pass at most one positional path; the CLI rejects an extra path. Added in 0.22.0.--start/--end as an alternative to --lines.--start/--end as an alternative to --lines.npx githits@latest grep
Grep packages, repositories, and hosted documentation in one page.
npx githits@latest grep
Grep packages, repositories, and hosted documentation in one page.
site: hosted-documentation targets with githits grep, added in 0.24.0. GitHits returns one page of matches across all targets. Use it when you know the exact string or pattern and want matches from both source and documentation. Matching runs against indexed content, not local files.code grep:- Patterns are 1–200 UTF-8 bytes and use RE2 regex. Pass
-Ffor literal matching.foo|barmatches either alternative;foo\|barmatches a literal pipe. Lookaround and backreferences are unsupported. Content-index searches require literal text in the pattern; a single exact-file route accepts anchorless regex, but a path selector alone does not guarantee that route. - Matching is case-sensitive. Pass
-ito ignore case. - Output has zero context lines. Pass
-A,-B, or-Cto add context. - Repository targets search all indexed files, source and documentation.
--corpus and path filters. --corpus source therefore does not exclude a package’s hosted docs. Path flags and --corpus apply to every package and repository operand. site: operands accept only the target, so source flags with only site: operands fail. Put -- before a pattern that starts with a dash.Text output starts with an outcome headline, such as Found 4 matches on 3 lines in 2 files., and a Sources: section naming the resolved scopes. Targets still indexing appear under Preparing:. Matches are grouped under numbered [1], [2] file or page headers. Each header begins with a copyable read locator you can pass to read with --lines. Match rows use : after the line number and context rows use -. After the matches, footers appear in a fixed order: Read: with the read templates, More results: with the --cursor value, and Follow-up: with a --wait retry for omitted targets.--json for the detailed lossless page, including read actions and byte coordinates.Flags-s to suppress errors. The last case flag wins.-A and -B override their side regardless of order. Use read for more context.-m, this is not a per-file limit.0 to return immediately. Continuation pages never wait.more available and the output ends with a ready-to-copy --cursor value. Rerun the same command with that flag to fetch the next page. A small --limit can fill the page before every scope is searched. GitHits then lists those scopes as not visited in this page, and the cursor continues into them. If the cursor expires, restart without --cursor.Path and source noticesSince 0.36.0, when a path selector wrongly includes the package path prefix, text output shows a compact warning such as Warning: Path is prefixed with package path "drizzle-orm". Did you mean "src/pg-core"?. Matches, failures, and cursors are unchanged, and the CLI does not retry automatically. --json output adds a pathWarnings array with the same strings, empty when there are no warnings.When GitHits cannot confirm that a package version matches the served source revision, the Source: line says so inline, for example (commit 5c71d2a, match to guava-testlib@33.4.0-jre unconfirmed). Targets still preparing use Selected source:. An unconfirmed match is not a claim about the published binary. See package source correspondence.githits code grep remains available with its existing literal, case-insensitive defaults. MCP 0.25.0 replaces code_grep with grep, using the same matching defaults as top-level CLI grep. Refresh tool discovery and migrate arguments.npx githits@latest code grep
Legacy single-target source grep; prefer npx githits@latest grep.
npx githits@latest code grep
Legacy single-target source grep; prefer npx githits@latest grep.
githits grep, which searches multiple targets and hosted documentation in one page.npx githits@latest code files
Legacy file inventory; prefer npx githits@latest list.
npx githits@latest code files
Legacy file inventory; prefer npx githits@latest list.
list for new inventory workflows. This command keeps its existing flags and output for compatibility; it is not a flag-compatible alias for list.List the files included in an indexed package or repository.npx githits@latest code read
Deprecated alias for npx githits@latest read on a source file.
npx githits@latest code read
Deprecated alias for npx githits@latest read on a source file.
githits 0.17.0, this command is a deprecated alias for npx githits@latest read. Behavior and flags are unchanged; prefer the unified command in new scripts.120-200, or a single line with --lines 120 (from 0.38.0). You can also append :120-200 to the file path.npx githits@latest code diff
Compare repository trees resolved from two package versions or refs.
npx githits@latest code diff
Compare repository trees resolved from two package versions or refs.
RAW_DIFF_UNAVAILABLE. Refs resolving to the same commit return an empty inventory. See source diff.<from>..<to> range.-- to narrow paths without changing scope. Three-dot merge-base syntax and --git-ref are rejected.Since 0.36.0, when GitHits cannot confirm that a package version matches its source revision, stderr includes a From source: or To source: line for that side, such as From source: github:google/guava@v33.4.0 (commit 5c71d2a, match to guava-testlib@33.4.0-jre unconfirmed). An unconfirmed match is not a claim about the published binary. --json keeps the source assessments. See package source correspondence.Empty authoritative diffs and caller-selected truncations exit 0 with warnings on stderr. Unexpectedly incomplete plain patches are suppressed and exit 1; the --stat, --name-only, --name-status, and JSON views preserve their structured partial results.Documentation
Usesearch --source docs to find documentation by topic, then list or read pages with these commands.
npx githits@latest docs list
List hosted and repo-backed documentation pages for a package.
npx githits@latest docs list
List hosted and repo-backed documentation pages for a package.
@version; Go module versions are accepted with or without the leading v.Each entry provides read guidance using the page’s docsReadTarget. JSON output retains the docsReadTarget, the stable pageId, and the provenance sourceUrl for every page. For a standalone hosted site, use list with a site: target.npx githits@latest docs read
Deprecated alias for npx githits@latest read on a documentation page.
npx githits@latest docs read
Deprecated alias for npx githits@latest read on a documentation page.
docsReadTarget URL emitted by docs list and search results; historical page IDs remain accepted. URL targets resolve only already-indexed documentation and never enqueue crawling.Since githits 0.17.0, this command is a deprecated alias for npx githits@latest read. Behavior and flags are unchanged; prefer the unified command in new scripts.Package Intelligence
From 0.32.0, package targets acceptcargo: as an alias for public crates.io crates:, such as cargo:serde. Canonical registry identities remain crates.
npx githits@latest pkg info
Inspect package metadata, popularity, downloads, and vulnerability status.
npx githits@latest pkg info
Inspect package metadata, popularity, downloads, and vulnerability status.
registryLatestDifference.npx githits@latest pkg vulns
List known CVE and OSV advisories for a package or version.
npx githits@latest pkg vulns
List known CVE and OSV advisories for a package or version.
v (go:golang.org/x/crypto@0.17.0 or @v0.17.0).affected (default), non_affecting, unknown (could not be evaluated), or all. Unknown scope is available from 0.31.0 and includes assessment reasons. Summary counts cover all scopes.--severity and --scope apply to direct and transitive rows.vulns <id> --verbose.--details.npx githits@latest vulns
Look up CVE, OSV, or GHSA IDs and the packages they affect.
npx githits@latest vulns
Look up CVE, OSV, or GHSA IDs and the packages they affect.
pkg vulns instead.githits login when authentication is required.Flags--json.packages), shared source records (sources), acquisition coverage, and diagnostics with retryability and recovery actions. Compact JSON caps normalized affected ranges at ten per package and reports omissions; combine with --verbose for original source detail. affectedRanges and sourceFixVersions are independent lists and are not index-aligned.npx githits@latest pkg deps
Show direct dependencies and optional transitive dependency details.
npx githits@latest pkg deps
Show direct dependencies and optional transitive dependency details.
v.--verbose for complete issue details.npx githits@latest pkg changelog
Retrieve release notes and changelog entries for a package.
npx githits@latest pkg changelog
Retrieve release notes and changelog entries for a package.
--repo-url, and --git-ref are rejected. Use the published package target. Results preserve backend and source order, which may interleave maintained release lines. Do not assume newest-first ordering. From 0.30.0, default text and JSON contain parsed statements with available classifications and sources.--to or latest. Range mode has no count cap and cannot be combined with --limit. Go module versions are accepted with or without the leading v.--from is set. Do not repeat a bound already supplied in the positional target.--from.actionable, important (actionable plus “should know”), or all. Includes uncertain classifications in the selected tiers. Ignored with --verbatim or --no-body.--verbatim --json for original Markdown bodies. Cannot be combined with --no-body.--verbatim or --verbose.npx githits@latest pkg upgrade-review
Compare package versions with security, changelog, and dependency changes.
npx githits@latest pkg upgrade-review
Compare package versions with security, changelog, and dependency changes.
.. as the range delimiter for the positional range and for repeatable --package entries. The legacy -> delimiter is rejected with guidance to switch to ... A positional range already contains its target, so combining it with --to or --package is rejected. Go module versions are accepted with or without the leading v.Text output includes all matching release-note statements in release/source order, with available classifications, uncertainty markers, and changelog coverage. Batch output ranks packages by confident action count across the whole version range. Direct security summaries retain unknown vulnerability counts from 0.31.0. From 0.37.0, detailed reports and compact batch rows link to available migration guides, and JSON keeps them in migrationGuides. The classifications are evidence, not a safety verdict. See Package Intelligence for the JSON fields.Flags<registry>:<name>@<current>..<target> format. Repeat the flag for multiple packages, up to 30 per batch.actionable, important (actionable plus “should know”), or all. Omit for the default focused view, which includes actionable, “should know”, and too-long-to-classify statements. Do not pass focused explicitly. Batch triage and coverage still include the whole version range.Target resolution
resolve is available by default from 0.27.0. See Target resolution for MCP parameters and guidance on choosing a result.
npx githits@latest resolve
Rank canonical package, repository, or documentation-site targets for a fuzzy name.
npx githits@latest resolve
Rank canonical package, repository, or documentation-site targets for a fuzzy name.
npm:express, github:openai/codex, or site:docs.example.com/sdk. Use it before calling another GitHits command when the input is not already canonical. Already-canonical package, repository, and site targets are rejected locally with INVALID_ARGUMENT guidance; pass them directly to the next GitHits command instead.From 0.33.0, mutable Launchpad defaults such as lp:project can resolve to their current canonical repository. Complete owner-qualified Launchpad targets go directly to the next command. See Launchpad targets.EXACT or HIGH confidence, and its latest-version malicious-content status is clear or not_applicable. For MEDIUM, LOW, or ambiguous results, narrow the input or explicitly choose a candidate.Affected or uncertain malicious-content decisions render a warning that links the relevant MAL-* advisories on OSV and suppress the automatic next-command suggestion. See malicious-content gating for the status meanings.Flags{best?, ambiguous, ambiguousReason?, candidates, protectedMatches}. best is absent whenever there are no candidates.1 when there are no candidates because the command did not resolve a target.Agentic
npx githits@latest example
Find implementation examples from real open-source usage.
npx githits@latest example
Find implementation examples from real open-source usage.
--lang.strict (default), yolo, or custom.result and, when available, solution_id.npx githits@latest research
Answer a question about a public package or repository with cited sources.
npx githits@latest research
Answer a question about a public package or repository with cited sources.
site: targets; Research covers both code and documentation. Available by default from 0.31.0, with no experimental opt-in.<threadId> with the UUID returned by an earlier answer. Do not combine an explicit target with --thread. If GitHits returns target candidates, repeat the question with a selected canonical target. A clarification exits successfully and has no answer or thread ID.The CLI prints the answer with cited sources and follow-up guidance. Use the returned thread ID to continue the conversation. By default, source citations are copyable npx githits@latest read commands.Flagsread commands (cli) or upstream links (url).display_markdown containing the answer or target clarification, plus optional tool_call_id (run ID) and thread_id (for follow-ups). Target clarifications omit both IDs.research and example show live stages in interactive terminals without changing JSON or piped output. See Research for progress, thread, rate-limit, and MCP behavior.