Walk through adding a new source type or model adapter and prove it with tests.
Alembic is designed to be extended. This lab has two tracks:
@alembic/ingestion. For example, a Notion exporter, a YouTube transcript fetcher, or an RSS feed reader.@alembic/adapters. For example, a local Ollama adapter or a new OpenAI-compatible endpoint.In both tracks you edit the contract, implement the interface, add tests, and run the verification command.
Think of it like… adding a new power socket type to your house: the wiring rules stay the same, but the plug changes.
A collector implements the eight-phase contract and returns a WikiPackage. An adapter implements ModelAdapter and is registered through createAdapterRegistry. For adapters, add the model id and pricing to packages/contracts/src/registry.ts. For collectors, add a CLI subcommand in apps/cli/src/args.ts and a runner in commands.ts.
# verify the whole monorepo after changes pnpm -r typecheck pnpm -r build pnpm -w test # run just the package you changed pnpm --filter @alembic/ingestion test
Tests for adapters should assert on ModelRunResult shape and failure modes, not on live responses. Use nock or a local mock server. Tests for collectors should assert each phase: preflight, cursor, capture, materialize, validate. The offline adapter in @alembic/adapters is a good reference for deterministic behavior.
Pick Track A or B. Implement the minimal version, add one test, and run the package's test suite. Then run the full verification command.