LintBase
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> **Ground Truth for AI Coding Agents.**
> LintBase gives AI agents real-time knowledge of your database schema, security rules, and architecture so they stop hallucinating your codebase.
---
Why LintBase?
Developers are constantly feeding context files to AI tools like Cursor, Windsurf, Copilot Workspace, and Claude Code.
If your agent doesn't understand your *real* database schema, it writes code that fails in production.
LintBase acts as the bridge. It connects directly to your database, reads the **ground truth** of your live documents, and generates structured context optimized for AI.
- 🤖 **Stops AI Hallucinations** — Generates exact schema, field presence rates, and types.
- 📐 **Catches Schema Drift** — CI protection with lintbase check against schema snapshots.
- 🔒 **Security Context** — Highlights missing rules or exposed PII before your AI writes queries.
- 💸 **Cost Awareness** — Prevents AI from writing unbounded queries on 2M+ document collections.
- 🍃 **Universal NoSQL** — Works effortlessly with Firestore and MongoDB.
Why not just let the agent read the code?
Because in document databases, the code lies. The real schema is whatever your live documents actually contain, and that drifts away from the code with every half-finished migration, every renamed field, and every previous AI session that wrote in a hurry. An agent inferring the schema from TypeScript interfaces writes plausible queries against a database that no longer exists. The failure is silent: empty results, undefined values, a new field variant living alongside the old one. LintBase reads the documents, not the code.
Limitations (honest ones)
- Firestore and MongoDB only. Postgres is the obvious gap and it is next.
- Large collections are sampled, not fully scanned. Presence rates are estimates on multi-million-document collections.
- The MCP server is newer than the CLI. Expect rough edges there first.
---
🤖 AI Context Export (For Cursor, Claude, Windsurf)
The fastest way to give your AI agent perfect database knowledge.
**Output:**
Drop the lintbase-context folder into your AI's context window, or mention it in .cursorrules. Your agent will now write perfect, drift-free database queries.
---
Quick Start
1. Get a service account key
Firebase Console → Project Settings → Service Accounts → **Generate new private key**
Save the JSON file. **Never commit it to git.**
2. CI Pipeline Protection (Schema Drift)
LintBase acts as "Version Control for your Schema". Run the snapshot command to create a baseline:
Commit .lintbase/schema.json to your repository. Then, add the check command to your CI/CD pipeline (GitHub Actions, GitLab CI):
If a query or deployment accidentally deletes a critical field or changes a type (e.g., string to number), **your CI build will fail instantly.**
3. Run a general scan
You'll see a full report in your terminal:
3. Save to your dashboard (optional)
Track your database health over time at lintbase.com:
Get your token at **lintbase.com/dashboard/settings**.
---
Supported Databases
- **Firestore**: npx lintbase scan firestore --key ./sa.json
- **MongoDB**: npx lintbase scan mongodb --uri mongodb+srv://user:pass@cluster.mongodb.net/test