@getcorespec/specguard
v0.0.3
Published
PR gating for spec coverage — checks that code changes have associated specs
Maintainers
Readme
Quickstart
Install specguard:
npm install -g @getcorespec/specguardCheck spec coverage on a PR:
specguard check
Setup
specguard uses the Vercel AI SDK — any supported provider works. Set the API key for your chosen provider:
# Anthropic (default)
export ANTHROPIC_API_KEY=sk-ant-...
# OpenAI
export OPENAI_API_KEY=sk-...Override the default model (claude-haiku-4-5) via CLI flag or config file:
specguard check --model anthropic/claude-sonnet-4-20250514Or create a .specguard.yml:
model: anthropic/claude-sonnet-4-20250514
threshold: 0.7Pre-commit hook
Run specguard automatically before every commit to catch unspec'd changes early.
Install the hook (one-time setup per repo):
specguard hook installThis writes a .git/hooks/pre-commit script that runs specguard check --staged against your staged changes. If spec coverage is below the threshold, the commit is blocked.
To install manually, create .git/hooks/pre-commit:
#!/bin/sh
npx specguard check --stagedThen make it executable:
chmod +x .git/hooks/pre-commitTo overwrite an existing pre-commit hook:
specguard hook install --forceTo remove the hook, delete .git/hooks/pre-commit.
Note: The pre-commit hook uses
npx specguard, so you don't need specguard installed globally — it will be fetched from npm if needed. For faster local commits, install specguard globally:npm install -g @getcorespec/specguard.
GitHub Action
Add specguard to your CI pipeline. Set your LLM provider's API key as a repository secret:
# .github/workflows/specguard.yml
name: specguard
on: [pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: getcorespec/corespec/packages/specguard@main
with:
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}See it in action: demo PR with specguard failing unspec'd code

Local LLMs
You can use any OpenAI-compatible local endpoint (e.g. Ollama, LM Studio) or a self-hosted Anthropic endpoint by setting baseURL in your config file:
# .specguard.yml
model: openai/llama3.2
baseURL: http://localhost:11434/v1For Ollama, start the server and pull a model first:
ollama serve
ollama pull llama3.2Note:
baseURLis intentionally config-file-only (not a CLI flag) to keep model configuration consolidated. All model settings (model,baseURL, and future options like temperature) live in.specguard.yml.
