Automation
Code Intelligence in Your Pipeline
GitHub Actions, GitLab CI, webhooks, and quality gates. Automate code intelligence in your CI/CD workflow.
Key Features
GitHub Actions and GitLab CI templates
Webhook API for event-driven index refresh
Quality gates with configurable thresholds
Daemon mode for always-on service
Pre-commit hooks for local validation
SARIF output for security dashboards
GitHub Actions
# .github/workflows/ckb.yml
name: CKB Analysis
on:
pull_request:
branches: [main]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for accurate analysis
- name: Install CKB
run: npm install -g @tastehub/ckb
- name: Run impact analysis
run: |
ckb index .
ckb impact diff origin/main..HEAD --format=markdown >> $GITHUB_STEP_SUMMARY
- name: Check for secrets
run: ckb scan-secrets --fail-on=high
- name: Run affected tests only
run: |
TESTS=$(ckb affected-tests --format=list)
if [ -n "$TESTS" ]; then
npm test -- $TESTS
fiGitLab CI
# .gitlab-ci.yml
ckb-analysis:
stage: test
image: node:20
before_script:
- npm install -g @tastehub/ckb
- ckb index .
script:
- ckb impact diff $CI_MERGE_REQUEST_DIFF_BASE_SHA
- ckb scan-secrets --format=sarif > gl-sast-report.json
artifacts:
reports:
sast: gl-sast-report.json
rules:
- if: $CI_MERGE_REQUEST_IDQuality Gates
Block merges when risk thresholds are exceeded. Configure gates in your ckb.toml or via CLI flags.
Configuration
# ckb.toml [quality-gates] max-risk-score = 70 max-blast-radius = 20 require-tests-for-new-code = true block-on-secrets = true
CI Output
$ ckb gate check Quality Gate: FAILED ✗ Risk score: 85 (max: 70) ✓ Blast radius: 12 (max: 20) ✗ Missing tests for new code ✓ No secrets detected Exit code: 1
Daemon Mode
Run CKB as a background service for instant queries. Auto-updates index on file changes.
# Start daemon $ ckb serve --daemon --port=9876 CKB daemon started on :9876 Watching for file changes... # Query via HTTP $ curl localhost:9876/api/search?q=UserService # Or via CLI (auto-connects to daemon) $ ckb search UserService Using daemon at localhost:9876 (0.02s) # Webhook for CI integration $ curl -X POST localhost:9876/api/webhook/refresh Index refreshed in 1.3s
MCP Tools
getStatusCheck index status and health
ckb statusexpandToolsetConfigure which tools are available
ckb config toolset --preset=ciAutomate code intelligence
Integrate CKB into your pipeline in under 5 minutes.