Live on npm · @ishwarrr/docsync@0.1.0

Docs that stay true to your code.

AI coding agents ship code 5–10× faster than documentation can be written. DocSync detects when your docs drift from reality and automatically opens a PR to fix them.

Uses Tree-sitter AST parsing · GitHub Models (zero-config) · GitHub Actions · Works on every PR

$npx @ishwarrr/docsync init
View on GitHub →

Open source · MIT License · Built by @ishwar-prog

The Problem

70% of engineering docs are stale within 30 days of a deploy

Source: GitHub Octoverse 2025. With AI coding tools shipping code 5–10× faster, the gap between code and docs widens every single day.

Your docs say (3 months ago)
/**
 * Creates a new user account.
 * @param {string} email
 * @param {string} password
 * @returns {Promise<User>}
 */
async function createUser(
  email,
  password
) {}
Your code today (undocumented)
async function createUser(
  email,
  password,
  role,            // new — breaks callers
  organizationId   // new — required field
) {}

⚠️ Two new required parameters. Zero documentation updates.

Every developer who reads the old docs writes broken code. DocSync catches this the moment the PR is opened.

How It Works

DocSync catches drift before it ships

Three steps that happen automatically on every PR. Zero configuration after setup.

01

AST Parsing

Tree-sitter reads your code as a structured syntax tree — not plain text. Extracts every function signature, class, and API route with full type information. Handles TypeScript, JSX, incomplete code, and syntax errors gracefully.

Tree-sitter · JS · TS · JSX · TSX
02

Drift Detection

Compares extracted signatures against your committed baseline snapshot. Calculates a Drift Score (0–100) per construct. Distinguishes between interface changes (high drift) and internal refactors (zero drift). No false positives.

Signature-aware · Not file-hash-based
03

AI Documentation

When drift exceeds your threshold, DocSync calls an LLM with a surgical prompt engineered to produce senior-engineer-quality documentation, then opens a companion PR automatically. Works out of the box using GitHub Models via your existing GITHUB_TOKEN — no signup, no API key. Bring your own Groq or Anthropic key for higher throughput or a different model.

GitHub Models by default · Groq / Anthropic optional

The Automated Flow

Developer opens PR #42→DocSync parses changed files→Drift Score: 83/100→AI generates docs→Opens PR #43 with updated docs

Developer reviews PR #43, merges both. Docs stay true. Forever.

Terminal — npx @ishwarrr/docsync check
DocSync — Drift Check
─────────────────────

  Drift Score: 83/100  ████████░░
  Threshold:   75/100
  Status:      ⚠ DRIFT DETECTED — docs need updating

Changes Detected (3 total across 1 file)
─────────────────────────────────────────

  + New parameter organizationId added to createUser — not documented
  + New parameter role added to createUser — not documented
  ~ Return type changed: User → Promise<User>

Next Steps
──────────
  Run npx @ishwarrr/docsync fix to auto-generate updated documentation

Installation

Up and running in 2 minutes

Three commands. No server. No account. No credit card.

Step 1 — Initialize your repo (run once, commit the result)~3 seconds
# Scan your codebase, extract all function signatures,
# create a baseline snapshot in .docsync/snapshot.json
npx @ishwarrr/docsync init

# Commit the snapshot — this is your documentation baseline
git add .docsync/snapshot.json
git commit -m "docs: initialize DocSync baseline"
DocSync scans every JS/TS file, extracts all functions with Tree-sitter, and saves their signatures. This is your "docs are accurate" baseline.
Step 2 — Check for drift anytimeinstant
# Run after any code change to see your drift score
npx @ishwarrr/docsync check

# Machine-readable output for CI scripts
npx @ishwarrr/docsync check --json
Compares your current code against the snapshot. Shows exactly which functions changed and how severely the docs diverged. Score 0–100.
Step 3 — Auto-fix with AIzero-config via GitHub Models
# Running locally needs a token with GitHub Models access:
export GITHUB_TOKEN=$(gh auth token)

# Or bring your own key instead (optional, higher throughput):
# GROQ_API_KEY=... or ANTHROPIC_API_KEY=...

# Generate documentation for all drifted constructs
npx @ishwarrr/docsync fix
Calls an LLM with a surgical prompt engineered to produce senior-engineer-quality documentation. Writes Markdown to docs/. Updates snapshot.
GitHub Action — Runs automatically on every PR (recommended)zero maintenance
# .github/workflows/docsync.yml
# Copy this into your repo. No API key needed. Done.

name: DocSync
on: [pull_request]
permissions:
  contents: write
  pull-requests: write
  models: read       # lets DocSync call GitHub Models
jobs:
  docsync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ishwar-prog/docsync@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
Every PR automatically gets drift-checked. Companion PRs open automatically. Comments appear on the original PR. Zero ongoing maintenance, no secrets to manage. Want a specific model or higher throughput? Add a groq-api-key or anthropic-api-key input — it takes precedence.
Optional configuration — docsync.yaml (created automatically by init)
# Which files to watch
track:
  - src/**/*.ts
  - src/**/*.js

# Drift score above this opens a companion PR
drift:
  threshold: 75    # 0=loose  100=strict
  auto_pr: true

output:
  format: markdown  # markdown | mdx

The Drift Score

Not file hashes. Signature semantics.

Most tools detect "file changed." DocSync detects "public API changed." A refactor that doesn't touch the interface scores 0. An added parameter scores 60. This eliminates false positives entirely.

SCORE: 0 — No drift

// Renamed internal variable
// File hash changed — but interface identical
// DocSync correctly scores this 0
function createUser(email, password) {
  const usr = await db.insert(...)  // was: user
  return usr
}

SCORE: 83 — Drift detected

// Added 2 required parameters
// Public API changed — every caller affected
// DocSync correctly flags this
function createUser(
  email, password,
  role,            // +60 drift
  organizationId   // +60 drift → capped 83
)
ScoreStatusMeaningAction
0✅ In SyncDocs match code exactlyNothing needed
1–39🟡 MinorSmall internal changesMonitor
40–74🟠 ModerateDocs are misleadingUpdate soon
75–100🔴 SevereDocs actively wrongDocSync fixes automatically

Comparison

The only tool that closes the loop

Every other tool generates docs once and walks away. DocSync is the only tool that detects when those docs become lies and automatically fixes them.

ToolGenerates DocsDetects DriftAuto-PRs FixWorks in CIFree Tier
Mintlify✅❌❌❌❌
Swimm✅⚠️❌✅⚠️
GitHub Copilot✅❌❌❌❌
JSDoc / TSDoc❌❌❌❌✅
DocSync ✨✅✅✅✅✅

⚠️ = Partial support · Free tier = no credit card required to start

Supported Languages

JavaScript

.js .mjs .cjs

✅ Full

TypeScript

.ts .tsx

✅ Full

JSX / React

.jsx .tsx

✅ Full

Python

.py

🔜 v0.2

Stop letting docs lie.

Every broken doc is a developer losing hours. Every stale API reference is a bug waiting to happen. DocSync makes stale docs impossible.

Free forever for open source · Zero-config via GitHub Models · No credit card

$npx @ishwarrr/docsync init
Star on GitHub ⭐View on npm →