WS2: legislation.gov.uk client + LLM tools + vitest harness

↗ view on GitHub · sloth-ninja · 2026-07-08 · 469e76a2

Add backend/src/lib/legislation.ts - a no-key legislation.gov.uk client:
natural-citation parsing (s./section/reg/SI/act-first forms), Atom
title-feed resolution (incl. pre-1963 regnal-year Act ids), CLML
fetch/extraction (provision text, heading, extent, and the
ukm:UnappliedEffects outstanding-amendments flag, verified against live
responses and documented in-file), a local ~1req/s token-bucket limiter,
and bounded TTL caches. Add legalSourcesTools/legislationTools.ts (the
three OpenAI-shaped tools + system prompt + executor).

Introduce vitest (backend has no test framework yet): vitest.config.ts,
package.json test script, 38 unit tests against captured CLML/Atom
fixtures (mocked fetch, no live calls).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository Sloth-ninja/JessicaOSS
Author sloth-ninja <ezanahaddis@gmail.com>
Authored
Committed
Parents 84de9f32
Stats 10 files changed , +1826
Part of WS2 / WS7: legislation.gov.uk research integration

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-469e76a2.md from inside the repo you want the change in.

⬇ Download capture-commit-469e76a2.md