Skip to content

ci: add CI pipeline; fix 18 dependency advisories, broken fresh installs, OCR cache - #18

Merged
willynikes2 merged 5 commits into
masterfrom
chore/ci-pipeline
Oct 4, 2026
Merged

willynikes2 merged 5 commits into
masterfrom
chore/ci-pipeline

Conversation

@willynikes2

Copy link
Copy Markdown
Owner

Summary

Adds a CI pipeline and fixes what it found.

CI (.github/workflows/ci.yml, codeql.yml)

Job What it checks
Tests npm test on Node 20, 22 and 24 (Linux) plus Node 22 (macOS). engines says >=20, so the floor is tested too
OCR integration Real, unstubbed Tesseract on a fixture image
Package smoke test npm pack, then installs the tarball into an empty project the way a user would (dependency ranges, not our lockfile) and drives the installed bins: kb mcp handshake, tool list, clean exit on disconnect, the bus CLIs, and kb start with API-key and OAuth rejection, OAuth discovery, and ingest → search
Dependency audit npm audit --omit=dev --audit-level=moderate and npm audit signatures
CodeQL security-extended JavaScript analysis

Fixes

  • Fresh installs were broken. better-auth@^1.5.5 let new installs resolve 1.7.x, which moved the mcp plugin out of core, so kb start crashed on import. Pinned to ~1.6.33, which keeps the API and is past 1.6.22, the version that fixes every better-auth advisory. The package smoke job caught this; unit tests can't see it.
  • 18 production advisories (3 critical, 10 high) → 0. Includes tar, protobufjs and better-auth. @huggingface/transformers 3.8 → 4.3 for a patched sharp. Embeddings are unchanged: the same inputs give cosine 1.00000000 (max diff 1.5e-7) between versions, so stored vectors stay compatible.
  • OCR left a 5 MB eng.traineddata in the working directory. Tesseract cached its model in whatever directory the server ran from. It now caches in ~/.knowledge-base/tesseract, and a regression test checks that nothing is written to the cwd.

Testing

  • npm test: 128/128 on Node 20.20, 22.22 and 24.21 locally
  • KB_TEST_OCR=1: the real OCR test fails before the cache fix and passes after
  • Package smoke test passes against a fresh tarball install. Before the pin it failed with does not provide an export named 'mcp'
  • npm audit --omit=dev: 0 vulnerabilities. npm audit signatures: 284/284 verified

🤖 Generated with Claude Code

willynikes2 and others added 4 commits October 4, 2026 21:47
`npm audit --omit=dev` reported 18 advisories (3 critical, 10 high),
including tar, protobufjs and better-auth.

- `npm audit fix` and `npm update express` (4.22.1 -> 4.22.3) for the 16
  non-breaking ones; express 4.22.1 pinned a vulnerable qs.
- @huggingface/transformers ^3.8.1 -> ^4.3.0 to pick up a patched sharp
  (libvips CVE-2026-33327 and others). Embeddings are unchanged: the
  same inputs give cosine 1.00000000 (max |diff| 1.5e-7) between 3.8.1
  and 4.3.0, so existing stored vectors stay compatible.

`npm audit --omit=dev` now reports 0 vulnerabilities. node --test 128/128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he cwd

tesseract.js writes `eng.traineddata` (5 MB) to `cachePath || '.'`, so
every OCR run left the model in whatever directory the server ran from,
including users' projects when run via npx. Cache it in
~/.knowledge-base/tesseract instead.

Adds a real (unstubbed) OCR test against a fixture image that checks the
extracted text and that nothing is written to the cwd. It downloads the
model, so it only runs with KB_TEST_OCR=1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
better-auth 1.7.0 moved the `mcp` plugin and the OAuth discovery helpers
out of core (into @better-auth/mcp), so `kb start` crashes on import:

  The requested module 'better-auth/plugins' does not provide an export
  named 'mcp'

The `^1.5.5` range let fresh installs (npx, or installs that ignore our
lockfile) resolve 1.7.x, so new users already got a broken HTTP server,
and the previous commit's audit fix pulled 1.7.7 into the lockfile too.
Unit tests don't boot the server, so nothing caught it.

1.6.33 keeps the current API and is past 1.6.22, the version that fixes
every better-auth advisory. Pin to ~1.6.33. Migrating to @better-auth/mcp
is a separate change.

Verified: npm audit --omit=dev reports 0 vulnerabilities; `kb start`
boots; OAuth discovery returns 200.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Tests: `npm test` on Node 20/22/24 (Linux) and Node 22 (macOS).
  `engines` claims >=20, so the floor is tested too.
- OCR: real, unstubbed Tesseract run against a fixture image.
- Package smoke: `npm pack`, install the tarball into an empty project
  (resolving dependency ranges the way users do, not our lockfile), then
  drive the installed bins: `kb mcp` handshake + tools/list + clean exit,
  bus-send/bus-inbox round trip, and `kb start` with API key and OAuth
  rejection, OAuth discovery, and ingest -> search. This is what caught
  the better-auth 1.7 crash.
- Audit: `npm audit --omit=dev --audit-level=moderate` and
  `npm audit signatures`.
- CodeQL security-extended analysis.

Least-privilege permissions, no untrusted inputs in run steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@willynikes2
willynikes2 merged commit 34bf2d2 into master Oct 4, 2026
9 checks passed
@willynikes2
willynikes2 deleted the chore/ci-pipeline branch October 4, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants