Installation
DocGuard is a Node.js command-line tool. It is published as docguard-cli on npm and PyPI. The command it installs is docguard. Every channel on this page runs the same CLI. The channels differ in how the CLI reaches your machine and how you pin its version.
In the examples, replace X.Y.Z with a release version. To find the latest version, run npm view docguard-cli version or open the releases page.
Choose a channel
| Channel | Command | Needs | Use it for |
|---|---|---|---|
| npx | npx docguard-cli@X.Y.Z guard | Node.js | Trying it, single runs, CI |
| npm, global | npm i -g docguard-cli | Node.js | Daily use on your machine |
| npm, project | npm i -D -E docguard-cli@X.Y.Z | Node.js | A version pinned in the repository |
| PyPI | pipx install docguard-cli | Python 3.8+ and Node.js | Python-first toolchains |
| Homebrew | brew install raccioly/tap/docguard | Homebrew | macOS and Linux workstations |
| Docker | docker run -i --rm -v "$PWD":/workspace ghcr.io/raccioly/docguard:X.Y.Z | Docker | The MCP server without a local Node.js |
| GitHub Action | uses: raccioly/docguard@vX.Y.Z | GitHub Actions | Pull request gates |
| pre-commit | repo: https://github.com/raccioly/docguard | pre-commit | Commit and push hooks |
| Spec Kit extension | docguard init | Spec Kit 0.11.2+ | Spec Kit projects |
| Claude Desktop | docguard-vX.Y.Z.mcpb | Claude Desktop | Using the MCP tools in Claude Desktop |
| Offline | pre-filled npm cache | Node.js | Machines with no registry access |
Requirements
| Requirement | Needed for | Without it |
|---|---|---|
| Node.js 18 or later | Everything. package.json declares "engines": { "node": ">=18.0.0" }. We test releases on Node.js 18, 20, 22 and 24. | Nothing runs. The PyPI wrapper and the Homebrew formula still need Node.js. |
git | Checks and commands that read history: freshness, diff --since, specs require, specs complete, reconcile. | DocGuard treats the project as having no Git history. Those checks do not run. In CI, clone with full history (fetch-depth: 0). |
python3 (or python) | Reading Python projects with Python’s own syntax tree. | A pattern fallback reads Python routes, models and settings. DocGuard marks the results partial (parserTier, confidence: low). See Languages and Frameworks. |
@babel/parser | Reading JavaScript and TypeScript with a syntax tree. It is DocGuard’s only runtime dependency. It is pinned to an exact version and installed with the package. | The CLI still starts. JavaScript and TypeScript fall back to the regex tier. This happens only when the dependency is missing, for example when you run an unpacked tarball. |
DocGuard runs no install scripts. npm i -g docguard-cli --ignore-scripts therefore works the same as a plain install.
Network use
Validation runs locally and makes no network calls. You need the network only to download DocGuard, and for the few commands that use it when you ask: docguard upgrade, upgrade --pr, impact --prs and feedback. The full list is in PRIVACY.md.
npm
Run with npx
npx docguard-cli@X.Y.Z demo # sample project, no setup
npx docguard-cli@X.Y.Z diagnose # your project
Without a version, npx uses the copy installed in the project, if there is one. Otherwise it gets the package from the registry. Pin a version wherever the result must be the same every time, such as CI, scripts and agent configuration.
Install globally with npm
npm install -g docguard-cli
docguard --version
Add it to a project with npm
This pins the version in package.json and the lockfile. Every contributor and CI job then runs the same release:
npm install --save-dev --save-exact docguard-cli@X.Y.Z
Then call it from npm scripts:
{
"scripts": {
"guard": "docguard guard",
"score": "docguard score",
"lint:docs": "docguard ci --threshold 70"
}
}
npx docguard <command> also runs the project’s copy.
PyPI (pip, pipx, uv)
pipx install docguard-cli # isolated, recommended
uv tool install docguard-cli # or with uv
pip install docguard-cli # or into the current environment
uvx --from docguard-cli docguard --version # run once without installing
The PyPI package is a thin Python wrapper (docguard_cli/wrapper.py). It contains no copy of DocGuard and has no Python dependencies. The docguard command that it installs does these steps:
- It looks for Node.js 18 or later on
PATH(node,node18,node20,node22). If it finds none, it prints how to install Node.js and exits 1. - It looks for
node_modules/docguard-cli/cli/docguard.mjsin the current directory and each parent. If it finds the file, it runs that copy withnode. The project pins this copy, and it works offline. - Otherwise it runs
npx -y docguard-cli@latest. It passes on every argument and the exit code.
The PyPI version does not pin the CLI version. Outside a project that has docguard-cli in node_modules, the wrapper always runs the latest npm release, and the first run needs the network. To pin the version, add docguard-cli to the project with npm (above). The wrapper then runs that copy.
Homebrew
brew install raccioly/tap/docguard
docguard --version
The formula is in the raccioly/homebrew-tap repository. It installs the npm package from the npm registry, pinned by SHA-256, and depends on Homebrew’s node. The release workflow updates it after each npm publish, from the published tarball. First, the workflow checks that tarball against the integrity value that npm recorded. The source template is packaging/homebrew/docguard.rb.
Docker (GHCR)
The container image runs the MCP server. It needs no local Node.js. The image is public, so you do not need to authenticate to pull it.
docker run -i --rm -v "$PWD":/workspace ghcr.io/raccioly/docguard:X.Y.Z
| Property | Value |
|---|---|
| Image | ghcr.io/raccioly/docguard |
| Tags | The bare version (X.Y.Z, no v) and latest. Pin a version. |
| Platform | linux/amd64 only. On an arm64 host, Docker needs amd64 emulation (--platform linux/amd64). |
| Base | node:20-alpine |
| Entrypoint | node /app/cli/docguard.mjs mcp: the stdio MCP transport. stdout is the JSON-RPC channel, so send nothing else to it. |
| Working directory | /workspace. Mount the project there. |
| Writes | None. The server is read-only. |
| Not included | git and python3. History-based checks do not run, and Python is read by the pattern fallback. |
Tools inspect /workspace by default. A projectDir in a tool call must be /workspace or a directory inside it. To serve another mounted tree, add --root <dir> after the image name. The MCP Server reference describes the tools and the client setup.
The image is built for the MCP server. To run another command, replace the entrypoint. The limits in the table above apply:
docker run --rm -v "$PWD":/workspace --entrypoint node \
ghcr.io/raccioly/docguard:X.Y.Z /app/cli/docguard.mjs guard
For CI, use npx or the GitHub Action. Both run with git available.
To build the image yourself from a checkout, run docker build -t docguard-mcp .. It uses the repository’s Dockerfile.
GitHub Action
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: raccioly/docguard@vX.Y.Z
with:
command: guard
The action installs the docguard-cli version that it was released with. When you pin the action, you also pin the CLI. Continuous Integration covers its inputs, outputs, pull request feedback and the spec-first gate.
pre-commit framework
The repository is a pre-commit hook source (.pre-commit-hooks.yaml):
repos:
- repo: https://github.com/raccioly/docguard
rev: vX.Y.Z
hooks:
- id: docguard-guard # guard --changed-only on each commit
- id: docguard-guard-full # full guard on push
docguard-guard-full runs at the pre-push stage. It needs pre-commit 3.2 or later. Install the push hook once for each clone with pre-commit install --hook-type pre-push.
To install plain Git hooks without the pre-commit framework, use docguard init --with hooks.
Spec Kit extension
DocGuard ships a Spec Kit extension. It adds the speckit.docguard.* commands and the workflow hooks. It needs Spec Kit 0.11.2 or later, and node and npx on PATH.
Recommended: let docguard init register it. If the specify CLI is on PATH, docguard init initializes Spec Kit for your coding agent. It registers the extension copy that ships inside the installed npm package. That copy always has the same version as your CLI.
npm install -g docguard-cli
docguard init
To register it yourself, install it from the release archive or from a local copy:
# From the GitHub release (Spec Kit asks you to confirm the external source)
specify extension add docguard --from \
https://github.com/raccioly/docguard/releases/download/vX.Y.Z/spec-kit-docguard-vX.Y.Z.zip
# From the npm package already in the project
specify extension add ./node_modules/docguard-cli/extensions/spec-kit-docguard --dev
specify extension add docguard without --from does not install DocGuard on a default Spec Kit setup. DocGuard is in Spec Kit’s community catalog. Spec Kit uses that catalog for discovery only. It refuses to install from it and suggests --from <archive-url>. Someone updates the catalog entry by hand after each release, so it can be behind npm.
The Spec Kit guide covers what the extension adds and how to use it.
Claude Desktop (MCPB bundle)
Each GitHub release includes a Claude Desktop extension bundle, docguard-vX.Y.Z.mcpb.
- Download it from the latest release.
- In Claude Desktop, open Settings → Extensions and drag the file in.
- When Claude Desktop asks, choose the project folder that DocGuard should analyze.
The bundle contains the npm package and its one production dependency, so it downloads nothing from npm. Its tools are read-only. A tool call may pass a projectDir inside the chosen folder. The bundle refuses folders outside it. The bundle does not update itself. To upgrade, install the bundle from a newer release.
For Claude Code, Cursor and other MCP clients, register the server with a command instead, for example claude mcp add docguard -- npx -y docguard-cli@X.Y.Z mcp. See MCP Server and AI Integration.
Offline and air-gapped use
Validation never uses the network, so DocGuard works offline after you install it. Only the install step needs network access. Choose one of these methods:
Pre-filled npm cache (complete install). On a connected machine, install once into a dedicated cache. Then copy the cache directory to the offline machine and install from it:
# connected machine
npm install -g --cache ./docguard-npm-cache docguard-cli@X.Y.Z
# offline machine, after copying ./docguard-npm-cache
npm install -g --offline --cache ./docguard-npm-cache docguard-cli@X.Y.Z
docguard --version
Project-local copy. Install into a directory with npm install --prefix ./docguard-offline docguard-cli@X.Y.Z. Copy that directory. Run ./docguard-offline/node_modules/.bin/docguard.
Bare npm pack tarball (reduced tier). npm pack docguard-cli@X.Y.Z produces docguard-cli-X.Y.Z.tgz. After you unpack it, it runs with node package/cli/docguard.mjs. The tarball does not include @babel/parser, so the regex fallback reads JavaScript and TypeScript. If you install the tarball with npm install offline, the install fails, because npm must resolve @babel/parser and its own dependencies. Use the npm cache method for a complete offline install.
Other channels:
- PyPI wrapper: runs offline only when the project has
docguard-cliinnode_modules. Otherwise it callsnpx docguard-cli@latest, which needs the registry. - Docker: move the image with
docker saveanddocker load.
Guard’s text output, the MCP server and the context pack say so when your release is more than 14 days old. This note makes no network call. DocGuard compares the release date in its bundled CHANGELOG.md with your clock. Set DOCGUARD_NO_UPDATE_HINT=1 to turn it off.
Verify the installation
docguard --version # prints the installed version
docguard demo # runs guard against a built-in sample project
demo runs in a temporary directory and removes it afterward. It writes nothing to your project.
Upgrading
Upgrade through the channel you installed with:
| Channel | Command |
|---|---|
| npm, global | npm install -g docguard-cli@latest |
| npm, project | npm install --save-dev --save-exact docguard-cli@X.Y.Z |
| npx | Change the pinned version in your scripts or CI |
| pipx / uv / pip | pipx upgrade docguard-cli / uv tool upgrade docguard-cli / pip install --upgrade docguard-cli. This updates only the wrapper; see PyPI for which CLI it runs. |
| Homebrew | brew upgrade docguard |
| Docker | Pull and run the new tag |
| GitHub Action / pre-commit | Change @vX.Y.Z / rev: |
| Spec Kit extension | docguard upgrade --apply or docguard init re-registers it when its version differs from the CLI’s |
| Claude Desktop | Install the .mcpb from the newer release |
docguard upgrade reports whether a newer CLI exists. It contacts the npm registry. It also reports whether .docguard.json or the installed agent files are out of date. docguard upgrade --apply runs npm install -g docguard-cli@latest, migrates the configuration and refreshes the agent files. Use --apply for a global npm install. For other channels, upgrade the CLI as shown above. Then run docguard upgrade --apply to migrate the project. See Upgrading for release notes, baselines and configuration migration.
Uninstalling
| Channel | Command |
|---|---|
| npm, global | npm uninstall -g docguard-cli |
| npm, project | npm uninstall docguard-cli |
| pipx / uv / pip | pipx uninstall docguard-cli / uv tool uninstall docguard-cli / pip uninstall docguard-cli |
| Homebrew | brew uninstall docguard, then brew untap raccioly/tap if nothing else uses the tap |
| Docker | docker rmi ghcr.io/raccioly/docguard:X.Y.Z |
| Spec Kit extension | specify extension remove docguard |
| Claude Desktop | Remove the extension in Settings → Extensions |
Removing the CLI leaves your project files alone. They are plain files in your repository. Delete the ones you no longer want:
.docguard.json: configuration, written bydocguard init..docguard/: local state, such as fix history, score history and caches..docguard.baseline.json: written byguard --update-baseline..docguard-specs.json: the spec registry, written byspecs --write.- Agent skills and commands that
initinstalled. Coding Agents lists their paths. - Git hooks from
docguard init --with hooks. Remove DocGuard’s part withdocguard hooks --remove. It keeps any other commands in those hooks.
Supply chain
| Artifact | Built by | Verification |
|---|---|---|
| npm package | release.yml, publish-npm job, with npm Trusted Publishing (OIDC) | npm provenance attestation, generated automatically on publish. Check it with npm audit signatures in a project that installs it. |
| PyPI package | release.yml: built by build-pypi without credentials, published by publish-pypi with PyPI Trusted Publishing (OIDC) | PyPI attestations published by the publishing action. |
| Homebrew formula | release.yml, publish-homebrew job | Built from the published npm tarball after checking npm’s dist.integrity. The formula pins its SHA-256. |
| MCP registry listing | release.yml, publish-mcp-registry job, with GitHub OIDC (no stored secret) | The job checks that server.json and package.json of the tag agree, and verifies the pinned mcp-publisher with cosign. The registry checks that the npm package carries mcpName. |
| GHCR image | release.yml, publish-ghcr job, with the Docker CLI | The job checks that the image answers an MCP initialize before it pushes. The image is not signed and has no attestation. |
| Spec Kit ZIP, MCPB bundle | release.yml: built by build-extension and build-mcpb without credentials, attached by attach-assets | Attached to the GitHub release. No checksum file or attestation is published for them. |
| GitHub Action | action.yml at the release tag | The actions it uses are pinned to commit SHAs. Pin raccioly/docguard to a reviewed tag or commit. |
The npm and PyPI jobs authenticate with OIDC. DocGuard stores no long-lived registry token. DocGuard has one runtime dependency, @babel/parser, pinned to an exact version.