Contributing
DocuLayer is open source under the Apache 2.0 license.
Development Setup
git clone https://github.com/inamdarmihir/doculyayer
cd doculyayer
pip install -e ".[dev]"
Running Tests
pytest
Tests use pytest-asyncio (auto mode) and pytest-httpx for mocking HTTP calls.
Project Structure
doculayer/
├── __init__.py # Public API: search(), fetch()
├── cli.py # Click CLI: search, fetch, resolve, sources, setup, mcp
├── config.py # DocuLayerConfig (env vars)
├── mcp_server.py # FastMCP server — four MCP tools
├── setup_wizard.py # IDE detection and config writing
├── core/
│ ├── cache.py # TTLCache[FetchResult]
│ ├── citation.py # Attribution header formatting
│ ├── fetcher.py # DocFetcher — HTTP + cache + parsing
│ ├── parser.py # DocParser, DocSection
│ └── search.py # DocSearcher (BM25)
└── sources/
├── base.py # DocSource ABC
├── generic.py # GenericDocSource (llms.txt + fallback)
├── llms_txt.py # llms.txt discovery and parsing
└── registry.py # resolve_identifier, KNOWN_URLS, KNOWN_LLMS_TXT
Adding a New Shortcut
To add a new package to the built-in shortcut table, edit doculayer/sources/registry.py:
KNOWN_URLS: dict[str, str] = {
# existing entries...
"mypackage": "https://docs.mypackage.dev",
}
# If the package has llms.txt, also add:
KNOWN_LLMS_TXT: dict[str, str] = {
# existing entries...
"mypackage": "https://docs.mypackage.dev/llms.txt",
}
Then add a test in tests/ and open a PR.
Code Style
- Type annotations required on all public functions
mypy --strictmust pass- No external dependencies beyond those in
pyproject.toml