{{ theme.skipToContentLabel || 'Skip to content' }}

Validate knowledge in CI ​

The pre-commit hook checks what each person commits. A CI job catches everything else: commits made with --no-verify, machines without kontext, and entries whose paths stopped matching after a refactoring.

GitHub Actions ​

yaml
# .github/workflows/knowledge.yml
name: knowledge
on:
  pull_request:
    paths: [".ai/**", "docs/adr/**"]

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install kontext
        run: curl -fsSL https://raw.githubusercontent.com/SemanS/kontext/main/scripts/install.sh | sh
      - name: Validate entries and scan for secrets
        run: ~/.local/bin/kontext check

kontext check exits with status 1 on errors (missing titles, unknown kinds, duplicate ids, high-confidence secrets) and prints warnings without failing.

Pin a version for reproducible builds:

yaml
        run: curl -fsSL https://raw.githubusercontent.com/SemanS/kontext/main/scripts/install.sh | KONTEXT_VERSION=v0.1.1 sh

Other CI systems ​

Any runner with git works:

sh
curl -fsSL https://raw.githubusercontent.com/SemanS/kontext/main/scripts/install.sh | sh
~/.local/bin/kontext check

Useful additions ​

  • kontext log --json produces a machine-readable decision timeline, e.g. for a docs site.
  • kontext check also scans knowledge for secrets; set secrets.scan = "staged" locally if you want the hook to scan every staged file.

Released under the MIT or Apache-2.0 license.