kedgeway

Docs / Reference / Architecture

Architecture

kedgeway is hexagonal: the rules are pure, and everything that touches the outside world sits behind a port.

LayerFilesRole
coresrc/core/diagnose.ts, src/core/repo-facts.tsPure functions. repo-facts parses manifests and versions; diagnose turns facts and a snapshot into findings. No I/O.
portssrc/ports/ecosystem.tsEcosystemPort: one method, fetchSnapshot(), returning an ecosystem snapshot.
adapterssrc/adapters/fs-repo-scanner walks the repo. raven-ecosystem, raven-auth and raven-parse are the Raven MCP client, OAuth and result parser. fake-ecosystem loads fixtures.
clisrc/cli.ts, src/cli/commands.tsCommands, flags, report formatting and exit codes. Wires adapters to the core.

Flow of one run

  1. The scanner produces repo facts: Rust and JavaScript dependencies plus manifest errors.
  2. An EcosystemPort (Raven, or the fake from a fixture) produces a snapshot.
  3. diagnose(facts, snapshot) returns findings and a summary.
  4. The CLI prints them and computes the exit code.

Tests

Tests sit next to the code as *.test.ts and run with Vitest (npm test). Development is test-first: write the failing test, then the rule.

Adding a rule

  1. Write a failing test in src/core/diagnose.test.ts with the facts and snapshot that should trigger it.
  2. Add the logic to src/core/diagnose.ts, returning a finding with a severity, code, message, file and evidence that cites the snapshot source.
  3. If the rule needs a new input, extend the parser in src/core/repo-facts.ts first, with tests.
  4. Document the code on the Findings page.