@ishwarrr/docsync
v0.1.0
Published
Auto-updating documentation that stays true to your code. Detects drift between code and docs, generates AI documentation, and opens companion PRs automatically.
Downloads
78
Maintainers
Readme
DocSync
Auto-updating documentation that stays true to your code.
AI coding agents ship code 5–10× faster than documentation can be written. DocSync detects when your docs drift from your code — and fixes it automatically.
Get Started · How It Works · GitHub Action · CLI Reference
The Problem
// Your docs say:
async function createUser(email, password) {}
// Your code now says:
async function createUser(email, password, role, organizationId) {}Two new required parameters. Zero documentation updates. Every developer who reads the old docs writes broken code. DocSync catches this the moment it happens.
How It Works
DocSync uses Tree-sitter AST parsing to understand your code structurally — not as text, but as a semantic tree of functions, classes, and API routes.
On every Pull Request:
- Parses changed JS/TS files with Tree-sitter
- Compares extracted signatures against your documentation baseline
- Calculates a Drift Score (0–100) for each changed construct
- If drift exceeds your threshold, generates updated docs using AI
- Opens a companion PR with the updated documentation
Installation
As a CLI tool:
npm install -g docsync
# or without installing:
npx docsync initAs a GitHub Action (recommended):
# .github/workflows/docsync.yml
- uses: ishwar-prog/docsync@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
groq-api-key: ${{ secrets.GROQ_API_KEY }}Quick Start
1. Initialize your repo (run once):
npx docsync init
git add .docsync/snapshot.json
git commit -m "docs: initialize DocSync baseline"2. Check for drift anytime:
npx docsync check3. Auto-fix with AI:
npx docsync fixDocSync calls the AI, generates documentation for every drifted construct,
and writes professional Markdown to your docs/ folder.
GitHub Action
Add DocSync to any repository in 3 lines:
name: DocSync
on: [pull_request]
permissions:
contents: write
pull-requests: write
jobs:
docsync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ishwar-prog/docsync@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
groq-api-key: ${{ secrets.GROQ_API_KEY }}Get a free Groq API key at console.groq.com — no credit card required.
CLI Reference
| Command | Description |
|---------|-------------|
| docsync init | Scan repo, parse all files, create baseline snapshot |
| docsync check | Detect documentation drift, show drift score |
| docsync fix | Generate AI documentation for all drifted constructs |
| docsync check --json | Machine-readable output for CI integration |
Configuration
# docsync.yaml
version: 1
track:
- src/**/*.ts
- src/**/*.js
ignore:
- "**/*.test.ts"
- "**/node_modules/**"
output:
format: markdown # markdown | mdx
dir: docs/
drift:
threshold: 75 # 0-100. Higher = stricter
auto_pr: trueThe Drift Score
| Score | Status | What It Means | |-------|--------|---------------| | 0 | ✅ In Sync | Documentation matches code | | 1–39 | 🟡 Minor Drift | Small changes, low priority | | 40–74 | 🟠 Moderate Drift | Documentation is misleading | | 75–100 | 🔴 Severe Drift | Documentation is wrong |
Comparison
| Tool | Generates Docs | Detects Drift | Auto-PRs Fix | Works in CI | |------|:--------------:|:-------------:|:------------:|:-----------:| | Mintlify | ✅ | ❌ | ❌ | ❌ | | Swimm | ✅ | Partial | ❌ | ✅ | | GitHub Copilot | ✅ inline | ❌ | ❌ | ❌ | | DocSync | ✅ | ✅ | ✅ | ✅ |
Supported Languages
| Language | Parsing | Route Detection | |----------|---------|-----------------| | JavaScript | ✅ | ✅ Express.js | | TypeScript | ✅ | ✅ Express.js | | JSX / TSX | ✅ | ✅ | | Python | 🔜 Coming soon | 🔜 | | Go | 🔜 Coming soon | 🔜 |
Contributing
git clone https://github.com/ishwar-prog/docsync
cd docsync
npm install
npm link # makes `docsync` available globally
docsync init # DocSync documents itselfSee CONTRIBUTING.md for guidelines.
License
MIT © Ishwar Suthar
Built with Tree-sitter · Groq Llama 3.3 · GitHub Actions · Node.js
If DocSync saves you time, give it a ⭐
