CLI and agents
Run the same contract check from a terminal, in CI, or from an AI agent.
Documentation pages
The analysis behind the editor is also available outside it, with the same results and
a versioned JSON report (schema 1.0).
CLI
openapi-guard [workspace] [--spec <path>]... [--format json]
- Without
--spec, every contract found in the workspace is analyzed; repeat--specto choose several. - Exit code
0means no drift,1means drift was found, and2means the analysis could not run: for example no contract was found, or a--specfile cannot be parsed. (Found contracts that cannot be parsed are skipped while another can be analyzed.) --include,--exclude, and--implementation-path-prefixmatch the settings of the same names.
Where source could not be analyzed (for example AWS Lambda dispatch through a custom
router), the report lists each place under limitations, with its reason and
location; operations such places could serve are not reported missing. The text
output prints them after the result.
The CLI ships with the extension and as the npm package @stackblender/openapi-guard.
AI agents
- In VS Code agent mode, reference
#checkOpenApiContractto have the agent check the open workspace. The result is paged JSON; the tool changes nothing. - The package also provides
openapi-guard-mcp, a local MCP server exposing the same check ascheck_openapi_contract.
None of these make network requests.