Technical Briefing: codesight

Overview

codesight is an AI context generator that reduces token waste in AI-assisted development workflows. It analyzes codebases and generates structured knowledge bases, working with Claude Code, Cursor, Copilot, Codex, and similar tools. The repository contains 438 files across TypeScript, JSON, Python, and other languages, with 149 tests and 14 MCP tools. Primary entry point is src/index.ts.

What It Does

codesight generates a persistent .codesight/wiki/ knowledge base from AST analysis, avoiding LLM calls entirely. It supports 30+ framework detectors and 14 ORM parsers across TypeScript, Python, Go, Rust, Java, PHP, and other languages. TypeScript projects receive full AST precision; other languages use regex-based detection. Commands include --wiki, --mcp, --blast, and --profile for tool-specific optimization.

How It Is Wired

Execution flows through src/index.ts which orchestrates the pipeline. The import graph contains 84 internal modules with 192 edges and 2 circular dependencies. Key modules:

  • src/types (Ca: 49, Ce: 0) — hub module with 49 dependents; stability risk
  • src/core (Ca: 3, Ce: 19, instability: 0.86) — high churn point
  • src/scanner (Ca: 17, Ce: 1, instability: 0.06) — scanner module
  • src/mcp-server (Ca: 0, Ce: 17, instability: 1) — MCP tool server

Oversized files exceed 1,190 lines (src/scanner.ts, src/detectors/routes.ts, src/detectors/schema.ts). Four files have max indentation depth of 8 (src/ast/extract-python.ts, plugins/ast/python/src/lib.rs, plugins/ast/golang/main.go). Import cycles exist between src/plugins/skills/index.ts and src/plugins/skills/formatter.ts. Six duplicated 6-line blocks appear across 22 files, primarily in plugin runtimes.

How To Use It

Install via npx codesight in any project root. No configuration or API keys required. Commands documented in README:

npx codesight --wiki                       # Generate wiki knowledge base
npx codesight --mcp                        # Start as MCP server (14 tools)
npx codesight --blast src/lib/db.ts        # Show blast radius for a file
npx codesight --profile claude-code        # Generate optimized config

Setup requires no environment variables or keys per the README. The --native-ast flag enables AST plugins for additional languages (see docs/wasm-plugins.md).

Code Health & Issues

Findings from static analysis of 87 code files:

  • HIGH — Pin third-party GitHub Actions to commit SHA (.github/workflows): dtolnay/rust-toolchain@stable, swatinem/rust-cache@v2, pnpm/action-setup@v4, softprops/action-gh-release@v2 all use version tags that can shift. Fix: replace @vN with 40-character commit SHAs.
  • HIGH — Workflows push to default branch without pull request (.github/workflows/codesight.yml): git push lands on the deploying branch with no test gate. Fix: push to a bot branch and open a pull request, or restrict to tag refs.
  • MEDIUM — Declare least-privilege permissions for GITHUB_TOKEN (2 workflows declare no permissions): token inherits repository default, enabling push or release operations from within CI. Fix: add permissions: contents: read at workflow top and widen per job as needed.
  • MEDIUM — Enable Dependabot or Renovate (5 manifests, no update bot): unpatched advisories until manual audit. Fix: commit .github/dependabot.yml covering package ecosystems and github-actions.
  • MEDIUM — Pin container base image by digest (tests/fixtures/repotype-microservices-docker/auth/Dockerfile): node:20 is mutable. Fix: use image:tag@sha256:<digest> and enable Dependabot Docker ecosystem.
  • MEDIUM — Gate pull requests on dependency vulnerability scan (no dependency scan in CI): known-vulnerable packages may reach build uncaught. Fix: add dependency-review-action on pull_request or osv-scanner on push and schedule.
  • MEDIUM — Set persist-credentials: false on checkout (.github/workflows/ast-plugins.yml): token remains in .git/config for later steps. Fix: add with: persist-credentials: false and pass explicit token only to pushing step.
  • MEDIUM — Add non-root USER to image (tests/fixtures/repotype-microservices-docker/auth/Dockerfile): no USER directive; root process against every mounted volume. Fix: create unprivileged user, chown needed paths, end Dockerfile with USER.
  • LOW — Set timeout-minutes on workflow jobs (4 jobs declare no timeout): wedged step runs to six-hour platform default. Fix: add realistic timeout-minutes per job.
  • LOW — Add repository convention files: missing .editorconfig, .gitattributes, formatter config. Fix: add .editorconfig, .gitattributes with text=auto eol=lf, and formatter configuration.

The Bottom Line

codesight delivers practical token savings by generating structured codebase context from AST analysis rather than LLM inference. The tool works immediately via npx across 25+ OSS projects and 14 languages. However, the codebase shows stability risks from its own hub module (src/types), oversized files exceeding 1,190 lines, import cycles in plugin skills, and Action pinning gaps that should be addressed before recommending adoption in production CI pipelines. Teams comfortable with TypeScript tooling and aware of the measured health findings will see the most value.