Skip to content

CLI Reference

Commands

gitinspect inspect [flags] <repo-path-or-url>   Inspect a repository
gitinspect serve [flags]                          Start HTTP server
gitinspect mcp                                     Start MCP server (for AI agents)

gitinspect inspect

Inspect a Git repository and output a structured snapshot.

Flags

FlagDefaultDescription
--formatjsonOutput format: json, text, yaml
--max-tokens6000Maximum token budget
--max-files0Maximum number of files (0 = unlimited)
--include(none)Include glob patterns (repeatable)
--exclude(none)Exclude glob patterns (repeatable)
--stripfalseStrip comments and blank lines
--no-cachefalseDisable cache
--quietfalseSuppress progress output to stderr
--max-concurrent4Maximum concurrent remote fetches

Exit Codes

CodeMeaning
0Success
1Runtime error (repo not found, clone failed, etc.)
2Usage error (missing arguments, invalid flags)

Examples

bash
# Basic inspection
gitinspect inspect .

# Remote repository
gitinspect inspect https://github.com/user/repo.git

# Text output with comment stripping
gitinspect inspect --format text --strip .

# Only Go files, exclude vendor
gitinspect inspect --include "**/*.go" --exclude "**/vendor/*" .

# Limit to 4000 tokens
gitinspect inspect --max-tokens 4000 /path/to/repo

# Quiet mode (for scripting)
gitinspect inspect --quiet --format json . > snapshot.json

gitinspect serve

Start an HTTP server with a POST /inspect endpoint.

Flags

FlagDefaultDescription
--port8080HTTP server port
--api-key(none)API key for HTTP server authentication
--max-concurrent4Maximum concurrent remote fetches

Request Body

json
{
  "repo": "https://github.com/user/repo.git",
  "format": "json",
  "max_tokens": 6000,
  "max_files": 0,
  "include": [],
  "exclude": [],
  "strip": false,
  "no_cache": false
}

Example

bash
# Start server
gitinspect serve --port 8080

# Start server with API key authentication
gitinspect serve --port 8080 --api-key my-secret-key

# Start server with increased concurrency
gitinspect serve --port 8080 --max-concurrent 8

# Call the endpoint (with auth)
curl -X POST -H "Content-Type: application/json" \
  -H "Authorization: Bearer my-secret-key" \
  -d '{"repo": "https://github.com/user/repo.git"}' \
  http://localhost:8080/inspect

gitinspect mcp

Start an MCP server over stdio for AI agent integration. See MCP Server for details.

bash
gitinspect mcp

Released under the Apache-2.0 License.