Skip to content

Free code review tool that analyzes JavaScript, TypeScript, and Python code with static analysis and AI-powered suggestions.

License

Notifications You must be signed in to change notification settings

rishabhpreethan/GraphLint

Repository files navigation

GraphLint – Free, Stateless Edition

Link to GraphLint

GraphLint is an intelligent code review tool powered by static analysis and Gemini. Bring your own GitHub Personal Access Token (PAT) at runtime.

GraphLint Logo

GraphLint Logo

Linting analysis on GitHub repo:

Linting Analysis

Repo -Graph analysis

Features

  • Static Analysis: AST parsing, control-flow graphs, call graph analysis, code quality and security checks for JS/TS/Python.
  • AI Suggestions (Free): On-the-fly embeddings (Gemini) with simple vector ranking in memory to propose concise, actionable suggestions.
  • GitHub Integration:
    • Analyze PRs for public or private repos using a runtime PAT.
    • Optionally publish review comments back to GitHub.
    • Optionally apply suggestions to a branch via the API to commit changes.
  • Multiple analyze modes: PR, Repo, Compare, Local file input.
  • Modern UI: Icon-only, rounded controls, tooltips, and a pixel-inspired theme with light/dark toggle.
  • Serverless & Stateless: Everything runs inside Next.js API routes in-memory.

Architecture (Stateless)

User → /analyze (form) ──▶ API /api/analyze-pr
   1) Fetch PR metadata and files via GitHub PAT
   2) Static analysis in-memory (no DB)
   3) Chunk code → Embed (Gemini) → Rank in memory
   4) Generate concise suggestions (Gemini)
   5) Return results to UI

User ▶ Publish Review ──▶ API /api/publish
   6) Post review/comments to GitHub via PAT

User ▶ Apply Suggestion ──▶ API /api/apply-suggestion
   7) Commit suggested change(s) to the chosen branch via PAT

Limits added for free-tier friendliness:

  • Max files per PR: 20, max file size: 200KB, capped chunks/findings/suggestions.

Tech Stack

  • Frontend: Next.js 14 (App Router), React, TypeScript, Tailwind CSS
  • Static Analysis: acorn, acorn-walk, ts-morph
  • LLM/Embeddings: Google Gemini (free tier compatible)
  • GitHub: Octokit via Personal Access Token provided at runtime
  • Hosting: Vercel (serverless functions)

Environment

Copy .env.example.env.local and set:

GEMINI_API_KEY=your_gemini_api_key

Note: GitHub PAT is entered in the UI at /analyze; it is not stored.

Quick Start

  1. Install and run
npm install
npm run dev
  1. Open http://localhost:3000/analyze

  2. Enter:

  • Repo: owner/repo
  • PR number
  • GitHub PAT (with repo scope for private repos; read-only for public is sufficient for analysis; write for publishing review and applying suggestions)
  1. Click “Analyze” to see findings & AI suggestions. Optionally “Publish Review” to post to GitHub, or "Apply" to commit a suggestion to a branch.

Key Files

  • app/analyze/page.tsx – Analyze UI with mode selector (PR/Repo/Compare/Local), suggestions, and actions
  • app/api/analyze-pr/route.ts – Fetch, analyze, embed, suggest – all in memory
  • app/api/publish/route.ts – Publish comments/review through PAT
  • app/api/apply-suggestion/route.ts – Apply a single suggestion to a branch via GitHub
  • lib/github-pat.ts – Lightweight Octokit client using PAT
  • lib/analysis/static-analyzer.ts – Core static analysis
  • lib/embeddings.ts – Gemini embeddings + cosine similarity helpers
  • components/Icons.tsx – Reusable SVG icon set
  • components/ThemeToggle.tsx – Light/dark mode toggle (icon-only)
  • app/layout.tsx – Global layout (navbar with logo, theme support)
  • app/page.tsx – Landing page (logo hero)

Legacy DB-backed pages like app/dashboard/ are deprecated in this free edition. They will throw if used without a database.

Deprecated (Legacy, DB-backed)

The following legacy endpoints/pages have been removed and now return 410 Gone to guide users to the stateless flow:

  • app/api/pull-requests/[id]/findings/route.ts → 410 Gone
  • app/api/pull-requests/[id]/suggestions/route.ts → 410 Gone
  • app/api/pull-requests/[id]/generate-suggestions/route.ts → 410 Gone
  • app/api/pull-requests/[id]/publish/route.ts → 410 Gone
  • app/api/webhooks/github/route.ts → 410 Gone (webhooks disabled in stateless mode)
  • app/dashboard/page.tsx → replaced with a deprecation notice

Use /analyze UI and /api/analyze-pr + /api/publish + /api/apply-suggestion (with GitHub PAT) instead.

CS Concepts (Brief)

  • AST/CFG/Call Graph: Structural code understanding for findings and metrics
  • Embeddings + Ranking: Simple vector ranking in memory (cosine similarity)
  • Guardrails: Strict JSON schema and capped operations for predictable costs

UI & Theming

  • Branding: GraphLint logo shown in navbar and landing page.
  • Theme: Light/Dark modes with a pixel-inspired aesthetic and rounded icon buttons.
  • Accessibility: Buttons include aria-label and title where applicable.

License

MIT License - see LICENSE file for details

About

Free code review tool that analyzes JavaScript, TypeScript, and Python code with static analysis and AI-powered suggestions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages