惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
U
Unit 42
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
宝玉的分享
宝玉的分享
L
LangChain Blog
Engineering at Meta
Engineering at Meta
量子位
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
A
About on SuperTechFans
Y
Y Combinator Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I built an AI that writes your docstrings — and catches w...
Suraj Sahoo · 2026-05-13 · via DEV Community

Suraj Sahoo

Documentation is a promise. A docstring says: "This function takes these inputs, does this thing, and returns this." The problem is that promises are easy to break — and nobody enforces them.

I've been on teams where the docs were accurate on day one and completely wrong six months later. Not because engineers are careless. Just because there's no system that notices when code and docs diverge.

I built Wright AI to fix this. It does two things:

  1. Generate docstrings automatically, for your whole codebase
  2. Detect drift — flag the docs that have become lies

Here's how both work.


The generation side

Most docstring generators just describe the function body. Wright reads the
call graph first.

It uses Tree-sitter to parse your AST, then builds a NetworkX dependency graph
weighted by PageRank. When generating a docstring for processPayment(), it
doesn't just read that function — it reads what calls it, what it calls, and
what those callees do. That context is what lets it write docs that describe
purpose, not just mechanics.

pip install wright
wright init .
wright generate src/
One command. Every undocumented function in your repo gets a docstring.
You review a diff, accept or discard. Nothing is written until you confirm.

Supported styles: Google, NumPy, Sphinx (Python), JSDoc (TypeScript/JavaScript),
godoc (Go), rustdoc (Rust).

The drift detection side — the interesting part
This is the part I haven't seen elsewhere, and the part that motivated building
this at all.

What is drift? A function's signature changes — a parameter is added,
renamed, or removed — but the docstring isn't updated. The code says one thing.
The docs say another.

Wright catches this by diffing the AST at each commit, not the text. Text diffs
miss subtle changes like a renamed parameter that still looks similar. AST diffs
are precise: if the signature structure changed and the docstring references the
old parameter name, that's a drift hit.


# Check the whole project
wright drift .

# Output:
# processPayment()   payments/core.ts:88   ⚠ param 'card' → 'paymentMethod'
# validateToken()    auth/middleware.ts:14  ⚠ return type changed
You can run this in CI to block PRs that introduce drift:


# .github/workflows/wright.yml
- name: Check documentation drift
  uses: surajs1999/WrightAI@v1
  with:
    check_drift: "true"
    threshold: "0.8"
  env:
    WRIGHT_TOKEN: ${{ secrets.WRIGHT_TOKEN }}
And in VS Code, drifted functions get a ⚠ gutter icon so you catch it
before you even push.

Bonus: MCP server for Claude Code / Cursor
If you use Claude Code, Cursor, or GitHub Copilot, there's one more piece.


wright-mcp
# ✓ Indexed 847 functions across 12 files
# → Tools ready: search_docs, get_function_doc, list_undocumented
This starts a local MCP server. Add it to your editor's config once, and your
AI assistant can query your documented functions directly — instead of you
pasting code into every new session. It re-indexes on file save, so it's always
current.

Quick start
VS Code (easiest):

Install [Wright AI](https://marketplace.visualstudio.com/items?itemName=WrightAI.wrightai) from the Marketplace
Sign in at [wrightai-web.fly.dev](wrightai-web.fly.dev)
Open any file — click "Generate Docs" above any function

CLI:
pip install wright
wright init .
wright generate .
wright drift .
wright chat .   # Ask questions, get file:line citations

Enter fullscreen mode Exit fullscreen mode

What's next
The drift detection is still maturing — right now it catches signature changes.
Next up: detecting when the documented behavior contradicts how the function
actually branches. That's a harder problem (requires symbolic execution or
very careful static analysis), but the common cases are tractable.

If you try it, I'd genuinely like to know what breaks. The GitHub issues page
is the best place: github.com/surajs1999/WrightAI