Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dependabot keeps npm dependencies, pinned GitHub Actions and the Docker base
# image up to date.
# Dependabot keeps npm and uv dependencies, pinned GitHub Actions and the Docker
# base images up to date.
# Action updates land as SHA bumps with the human-readable tag in a comment.
version: 2
updates:
Expand Down Expand Up @@ -39,6 +39,18 @@ updates:
actions-dependencies:
update-types: [minor, patch]

# The MCP server's own lockfile (mcp-server/uv.lock). The SDK is pinned
# exactly, so an SDK bump is a PR of its own and runs the protocol tests.
- package-ecosystem: uv
directory: /mcp-server
schedule:
interval: weekly
open-pull-requests-limit: 5
groups:
mcp-server-dependencies:
update-types: [minor, patch]
exclude-patterns: [mcp]

- package-ecosystem: github-actions
directory: /
schedule:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# typecheck — astro check (TypeScript / Astro type errors)
# build — headless build from the vendored fixture; uploads dist/
# e2e — Playwright: embedded web-fragment harness + standalone layer
# mcp — MCP server (mcp-server/, Python): ruff, mypy, import-linter, pytest, and an index of the real build
# image — docker build + container integration tests against real nginx + Trivy scan
# audit — npm dependency vulnerability gate

Expand Down Expand Up @@ -262,6 +263,38 @@ jobs:
path: playwright-report/
retention-days: 7

# ── 5b. MCP server (Python) ────────────────────────────────────────────────
# mcp-server/ is a self-contained uv project. Lint, types, layering and unit
# tests need nothing else; the last step indexes the real build from the
# `build` job, which is where a page manifest the indexer no longer accepts
# would show up.
mcp:
name: MCP server (Python)
runs-on: ubuntu-latest
needs: build
defaults:
run:
working-directory: mcp-server
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: true
cache-dependency-glob: mcp-server/uv.lock
- run: uv sync --locked --all-extras
- run: uv run ruff format --check .
- run: uv run ruff check .
- run: uv run mypy
- run: uv run lint-imports
- run: uv run pytest
- name: Download dist artifact
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ci-dist
path: dist
- name: Index the fixture build
run: uv run kb-mcp index --dist ../dist --out ../index.sqlite

# ── 6. Dependency audit ────────────────────────────────────────────────────
audit:
name: npm audit
Expand Down
16 changes: 16 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ anything there, rebuild, then run it.

`npm audit --omit=dev --audit-level=high` must also stay clean; it gates CI.

Touching `mcp-server/` (the Python MCP server)? From that directory, all five must
pass — CI's `mcp` job runs the same:

```bash
uv run ruff format --check . # format
uv run ruff check . # lint
uv run mypy # strict types
uv run lint-imports # layering contracts in pyproject.toml
uv run pytest # unit + protocol tests, 90% branch coverage
```

A change to the page manifest (`scripts/page-manifest.js`) is a change to the
indexer's input: update `scripts/page-manifest.schema.json`,
`mcp-server/src/kb_mcp/indexer/manifest.py` and `mcp-server/tests/fixtures/pages.json`
together.

## Repository conventions

### Hermetic by construction
Expand Down
7 changes: 7 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ npm run test:debug # debug mode
# Docker
docker build -t knowledge-base .
docker run -p 8080:8080 knowledge-base

# MCP server (Python, mcp-server/; needs uv) — run from mcp-server/
uv sync --all-extras # runtime + indexer + dev tools
uv run kb-mcp index --dist ../dist --out index.sqlite # index a build's dist/
KB_MCP_INDEX=index.sqlite uv run kb-mcp serve # http://127.0.0.1:8081/mcp
uv run ruff format --check . && uv run ruff check . && uv run mypy && uv run lint-imports && uv run pytest
```

## Build Pipeline
Expand Down Expand Up @@ -83,6 +89,7 @@ Orchestrator: `scripts/build-vite.js`. Flags: `--local`, `--headless`.
- `src/utils/registry.js` — Registry validation, manifest reading/validation, expansion map. Shared by the build and by Astro so both resolve the same registry
- `scripts/build-vite.js` — Build orchestrator (4 steps: prepare, hoist, copy assets, astro build)
- `scripts/page-manifest.js` — Build step 3b: writes `dist/_kb/pages.json` (shape: `scripts/page-manifest.schema.json`), the pages Astro published with their app's name, description, tags, kind and source version. It and the HTML under `dist/` are the whole interface for consumers that do not run Node (the MCP indexer); they never read the registry. `.dockerignore` keeps `dist/_kb` out of the nginx image
- `mcp-server/` — the MCP server: a self-contained Python project (uv, `src/kb_mcp`, pytest) on the official MCP SDK. It shares no code with the site; it reads `dist/_kb/pages.json` and the HTML under `dist/`. `kb-mcp index` builds a SQLite FTS5 index, `kb-mcp serve` serves it over stateless Streamable HTTP. Layering (ports and adapters, the indexer never imported at run time) is enforced by import-linter. See `docs/mcp-development.md` and `docs/adr/0001-mcp-server.md`
- `scripts/fetch-apps.js` — GitHub Release artifact downloader. Only *obtains* an artifact; installing it is one shared path in `build-vite.js`
- `scripts/artifacts.js` — Safe tarball extraction + tree copy, shared by both fetch paths. Validates archive members (no traversal, no absolute paths, no symlinks) before anything is written, and replaces the old `cp -r`/`tar` shell-outs so the build runs on Windows
- `scripts/check-artifact.js` — Runs the publish action's contract checker (`actions/lib/check.js`) on every installed artifact, before hoisting; logs findings grouped by rule, and fails a strict build on an error. `check.js` resolves its parsers from `actions/node_modules` or the root; the two may pin different versions, and `tests/artifact-checks.spec.js` runs the checker self-test against whichever the build resolves
Expand Down
Loading
Loading