[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-75039":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":14,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":40,"readmeContent":41,"aiSummary":42,"trendingCount":16,"starSnapshotCount":16,"syncStatus":43,"lastSyncTime":44,"discoverSource":45},75039,"codesight","Houseofmvps\u002Fcodesight","Houseofmvps","Universal AI context generator. Saves thousands of tokens per conversation in Claude Code, Cursor, Copilot, Codex, and more.","https:\u002F\u002Fgithub.com\u002FHouseofmvps\u002Fcodesight",null,"TypeScript",1109,101,5,1,0,26,69,15,83.93,"MIT License",false,"main",true,[26,27,28,29,30,31,32,33,34,35,36,37,38,39],"ai","claude","cli","code-analysis","codebase","codex","context-engineering","copilot","cursor","developer-tools","llm","mcp","repo-map","token-savings","2026-06-12 04:01:17","\u003Cdiv align=\"center\">\n\n### Your AI assistant wastes thousands of tokens every conversation just figuring out your project. codesight fixes that in one command.\n\n**4,000+ downloads and counting.**\n\n**Zero dependencies. AST precision. 30+ framework detectors. 13 ORM parsers. 13 MCP tools. One `npx` call.**\n\n**Works with TypeScript, JavaScript, Python, Go, Ruby, Elixir, Java, Kotlin, Rust, PHP, Dart, Swift, C#, and BrightScript\u002FBrighterScript (Roku).** TypeScript projects get full AST precision. Everything else uses battle-tested regex detection across the same 30+ frameworks.\n\n[![npm version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fcodesight?style=for-the-badge&logo=npm&color=CB3837)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcodesight)\n[![npm downloads](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdm\u002Fcodesight?style=for-the-badge&logo=npm&color=blue&label=Monthly%20Downloads)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcodesight)\n[![npm total](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdt\u002Fcodesight?style=for-the-badge&logo=npm&color=cyan&label=Total%20Downloads)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fcodesight)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FHouseofmvps\u002Fcodesight?style=for-the-badge&logo=github&color=gold)](https:\u002F\u002Fgithub.com\u002FHouseofmvps\u002Fcodesight\u002Fstargazers)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow?style=for-the-badge&logo=opensourceinitiative)](LICENSE)\n\n---\n\n[![Follow @kaileskkhumar](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FFollow%20%40kaileskkhumar-000000?style=for-the-badge&logo=x&logoColor=white)](https:\u002F\u002Fx.com\u002Fkaileskkhumar)\n[![LinkedIn](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLinkedIn-Connect-0A66C2?style=for-the-badge&logo=linkedin)](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fkailesk-khumar)\n[![houseofmvps.com](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fhouseofmvps.com-Website-green?style=for-the-badge&logo=google-chrome&logoColor=white)](https:\u002F\u002Fhouseofmvps.com)\n[![kailxlabs.co](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fkailxlabs.co-Website-6366F1?style=for-the-badge&logo=google-chrome&logoColor=white)](https:\u002F\u002Fwww.kailxlabs.co)\n\n**Built by [Kailesk Khumar](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fkailesk-khumar), founder of [HouseofMVPs](https:\u002F\u002Fhouseofmvps.com) and [Kailxlabs](https:\u002F\u002Fwww.kailxlabs.co)**\n\n*Also: [ultraship](https:\u002F\u002Fgithub.com\u002FHouseofmvps\u002Fultraship) (39 expert skills for Claude Code) · [claude-rank](https:\u002F\u002Fgithub.com\u002FHouseofmvps\u002Fclaude-rank) (SEO\u002FGEO\u002FAEO plugin for Claude Code)*\n\n\u003C\u002Fdiv>\n\n---\n\n```\n0 dependencies · Node.js >= 18 · 27 tests · 13 MCP tools · MIT · tested on 25+ OSS projects across 14 languages\n```\n\n## Works With\n\n**Claude Code, Cursor, GitHub Copilot, OpenAI Codex, Windsurf, Cline, Aider**, and anything that reads markdown.\n\n## Install\n\n```bash\nnpx codesight\n```\n\nThat's it. Run it in any project root. No config, no setup, no API keys.\n\n```bash\nnpx codesight --wiki                       # Generate wiki knowledge base (.codesight\u002Fwiki\u002F)\nnpx codesight --init                       # Generate CLAUDE.md, .cursorrules, codex.md, AGENTS.md\nnpx codesight --open                       # Open interactive HTML report in browser\nnpx codesight --mcp                        # Start as MCP server (13 tools) for Claude Code \u002F Cursor\nnpx codesight --blast src\u002Flib\u002Fdb.ts        # Show blast radius for a file\nnpx codesight --profile claude-code        # Generate optimized config for a specific AI tool\nnpx codesight --benchmark                  # Show detailed token savings breakdown\nnpx codesight --mode knowledge             # Map knowledge base (.md notes → KNOWLEDGE.md)\nnpx codesight --mode knowledge ~\u002Fvault     # Map Obsidian vault, ADRs, meeting notes, retros\n```\n\n## Wiki Knowledge Base (v1.6.2)\n\nInspired by [Karpathy's LLM wiki pattern](https:\u002F\u002Fgist.github.com\u002Fkarpathy\u002F442a6bf555914893e9891c11519de94f) — but compiled from AST, not an LLM. Zero API calls. 200ms.\n\n```bash\nnpx codesight --wiki\n```\n\nGenerates `.codesight\u002Fwiki\u002F` — a persistent knowledge base of your codebase that survives across every session:\n\n```\n.codesight\u002Fwiki\u002F\n  index.md      — catalog of all articles (~200 tokens) — read this at session start\n  overview.md   — architecture, subsystems, high-impact files (~500 tokens)\n  auth.md       — auth routes, middleware, session flow\n  payments.md   — payment routes, webhook handling, billing flow\n  database.md   — all models, fields, relations, high-impact DB files\n  users.md      — user management routes and related models\n  ui.md         — UI components with props\n  log.md        — append-only record of every wiki operation\n```\n\n**Why this cuts token usage further:**\n\nInstead of loading the full 5K token context map every conversation, your AI reads one targeted article:\n\n| Question | Without wiki | With wiki |\n|---|---|---|\n| \"How does auth work?\" | ~12K tokens (reads 8+ files) | ~300 tokens (`auth.md`) |\n| \"What models exist?\" | ~5K tokens (CODESIGHT.md) | ~400 tokens (`database.md`) |\n| New session start | ~5K tokens (full reload) | ~200 tokens (`index.md`) |\n\n**Persistent across sessions.** The wiki lives in `.codesight\u002Fwiki\u002F`, committed to git. Every new Claude Code, Cursor, or Codex session starts with full codebase knowledge from the first message.\n\n**Auto-regenerates.** Use `--watch` to keep the wiki current as you code. Use `--hook` to regenerate on every commit.\n\n**3 new MCP tools** for wiki access:\n\n| Tool | What it does |\n|---|---|\n| `codesight_get_wiki_index` | Get the wiki catalog (~200 tokens) at session start |\n| `codesight_get_wiki_article` | Read one article by name: `auth`, `database`, `payments`, etc. |\n| `codesight_lint_wiki` | Health check: orphan articles, missing cross-links, stale content |\n\nThe key difference from general-purpose wiki tools: codesight already knows your routes, schema, blast radius, and middleware from AST — no LLM needed to extract code structure. The wiki is a narrative layer on top of data your codebase already contains.\n\n## Knowledge Mode (v1.9.3)\n\nNot just code — your decisions, meeting notes, ADRs, and retrospectives carry as much context as the codebase itself. `--mode knowledge` maps them the same way codesight maps code.\n\n```bash\nnpx codesight --mode knowledge              # Scan current directory for .md files\nnpx codesight --mode knowledge ~\u002Fvault      # Scan an Obsidian vault\nnpx codesight --mode knowledge .\u002Fdocs       # Scan a project docs folder\n```\n\nOutputs `.codesight\u002FKNOWLEDGE.md` — a compact AI context primer:\n\n```markdown\n# Knowledge Map — my-project\n> 47 notes · 12 decisions · 8 open questions · 2025-09-01 → 2026-04-01\n\n## Key Decisions (12)\n- [2026-03-20] Going with Polar.sh over Stripe Connect — simpler global payments\n- [2026-03-15] Decided to use PostgreSQL — better JSON support and Drizzle compatibility\n- [2026-02-10] Will use Redis for rate limiting — BullMQ already in stack\n\n## Open Questions (8)\n- Should we support PayPal later?\n- When do we start the Stripe marketplace application?\n\n## Note Index (47)\n\n### Decision Records (8)\n- `decisions\u002Fadr-002-payments.md` — 2026-03-20 — Going with Polar.sh over Stripe Connect\n- `decisions\u002Fadr-001-database.md` — 2026-03-15 — We need a relational database...\n\n### Meeting Notes (14)\n### Retrospectives (6)\n### Specs & PRDs (5)\n### Research (4)\n```\n\n**What it detects automatically:**\n\n| Note type | Signals |\n|---|---|\n| Decision records | ADR format (`## Decision`), \"decided to\", \"going with\", \"chose X over Y\" |\n| Meeting notes | `Attendees:`, `Action items:`, filename: `standup`, `sync`, `1on1` |\n| Retrospectives | \"What went well\", \"Stop doing\", filename: `retro`, `retrospective` |\n| Specs \u002F PRDs | `## Goals`, `## Requirements`, filename: `prd`, `spec`, `roadmap` |\n| Research | filename: `research`, `analysis`, `benchmark`, `comparison` |\n| Session logs | filename: `session`, `daily`, `weekly` |\n\n**Supports:**\n- Obsidian vaults (YAML frontmatter, `[[backlinks]]`, `#tags`)\n- Notion exports (`.md` files with frontmatter)\n- ADR tooling (`adr-tools`, `Log4brains`, raw markdown)\n- Any folder of markdown files\n\n**Used together:**\n\n```\nRead .codesight\u002FCODESIGHT.md   → what the code does\nRead .codesight\u002FKNOWLEDGE.md   → why decisions were made\n```\n\nCI: add `npx codesight --mode knowledge` alongside your existing codesight step. Both files stay current on every push.\n\n## Benchmarks (Real Projects)\n\nEvery number below comes from running codesight on real production codebases — both small SaaS projects (v1.6.2) and large open-source platforms with 4K–10K+ files (v1.6.4). Output tokens are measured from actual file size (chars \u002F 4). Exploration tokens are estimated from what was extracted — routes × 400, models × 300, components × 250, etc. Route counts and model counts are cross-checked against actual source files.\n\n### Three-Level Token Reduction\n\ncodesight saves tokens at two distinct layers. The wiki (v1.6.2) adds a second layer on top of the base savings:\n\n| Project | Manual exploration | codesight scan | codesight --wiki (targeted) | **Total reduction** |\n|---|---|---|---|---|\n| **SaaS A** | 46,020 tokens | 3,936 tokens (11.7x) | ~550 tokens | **83.7x** |\n| **SaaS B** | 26,130 tokens | 3,629 tokens (7.2x) | ~440 tokens | **59.4x** |\n| **SaaS C** | 47,450 tokens | 4,162 tokens (11.4x) | ~360 tokens | **131.8x** |\n\n**Average combined reduction: 91x.** The wiki's \"targeted\" number = reading `index.md` at session start (~200 tokens) + one relevant article (~160-350 tokens depending on project). Your AI never loads the full context map for targeted questions.\n\nThe two savings layers are independent and compound:\n\n**Layer 1 — codesight scan** eliminates manual file exploration. Instead of your AI running glob\u002Fgrep\u002Fread across 40-138 files to understand the project, it reads one pre-compiled map.\n\n**Layer 2 — `--wiki`** eliminates loading the full map for every question. Instead of loading 3K-5K tokens of full context at session start, your AI reads a 200-token index and pulls the one relevant article (~160-350 tokens) for each question.\n\n```\nWithout codesight:   AI reads 26K-47K tokens per session exploring files\nWith codesight:      AI reads ~3K-5K tokens (the compiled map)\nWith --wiki:         AI reads ~200 tokens at start + ~300 per targeted question\n```\n\n### Base Scan Results\n\n| Project | Stack | Files | Routes | Models | Components | Output Tokens | Exploration Tokens | Savings | Scan Time |\n|---|---|---|---|---|---|---|---|---|---|\n| **SaaS A** | Hono + Drizzle | 138 | 38 | 12 | 0 | 3,936 | 46,020 | **11.7x** | 186ms |\n| **SaaS B** | Hono + Drizzle, 3 workspaces | 53 | 17 | 8 | 10 | 3,629 | 26,130 | **7.2x** | 201ms |\n| **SaaS C** | FastAPI + MongoDB | 40 | 56 | 0 | 0 | 4,162 | 47,450 | **11.4x** | 890ms |\n\nSaaS C has 0 models because it uses MongoDB — no SQL ORM declarations for codesight to parse. This is correct detection, not a false negative.\n\n![Token comparison: Without codesight (46K-66K tokens) vs With codesight (3K-5K tokens)](assets\u002Ftoken-comparison.jpg)\n\n### Multi-Language OSS Benchmark (v1.6.7)\n\nTested against real open-source codebases spanning every supported language and framework. Output tokens are measured from actual file size. Exploration tokens are estimated (routes×400 + models×300 + components×250 + revisit multiplier). Zero false positives across all tests.\n\n| Language | Stack | Files | Routes | Models | Components | Output tokens | Est. exploration | Savings |\n|---|---|---|---|---|---|---|---|---|\n| **TypeScript · Next.js** | Next.js + tRPC + Prisma · 110+ workspaces | 7,509 | 479 | 173 | 1,309 | 158,660 | ~1,485,000 | **~9x** |\n| **TypeScript · NestJS** | NestJS + TypeORM + Mongoose | 162 | 19 | 8 | 0 | 5,300 | ~67,500 | **~12.7x** |\n| **TypeScript · Hono** | Hono | — | 8 | 0 | 0 | — | — | ✓ |\n| **TypeScript · Remix** | Remix + Prisma | 36 | 11 | 0 | 9 | — | — | ✓ |\n| **TypeScript · SvelteKit** | SvelteKit | — | 0³ | 0 | 23 | — | — | ✓ |\n| **TypeScript · Nuxt** | Nuxt | 141 | 8 | 0 | 64 | — | — | ✓ |\n| **JavaScript · Express** | Express + Mongoose | 51 | 10 | 5 | 0 | 1,241 | ~20,800 | **~17x** |\n| **Ruby · Rails** | Rails + ActiveRecord | 4,172 | 607 | 116 | 0 | 21,711 | ~386,100 | **~17.8x** |\n| **PHP · Laravel** | Laravel + Eloquent | 3,896 | 652 | 59 | 0 | 30,739 | ~493,285 | **~16x** |\n| **Python · Django** | Django + pyproject.toml | 4,232 | 7¹ | 56 | 0 | 83,842 | ~631,020 | **~7.5x** |\n| **Python · Flask** | Flask + SQLAlchemy | 30 | 12 | 5 | 0 | 1,148 | ~16,705 | **~14.5x** |\n| **Python · FastAPI** | FastAPI + SQLModel (monorepo) | 143 | 21 | 2 | 36 | 2,487 | ~38,090 | **~15.3x** |\n| **Elixir · Phoenix** | Phoenix + Ecto | 1,406 | 198 | 54 | 0 | 9,589 | ~152,100 | **~15.9x** |\n| **Go · Gin** | Gin + GORM (enterprise app) | 388 | 202 | 169 | 0 | 15,266 | ~262,730 | **~17.2x** |\n| **Go · Echo** | Echo | — | 7 | 0 | 0 | — | — | ✓ |\n| **Go · Fiber** | Fiber | — | 5 | 0 | 0 | — | — | ✓ |\n| **Rust · Actix** | actix-web | 528 | 30 | 0 | 0 | 1,355 | ~27,170 | **~20x** |\n| **Rust · Axum** | Axum | — | 6 | 0 | 0 | — | — | ✓ |\n| **C# · ASP.NET** | ASP.NET Core + Entity Framework Core | 256 | 13 | 7 | 0 | 5,126 | ~63,570 | **~12.4x** |\n| **Java · Spring** | Spring Boot + Java (Maven) | 47 | 16 | 0 | 0 | 319 | ~13,208 | **~41x**² |\n| **Swift · SwiftUI** | SwiftUI | 388 | 0 | 0 | 62 | 7,499 | ~76,830 | **~10.2x** |\n| **Swift · Vapor** | Vapor backend | 294 | 81 | 0 | 0 | 6,146 | ~95,160 | **~15.5x** |\n| **Dart · Flutter** | Flutter + go_router | 204 | 10 | 0 | 89 | 8,500 | ~86,125 | **~10.1x** |\n\n¹ Django project is GraphQL-first — 7 REST utility endpoints detected accurately, 0 false positives.\n² High ratio on small boilerplate: Spring Boot route metadata compresses very well.\n³ SvelteKit RealWorld app uses page routes (`+page.svelte`), not JSON API endpoints (`+server.ts`). 0 routes is correct.\n\n**How exploration tokens are estimated:** `routes×400 + models×300 + components×250 + hot_files×150 + env_vars×30`, times a 1.3 revisit multiplier, minus the output size. This approximates what an AI would spend asking \"what routes exist?\", \"show me the schema\", etc. in a manual exploration session. Output token count is the actual measured file size.\n\n### Wiki Breakdown (v1.6.2)\n\n| Project | Full CODESIGHT.md | Wiki index only | Index + 1 article | Wiki articles generated |\n|---|---|---|---|---|\n| **SaaS A** | 3,936 tokens | ~200 tokens | ~550 tokens | 9 |\n| **SaaS B** | 3,629 tokens | ~200 tokens | ~440 tokens | 11 |\n| **SaaS C** | 4,162 tokens | ~200 tokens | ~360 tokens | 17 |\n\n\"How does auth work?\" — without wiki: loads 3,945 tokens. With wiki: reads `auth.md` (~350 tokens). **11x improvement per targeted question, 84x total vs manual.**\n\n### Detection Accuracy\n\nVerified against actual source files. Route counts cross-checked against route definitions; schema models cross-checked against ORM table declarations.\n\n| Project | Route Recall | Schema Recall | False Positives | Detection Method |\n|---|---|---|---|---|\n| **SaaS A** | 38\u002F43 (88%) | 12\u002F12 (100%) | 0 | Schema: AST (Drizzle), Routes: AST (Hono) |\n| **SaaS B** | 17\u002F17 (100%) | 8\u002F8 (100%) | 0 | Full AST (Hono + Drizzle + React) |\n| **SaaS C** | 56\u002F59 (~95%) | 0\u002F0 (correct) | 0 | AST (FastAPI + MongoDB) |\n\nSaaS A's 5 missed routes use dynamic `url.match(\u002Fpattern\u002F)` inside request handlers — a developer pattern that static analysis cannot resolve at scan time. This is an inherent limit of static analysis, not a framework gap. SaaS C missed an estimated 3 of 59 FastAPI routes. Zero false positives across all three projects.\n\n### Blast Radius Accuracy\n\nTested on a production SaaS: changing the database module correctly identified:\n\n- **5 affected files** across API, auth, and server layers\n- **All routes** that touch the database\n- **12 affected models** (complete schema)\n- **BFS depth:** 3 hops through the import graph\n\n### What Gets Detected\n\nMeasured across the three benchmark projects:\n\n| Detector | SaaS A (138 files) | SaaS B (53 files) | SaaS C (40 files) |\n|---|---|---|---|\n| **Routes** | 38 | 17 | 56 |\n| **Schema models** | 12 | 8 | 0 |\n| **Components** | 0 | 10 | 0 |\n| **Env vars** | 12 | 7 | 15 |\n| **Hot files** | 20 | 20 | 20 |\n\n---\n\n## How It Works\n\n![How codesight works: Codebase → AST Parser + Regex Fallback → Context Map → CLAUDE.md, .cursorrules, codex.md, MCP Server](assets\u002Fhow-it-works.jpg)\n\n![8 parallel detectors: Routes, Schema, Components, Dep Graph, Middleware, Config, Libraries, Contracts](assets\u002Fdetectors.jpg)\n\ncodesight runs all 8 detectors in parallel, then writes the results as structured markdown. The output is designed to be read by an AI in a single file load.\n\n## What It Generates\n\n```\n.codesight\u002F\n  CODESIGHT.md     Combined context map (one file, full project understanding)\n  routes.md        Every API route with method, path, params, and what it touches\n  schema.md        Every database model with fields, types, keys, and relations\n  components.md    Every UI component with its props\n  libs.md          Every library export with function signatures\n  config.md        Every env var (required vs default), config files, key deps\n  middleware.md    Auth, rate limiting, CORS, validation, logging, error handlers\n  graph.md         Which files import what and which break the most things if changed\n  report.html      Interactive visual dashboard (with --html or --open)\n```\n\n## AST Precision\n\nWhen TypeScript is installed in the project being scanned, codesight uses the actual TypeScript compiler API to parse your code structurally. No regex guessing.\n\n![AST precision: TypeScript available → AST Parse, otherwise Regex fallback](assets\u002Fast-precision.jpg)\n\n| What AST enables | Regex alone |\n|---|---|\n| Follows `router.use('\u002Fprefix', subRouter)` chains | Misses nested routers |\n| Combines `@Controller('users')` + `@Get(':id')` into `\u002Fusers\u002F:id` | May miss prefix |\n| Parses `router({ users: userRouter })` tRPC nesting | Line-by-line matching |\n| Extracts exact Drizzle field types from `.primaryKey().notNull()` chains | Pattern matching |\n| Gets React props from TypeScript interfaces and destructuring | Regex on `{ prop }` |\n| Detects middleware in route chains: `app.get('\u002Fpath', auth, handler)` | Not captured |\n| Filters out non-route calls like `c.get('userId')` | May false-positive |\n\nAST detection is reported in the output:\n\n```\nAnalyzing... done (AST: 60 routes, 18 models, 16 components)\n```\n\nNo configuration needed. If TypeScript is in your `node_modules`, AST kicks in automatically. Works with npm, yarn, and pnpm (including strict mode). Falls back to regex for non-TypeScript projects or frameworks without AST support.\n\n**AST-supported frameworks:** Express, Hono, Fastify, Koa, Elysia (route chains + middleware), NestJS (decorator combining + guards), tRPC (router nesting + procedure types), Drizzle (field chains + relations), TypeORM (entity decorators), React (props from interfaces + destructuring + forwardRef\u002Fmemo).\n\n## Routes\n\nNot just paths. Methods, URL parameters, what each route touches (auth, database, cache, payments, AI, email, queues), and where the handler lives. Detects routes across 25+ frameworks automatically.\n\nExample output:\n\n```markdown\n- `GET` `\u002Fapi\u002Fusers\u002Fme` [auth, db, cache]\n- `PUT` `\u002Fapi\u002Fusers\u002Fme` [auth, db]\n- `POST` `\u002Fapi\u002Fprojects` [auth, db, payment]\n- `GET` `\u002Fapi\u002Fprojects\u002F:id` params(id) [auth, db]\n- `POST` `\u002Fwebhooks\u002Fstripe` [db, payment]\n- `GET` `\u002Fhealth`\n```\n\n## Schema\n\nModels, fields, types, primary keys, foreign keys, unique constraints, relations. Parsed directly from your ORM definitions via AST. No need to open migration files.\n\nExample output:\n\n```markdown\n### user\n- id: text (pk)\n- name: text (required)\n- email: text (unique, required)\n- role: text (default, required)\n- stripeCustomerId: text (fk)\n\n### project\n- id: uuid (default, pk)\n- ownerId: text (fk, required)\n- name: text (required)\n- settings: jsonb (required)\n- _relations_: ownerId -> user.id\n```\n\n## Dependency Graph\n\nThe files imported the most are the ones that break the most things when changed. codesight finds them and tells your AI to be careful.\n\nExample output:\n\n```markdown\n## Most Imported Files (change these carefully)\n- `src\u002Ftypes\u002Findex.ts` — imported by **20** files\n- `src\u002Fdb\u002Findex.ts` — imported by **12** files\n- `src\u002Flib\u002Fauth.ts` — imported by **8** files\n- `src\u002Flib\u002Fcache.ts` — imported by **6** files\n- `src\u002Flib\u002Fenv.ts` — imported by **5** files\n```\n\n## Blast Radius\n\n![Blast radius: changing src\u002Fdb\u002Findex.ts ripples through 10 files across 3 hops](assets\u002Fblast-radius.jpg)\n\nBFS through the import graph finds all transitively affected files, routes, models, and middleware.\n\n```bash\nnpx codesight --blast src\u002Fdb\u002Findex.ts\n```\n\nExample output:\n\n```\n  Blast Radius: src\u002Fdb\u002Findex.ts\n  Depth: 3 hops\n\n  Affected files (10):\n    src\u002Fapi\u002Fusers.ts\n    src\u002Fapi\u002Fprojects.ts\n    src\u002Fapi\u002Fwebhooks.ts\n    src\u002Fauth\u002Fsession.ts\n    src\u002Fjobs\u002Fnotifications.ts\n    src\u002Fserver.ts\n    src\u002Fauth\u002Findex.ts\n    src\u002Fjobs\u002Fcron.ts\n    src\u002Fcli.ts\n    src\u002Findex.ts\n\n  Affected routes (33):\n    GET \u002Fapi\u002Fusers\u002Fme — src\u002Fapi\u002Fusers.ts\n    POST \u002Fapi\u002Fprojects — src\u002Fapi\u002Fprojects.ts\n    POST \u002Fwebhooks\u002Fstripe — src\u002Fapi\u002Fwebhooks.ts\n    ...\n\n  Affected models: user, session, account, project,\n    subscription, notification, audit_log\n```\n\nYour AI can also query blast radius through the MCP server before making changes.\n\n## Environment Audit\n\nEvery env var across your codebase, flagged as required or has default, with the exact file where it is referenced.\n\nExample output:\n\n```markdown\n- `DATABASE_URL` **required** — .env.example\n- `REDIS_URL` (has default) — .env.example\n- `STRIPE_SECRET_KEY` **required** — src\u002Flib\u002Fpayments.ts\n- `STRIPE_WEBHOOK_SECRET` **required** — .env.example\n- `RESEND_API_KEY` **required** — .env.example\n- `JWT_SECRET` **required** — src\u002Flib\u002Fauth.ts\n```\n\n## Token Benchmark\n\nSee exactly where your token savings come from:\n\n```bash\nnpx codesight --benchmark\n```\n\nExample output (SaaS A — 138 files, Hono + Drizzle):\n\n```\n  Token Savings Breakdown:\n  ┌──────────────────────────────────────────────────┐\n  │ What codesight found         │ Exploration cost   │\n  ├──────────────────────────────┼────────────────────┤\n  │  38 routes                   │ ~15,200 tokens     │\n  │  12 schema models            │ ~ 3,600 tokens     │\n  │   0 components               │       0 tokens     │\n  │  30 library files            │ ~ 6,000 tokens     │\n  │  12 env vars                 │ ~ 1,200 tokens     │\n  │   5 middleware               │ ~ 1,000 tokens     │\n  │  20 hot files                │ ~ 3,000 tokens     │\n  │ 138 files (search overhead)  │ ~11,040 tokens     │\n  ├──────────────────────────────┼────────────────────┤\n  │ codesight output             │ ~ 3,936 tokens     │\n  │ Manual exploration (1.3x)    │ ~46,020 tokens     │\n  │ SAVED PER CONVERSATION       │ ~42,084 tokens     │\n  └──────────────────────────────┴────────────────────┘\n```\n\n### How Token Savings Are Calculated\n\nEach detector type maps to a measured token cost that an AI would spend to discover the same information manually:\n\n| What codesight finds | Tokens saved per item | Why |\n|---|---|---|\n| Each route | ~400 tokens | AI reads the handler file, greps for the path, reads middleware |\n| Each schema model | ~300 tokens | AI opens migration\u002FORM files, parses fields manually |\n| Each component | ~250 tokens | AI opens component files, reads prop types |\n| Each library export | ~200 tokens | AI greps for exports, reads signatures |\n| Each env var | ~100 tokens | AI greps for `process.env`, reads .env files |\n| Each file scanned | ~80 tokens | AI runs glob\u002Fgrep operations to find relevant files |\n\nThe 1.3x multiplier accounts for AI revisiting files during multi-turn conversations. These estimates are conservative. A developer manually verified that Claude Code spends 40-70K tokens exploring the same projects that codesight summarizes in 3-5K tokens.\n\n## Roku \u002F BrightScript \u002F SceneGraph\n\ncodesight treats Roku channels as first-class projects. The `manifest` file at the channel root anchors detection — the same file Roku itself uses to identify a channel, so zero configuration is needed for the common case.\n\n**Standard single-channel layout** (about 90% of Roku repos, matches the Roku docs' getting-started template and projects like `rokucommunity\u002Fbrighterscript-template`):\n\n```\n\u002F\n  manifest\n  source\u002F         # Main.brs + shared .brs libraries\n  components\u002F     # *.xml + paired *.brs component handlers\n  images\u002F\n```\n\ncodesight also recognizes the `rokucommunity\u002Fbrighterscript-template` layout where the channel lives under `src\u002F` and the root carries a `bsconfig.json` for BrighterScript tooling.\n\n**Multi-channel monorepo layout** (less common — used by larger codebases that ship several branded channels from one repo with `roku-deploy` + `gulp` to merge a shared `common\u002F` layer with per-channel assets at build time):\n\n```\n\u002F\n  package.json      # depends on roku-deploy, gulp\n  gulpfile.js\n  src\u002Fapps\u002F\n    common\u002F         # shared layer, merged into every channel at build\n    creatorA\u002F\n      manifest\n    creatorB\u002F\n      manifest\n```\n\nThis is detected via a strict structural signal: no manifest at root, `roku-deploy` in deps, and a `common\u002F` directory with at least 2 sibling directories that each have their own `manifest`. When the signal matches, each channel (plus `common\u002F`) is registered as a workspace.\n\n### Mappings to codesight's data model\n\n| codesight concept | Roku equivalent |\n|---|---|\n| Routes | Screens — every child element with an `id` declared in the Scene XML's `\u003Cchildren>`. `method = VIEW` by default, upgraded to `MODAL` if a navigation call-site passes a literal `true` as the second argument. |\n| Schema | Every SceneGraph component XML whose `\u003Cinterface>` has at least one `\u003Cfield>` — the typed contract is the model. |\n| Components | Every `\u003Ccomponent name=\"...\" extends=\"...\">` XML (views, tasks, scenes, modals). Props = interface fields. |\n| Libraries | `.brs` \u002F `.bs` files outside `components\u002F` — top-level `function`\u002F`sub` plus BrighterScript `class` \u002F `namespace` \u002F `enum` \u002F `interface`. |\n| Middleware | `observeField` subscriptions, `m.global.AddField` registrations. BugsnagTask \u002F RudderstackTask recognized when present. |\n| Dependencies | `\u003Cscript uri=\"pkg:\u002F...\" \u002F>` includes in component XML + `import \"pkg:\u002F...\"` in `.bs`. |\n| Events | Observed fields (`system: scenegraph-observer`) and Rudderstack event names (`system: rudderstack`). |\n| Config | The Roku `manifest` key\u002Fvalue lines surfaced as `manifest.\u003Cname>` pseudo env-vars. |\n\n### Configurable navigation helpers\n\nMany Roku projects use a custom helper to switch the visible screen (names vary: `ShowScreen`, `pushScreen`, `NavigateTo`, `showView`, etc.). These are used as optional enrichment to tag routes as `MODAL`. Defaults cover the common conventions; override with `rokuScreenHelpers` in your codesight config if your project uses a different name:\n\n```json\n{\n  \"rokuScreenHelpers\": [\"Router.push\", \"openScreen\"]\n}\n```\n\nRoutes are still detected from `\u003Cchildren>` even when no helper is present or when no call-site matches.\n\n### Example output\n\n```markdown\n- `VIEW` `\u002FhomeView` — components\u002Fviews\u002FHomeView.xml\n- `VIEW` `\u002FdetailView` — components\u002Fviews\u002FDetailView.xml\n- `MODAL` `\u002FerrorModal` — components\u002Fmodals\u002FErrorModal.xml\n\n### DataTask\n- requestUrl: string\n- response: object\n```\n\n## Supported Stacks\n\n| Category | Supported |\n|---|---|\n| **Routes** | Hono, Express, Fastify, Next.js (App + Pages), Koa, NestJS, tRPC, Elysia, AdonisJS, SvelteKit, Remix, Nuxt, FastAPI, Flask, Django, Go (net\u002Fhttp, Gin, Fiber, Echo, Chi), Rails, Phoenix, Spring Boot, Ktor, Actix, Axum, Laravel, ASP.NET Core (controllers + minimal API), Vapor, Flutter (go_router), Roku SceneGraph (screens via ShowScreen), raw http.createServer |\n| **Events** | BullMQ queues, Celery tasks, Kafka topics, Redis pub\u002Fsub, Socket.io, EventEmitter, SceneGraph observers, Rudderstack |\n| **Schema** | Drizzle, Prisma, TypeORM, Mongoose, Sequelize, SQLAlchemy, Django ORM, ActiveRecord, Ecto, Eloquent, Entity Framework, Exposed, Room, SceneGraph `\u003Cinterface>` contracts (14 ORMs) |\n| **Components** | React, Vue, Svelte, Flutter widgets (StatelessWidget, StatefulWidget, ConsumerWidget), SwiftUI views (auto-filters shadcn\u002Fui and Radix primitives), Roku SceneGraph components |\n| **Libraries** | TypeScript, JavaScript, Python, Go, Dart, Swift, C#, PHP, BrightScript, BrighterScript (exports with function signatures) |\n| **Middleware** | Auth, rate limiting, CORS, validation, logging, error handlers, SceneGraph observers + `m.global` fields |\n| **Dependencies** | Import graph with hot file detection (most imported = highest blast radius); SceneGraph `\u003Cscript uri=\"pkg:\u002F...\">` and BrighterScript `import` statements |\n| **Contracts** | URL params, request types, response types from route handlers |\n| **Monorepos** | pnpm, npm, yarn workspaces + mixed-language workspaces (e.g. Next.js + Laravel, SwiftUI + Vapor, Roku multi-channel under `src\u002Fapps\u002F\u003Ccreator>\u002F`) |\n| **Languages** | TypeScript, JavaScript, Python, Go, Ruby, Elixir, Java, Kotlin, Rust, PHP, Dart, Swift, C#, BrightScript\u002FBrighterScript |\n\n## AI Config Generation\n\n```bash\nnpx codesight --init\n```\n\nGenerates ready-to-use instruction files for every major AI coding tool at once:\n\n| File | Tool |\n|---|---|\n| `CLAUDE.md` | Claude Code |\n| `.cursorrules` | Cursor |\n| `.github\u002Fcopilot-instructions.md` | GitHub Copilot |\n| `codex.md` | OpenAI Codex CLI |\n| `AGENTS.md` | OpenAI Codex agents |\n\nEach file is pre-filled with your project's stack, architecture, high-impact files, and required env vars. Your AI reads it on startup and starts with full context from the first message.\n\n## MCP Server (13 Tools)\n\n```bash\nnpx codesight --mcp\n```\n\nRuns as a Model Context Protocol server. Claude Code and Cursor call it directly to get project context on demand.\n\n```json\n{\n  \"mcpServers\": {\n    \"codesight\": {\n      \"command\": \"npx\",\n      \"args\": [\"codesight\", \"--mcp\"]\n    }\n  }\n}\n```\n\n**OpenAI Codex CLI** (`~\u002F.codex\u002Fconfig.toml`):\n\n```toml\n[mcp_servers.codesight]\ncommand = \"npx\"\nargs = [\"codesight\", \"--mcp\"]\nstartup_timeout_sec = 60\n```\n\n> **Codex timeout note:** `npx` has to resolve the package on first run which can exceed the default 30-second timeout. Set `startup_timeout_sec = 60` or install globally (`npm install -g codesight`) and use `command = \"codesight\"` instead — global installs start significantly faster.\n\n![MCP Server: Claude Code\u002FCursor ↔ codesight MCP Server → 6 specialized tools + session cache](assets\u002Fmcp-server.jpg)\n\n| Tool | What it does |\n|---|---|\n| `codesight_get_wiki_index` | Wiki catalog (~200 tokens) — read at session start |\n| `codesight_get_wiki_article` | Read one wiki article by name: `auth`, `database`, `payments`, etc. |\n| `codesight_lint_wiki` | Health check: orphan articles, missing cross-links |\n| `codesight_scan` | Full project scan (~3K-5K tokens) |\n| `codesight_get_summary` | Compact overview (~500 tokens) |\n| `codesight_get_routes` | Routes filtered by prefix, tag, or method |\n| `codesight_get_schema` | Schema filtered by model name |\n| `codesight_get_blast_radius` | Impact analysis before changing a file |\n| `codesight_get_env` | Environment variables (filter: required only) |\n| `codesight_get_hot_files` | Most imported files with configurable limit |\n| `codesight_get_events` | Background events: BullMQ queues, Celery tasks, Kafka topics, Redis pub\u002Fsub, EventEmitter |\n| `codesight_get_coverage` | Test coverage map: which routes and models have test files |\n| `codesight_refresh` | Force re-scan (results are cached per session) |\n\nYour AI asks for exactly what it needs instead of loading the entire context map. Session caching means the first call scans, subsequent calls return instantly.\n\n## AI Tool Profiles\n\n```bash\nnpx codesight --profile claude-code\nnpx codesight --profile cursor\nnpx codesight --profile codex\nnpx codesight --profile copilot\nnpx codesight --profile windsurf\n```\n\nGenerates an optimized config file for a specific AI tool. Each profile includes your project summary, stack info, high-impact files, required env vars, and tool-specific instructions on how to use codesight outputs. For Claude Code, this includes MCP tool usage instructions. For Cursor, it points to the right codesight files. Each profile writes to the correct file for that tool.\n\n## Visual Report\n\n```bash\nnpx codesight --open\n```\n\nOpens an interactive HTML dashboard in your browser. Routes table with method badges and tags. Schema cards with fields and relations. Dependency hot files with impact bars. Env var audit. Token savings breakdown. Useful for onboarding or just seeing your project from above.\n\n## GitHub Action\n\nAdd to your CI pipeline to keep context fresh on every push:\n\n```yaml\nname: codesight\non: [push]\njobs:\n  scan:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v4\n      - uses: actions\u002Fsetup-node@v4\n        with:\n          node-version: 20\n      - run: npm install -g codesight && codesight\n      - uses: actions\u002Fupload-artifact@v4\n        with:\n          name: codesight\n          path: .codesight\u002F\n```\n\n## Watch Mode and Git Hook\n\n**Watch mode** re-scans automatically when your code changes:\n\n```bash\nnpx codesight --watch\n```\n\nOnly triggers on source and config files (`.ts`, `.js`, `.py`, `.go`, `.prisma`, `.env`, etc.). Ignores `node_modules`, build output, and non-code files. Shows which files changed before each re-scan. Your config (disabled detectors, plugins) is preserved across re-scans.\n\n**Git hook** regenerates context on every commit:\n\n```bash\nnpx codesight --hook\n```\n\nContext stays fresh without thinking about it.\n\n## All Options\n\n```bash\nnpx codesight                              # Scan current directory\nnpx codesight .\u002Fmy-project                 # Scan specific directory\nnpx codesight --wiki                       # Generate wiki knowledge base\nnpx codesight --init                       # Generate AI config files\nnpx codesight --open                       # Open visual HTML report\nnpx codesight --html                       # Generate HTML report without opening\nnpx codesight --mcp                        # Start MCP server (13 tools)\nnpx codesight --blast src\u002Flib\u002Fdb.ts        # Show blast radius for a file\nnpx codesight --profile claude-code        # Optimized config for specific tool\nnpx codesight --watch                      # Watch mode (add --wiki to auto-regenerate wiki)\nnpx codesight --wiki --watch               # Watch + auto-regenerate wiki on changes\nnpx codesight --hook                       # Install git pre-commit hook (includes wiki)\nnpx codesight --benchmark                  # Detailed token savings breakdown\nnpx codesight --json                       # Output as JSON\nnpx codesight --mode knowledge             # Map .md knowledge base → KNOWLEDGE.md\nnpx codesight --mode knowledge ~\u002Fvault     # Map Obsidian vault or any .md folder\nnpx codesight --max-tokens 50000           # Trim output to fit token budget\nnpx codesight --since HEAD~5               # Show routes from last 5 commits only\nnpx codesight -o .ai-context               # Custom output directory\nnpx codesight -d 5                         # Limit directory depth\n```\n\n## How It Compares\n\n| | codesight | File concatenation tools | AST-based tools (e.g. code-review-graph) |\n|---|---|---|---|\n| **Parsing** | AST (TypeScript compiler) + regex fallback | None | Tree-sitter + SQLite |\n| **Token reduction** | 7x-12x base scan; 60-131x with targeted wiki queries | 1x (dumps everything) | 8x reported |\n| **Route detection** | 25+ frameworks, auto-detected | None | Limited |\n| **Schema parsing** | 8 ORMs with field types and relations | None | Varies |\n| **Blast radius** | BFS through import graph | None | Yes |\n| **AI tool profiles** | 5 tools (Claude, Cursor, Codex, Copilot, Windsurf) | None | Auto-detect |\n| **MCP tools** | 11 specialized tools with session caching | None | 22 tools |\n| **Setup** | `npx codesight` (zero deps, zero config) | Copy\u002Fpaste | `pip install` + optional deps |\n| **Dependencies** | Zero (borrows TS from your project) | Varies | Tree-sitter, SQLite, NetworkX, etc. |\n| **Language** | TypeScript (zero runtime deps) | Varies | Python |\n| **Scan time** | 185-290ms (small), 0.9-2.8s (10K files) | Varies | Under 2s reported |\n\ncodesight is purpose-built for the problem most developers actually have: giving their AI assistant enough context to be useful without wasting tokens on file exploration. It focuses on structured extraction (routes, schema, components, dependencies) rather than general-purpose code graph analysis.\n\n## Contributing\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FHouseofmvps\u002Fcodesight.git\ncd codesight\npnpm install\npnpm dev              # Run locally\npnpm build            # Compile TypeScript\npnpm test             # Run 27 tests\n```\n\nPRs welcome. Open an issue first for large changes.\n\n## License\n\nMIT\n\n---\n\n\u003Cdiv align=\"center\">\n\nIf codesight saves you tokens, [star it on GitHub](https:\u002F\u002Fgithub.com\u002FHouseofmvps\u002Fcodesight) so others find it too.\n\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FHouseofmvps\u002Fcodesight?style=for-the-badge&logo=github&color=gold)](https:\u002F\u002Fgithub.com\u002FHouseofmvps\u002Fcodesight\u002Fstargazers)\n\n\u003C\u002Fdiv>\n","codesight 是一个通用的AI上下文生成器，能够显著减少Claude Code、Cursor、Copilot等工具在对话中消耗的token数量。该项目采用TypeScript编写，具备零依赖、AST精度分析以及支持30多种框架检测和13种ORM解析器的特点。codesight适用于需要高效利用AI助手进行代码分析与理解的场景，尤其对于大型或复杂的代码库特别有用。它支持包括TypeScript、JavaScript、Python在内的14种编程语言，并且仅需一条`npx`命令即可运行，无需额外配置或API密钥。",2,"2026-06-11 03:52:04","high_star"]