Keep documentation and code in sync using LLMs
Project description
Speclink 🔗
Speclink keeps your documentation and code in perfect harmony using LLMs. It automatically maps documentation sections to relevant code and synchronizes them when changes occur.
Key Features
- Auto-Mapping: Analyzes your repository to link documentation paragraphs with the exact code symbols they describe.
- Incremental Sync: Only updates the parts of your documentation affected by recent code changes.
- GitHub Action Integration: Automates the synchronization process in your CI/CD pipeline.
- AI-Powered: Leverages LLMs (OpenAI, Anthropic) and Rerankers (Cohere) for high-precision context retrieval.
Installation
pip install speclink
Quick Start
1. Initialize Speclink
Run the wizard to select which documentation files you want to track.
speclink scope
This will:
- Create a
.speclink/configuration directory. - Generate a
.github/workflows/speclink-sync.ymlfor automated syncs.
2. Configure Environment
Create a .env file or set environment variables. Speclink uses LiteLLM, which means it supports over 100+ providers (OpenAI, Anthropic, Mistral, Ollama, etc.).
LLM_API_KEY=your_key
LLM_MODEL=gpt-4o # or anthropic/claude-3-5-sonnet, mistral/mistral-large, etc.
RERANK_API_KEY=your_key
RERANK_MODEL=cohere/rerank-v3.5
Check the LiteLLM Supported Providers for the full list of model strings.
3. Initial Analysis & Commit
Generate the initial mapping and push it to your repository to enable automation.
speclink analyze
git add .speclink/ .github/
git commit -m "chore: initialize speclink"
git push
4. Continuous Sync (Automation)
Once committed, you don't need to run manual commands. The GitHub Action will:
- Trigger on every Pull Request.
- Re-analyze the repository to update the doc-map (incremental).
- Synchronize your documentation with any detected code changes.
- Commit both updated docs and the doc-map back to your branch.
How it works
- Scope: You define which
.mdfiles are the "Source of Truth". - Analyze: Speclink parses your code (using
tree-sitter) and uses a Reranker to find which files/functions relate to each documentation paragraph. - Sync: When code changes, Speclink identifies the affected doc sections, feeds the new code context to an LLM, and rewrites the documentation to match the new reality.
Development
Requires Python 3.12+.
git clone https://github.com/lacatu5/speclink.git
cd speclink
pip install -e .
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speclink-0.1.0.tar.gz.
File metadata
- Download URL: speclink-0.1.0.tar.gz
- Upload date:
- Size: 178.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60279915bf25c290b68efc77f5212f8f93ccf14d1031647cf77f587ea661de1e
|
|
| MD5 |
62a63429489b9b4c1e5a56ea26813d78
|
|
| BLAKE2b-256 |
eeed915ec02203b3a93dd2a984832fbcc982f6a412d70096fde1133f9392a8ef
|
File details
Details for the file speclink-0.1.0-py3-none-any.whl.
File metadata
- Download URL: speclink-0.1.0-py3-none-any.whl
- Upload date:
- Size: 42.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dd1297ec8cecdddc4006c105be1d3e9d862ab9b28ee1f27190dc0090b3f5d94
|
|
| MD5 |
5e400b6a44d84ed5799bcdf7eb825da3
|
|
| BLAKE2b-256 |
29ba55cb749548d80f168cf7ddf5d11e76927acc44498fbbf3c2f046aa099b98
|