Skip to content

AI-powered tool for codebase analysis, documentation generation, and Markdown rendering with multi-language support and repository structure visualization.

Notifications You must be signed in to change notification settings

alienzhou/project-context-engine

Repository files navigation

Project Context Engine

An AI-powered project context analysis engine for codebase analysis, documentation generation, and Markdown rendering.

🎨 Special Note: This project is entirely built using the Vibe Coding approach

🌐 Languages / θ―­θ¨€ζ”―ζŒ

πŸš€ Features

πŸ“Š Code Analyzer

  • Intelligent Code Analysis: Analyze codebase structure and functionality using AI technology
  • Automatic Documentation Generation: Generate project summaries, API documentation, and code explanations
  • Repository Map: Create symbol mapping diagrams of codebases for easy project structure understanding
  • Language Filtering: Support specifying particular languages for analysis, improving analysis efficiency and precision
  • Multi-language Support: Support TypeScript, JavaScript, Python, Java, Go, C++, and other programming languages
  • Tree-sitter Parsing: Use Tree-sitter for precise syntax analysis

🎨 Markdown Renderer

  • High-quality Rendering: Render Markdown files into beautiful HTML
  • Mermaid Chart Support: Support flowcharts, sequence diagrams, class diagrams, and other chart types
  • Theme Switching: Support both dark and light theme modes
  • Batch Processing: Support batch rendering of multiple files
  • Code Highlighting: Built-in syntax highlighting functionality

πŸ›  Tech Stack

  • TypeScript: Type-safe JavaScript development
  • pnpm: Efficient package management and monorepo support
  • Tree-sitter: Precise code syntax analysis
  • AI SDK: Integration with multiple AI services (Amazon Bedrock, Azure)
  • Mermaid: Chart and flowchart rendering
  • Winston: Logging management

πŸ“¦ Project Structure

project-context-engine/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ analyzer/           # πŸ” Code Analyzer
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ code-analyzer/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ agent/     # AI agent functionality
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ parser/    # Code parser
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ reading/   # Code reading analysis
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ repomap/   # Repository mapping generation
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ structure/ # Project structure analysis
β”‚   β”‚   β”‚   β”‚   └── summary/   # Code summarization functionality
β”‚   β”‚   β”‚   └── utils/         # Utility functions
β”‚   β”‚   └── processed/         # Analysis result output
β”‚   └── render/             # 🎨 Markdown Renderer
β”‚       β”œβ”€β”€ src/
β”‚       β”œβ”€β”€ data/              # Markdown source files
β”‚       └── scripts/           # Rendering scripts
β”œβ”€β”€ packages/
β”‚   └── common/             # πŸ“š Shared codebase
β”œβ”€β”€ test-multilang/         # πŸ§ͺ Multi-language test cases
β”œβ”€β”€ docs/                   # πŸ“– Documentation
β”‚   β”œβ”€β”€ en/                 # English documentation
β”‚   └── zh/                 # Chinese documentation
└── ...

πŸš€ Quick Start

Install Dependencies

pnpm install

Build Project

# Build entire project
pnpm build

# Build specific packages separately
pnpm build:common    # Build shared package
pnpm build:analyzer  # Build code analyzer

Run Code Analyzer

# Start code analyzer
pnpm start

# Development mode
pnpm dev

Use Markdown Renderer

# Enter renderer directory
cd apps/render

# Render single file
npm run render

# Render all files
npm run render:all

# Render with light theme
npm run render:all:light

πŸ“‹ Available Scripts

Global Scripts

pnpm build          # Build all packages
pnpm dev            # Development mode
pnpm start          # Start analyzer application
pnpm test           # Run tests
pnpm typecheck      # TypeScript type checking
pnpm lint           # Code linting
pnpm format         # Code formatting
pnpm clean          # Clean build files

Code Analyzer Specific

pnpm start                              # Start analyzer
cd apps/analyzer && pnpm test-repomap  # Test repository mapping functionality

# Repository Map language filtering functionality
cd apps/analyzer
node dist/code-analyzer/repomap/cli.js <directory> --language python    # Analyze only Python files
node dist/code-analyzer/repomap/cli.js <directory> -l typescript        # Analyze only TypeScript files
node test-repomap.js --language java                                    # Test specific language

πŸ”§ Development Guide

Add Dependencies

Use pnpm workspace to add dependencies for specific packages:

# Add dependency for analyzer
pnpm --filter @project-context-engine/analyzer add <dependency>

# Add dependency for renderer
pnpm --filter @project/render add <dependency>

# Add dependency for shared package
pnpm --filter @project-context-engine/common add <dependency>

Run Package-specific Scripts

pnpm --filter <package-name> <script>

Dependencies

The project uses workspace protocol to manage internal dependencies:

{
  "dependencies": {
    "@project-context-engine/common": "workspace:*"
  }
}

🌟 Key Features

Intelligent Code Analysis

  • Automatically identify project architecture and design patterns
  • Generate detailed code documentation and explanations
  • Create project structure trees and dependency relationship diagrams

AI-driven Documentation Generation

  • Leverage large language models to understand code logic
  • Automatically generate README, API documentation
  • Provide code improvement suggestions

Multi-format Output

  • Markdown format analysis reports
  • HTML format visualization documentation
  • JSON format structured data

πŸ“š Documentation

The project supports bilingual documentation in Chinese and English:

Detailed Documentation

πŸ“„ License

ISC License

🀝 Contributing

Welcome to submit Issues and Pull Requests to help improve the project.


Project Context Engine - Making code analysis and documentation generation simple and efficient πŸš€

About

AI-powered tool for codebase analysis, documentation generation, and Markdown rendering with multi-language support and repository structure visualization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published