This document provides essential context and guidelines for AI assistants working on the Git Intelligence project.
Git Intelligence is a full-stack web application that analyzes and visualizes Git repository statistics. It provides a comprehensive dashboard to track project activity, contributor performance, and codebase growth over time.
- Dashboard Overview: Key metrics (commits, contributors, file counts)
- Activity Analysis: Commit patterns by hour, day, month, and year
- Contributor Insights: Top contributors with commit counts and percentages
- File Composition: Language distribution via file extension charts
- Growth Tracking: Lines of Code (LOC) history over time
- Multi-Project Support: Manage projects containing multiple Git repositories
- Repository Upload: Upload ZIP archives of Git repositories for analysis
- Repository Sync: Fetch latest changes from local Git repositories with automatic cache invalidation
- Developer Analytics: Detailed contributor metrics including activity patterns, churn, fix/revert ratios, and longitudinal patterns
- Codebase Health: Hotspots, change coupling, stability, and complexity analysis
- Repository Evolution: Commit frequency, releases, growth curves, change bursts, and churn metrics
- Bus Factor & Ownership: Single maintainer risk, fragmentation, and owner churn analysis
- Social Network Analysis: Collaboration graphs, knowledge silos, and orphaned code detection
- Risk Analytics: Combined risk assessment with Code Coverage Overlay
- Cross-Repository Analytics: Aggregated analysis across all repositories in a project
- Batch Analysis & Jobs: Background job queue for "Analyze All" comprehensive repository/project analysis
- AI-Powered Analysis (Optional): Local Ollama integration for enhanced insights and natural language analysis
The project is organized as a monorepo with three main directories:
git-intelligence/
├── client/ # React frontend application
├── server/ # Node.js/Express backend API
└── package.json # Root package with workspace scripts
- Framework: React 19.2.0 with TypeScript
- Build Tool: Vite 7.2.4
- Styling: Tailwind CSS 4.1.17 (via
@tailwindcss/viteplugin) - Charts: Recharts 3.5.0
- Icons: Lucide React 0.554.0
- HTTP Client: Axios 1.13.2
- UI Components:
- @headlessui/react 2.2.9
- @heroicons/react 2.2.0
- Routing: @tanstack/react-router 1.139.3 (actively used with file-based routing)
- State Management:
- React Context API (
AppContext,NotificationContext) - React hooks (useState, useEffect) for local component state
- React Context API (
- Tables: @tanstack/react-table 8.21.3
- Utilities:
- clsx 2.1.1 (conditional class names)
- tailwind-merge 3.4.0 (Tailwind class merging)
- Dark Mode: System preference-based (via Tailwind's
darkMode: 'media')
- Runtime: Node.js (v18+)
- Framework: Express 5.1.0
- Language: TypeScript 5.9.3
- Git Operations: simple-git 3.30.0
- File Upload: multer 2.0.2
- ZIP Handling: adm-zip 0.5.16
- CORS: cors 2.8.5
- Persistence: LowDB 7.0.1 (JSON file-based database with schema versioning)
- Database File:
server/db.json(replacesprojects.json) - Dev Server: nodemon 3.1.11 with ts-node 10.9.2
- Testing: Vitest 2.1.8 with coverage support
- UUID: uuid 13.0.0 for generating IDs
- AI Integration: Ollama service integration (optional, for AI-powered analysis)
src/
├── api.ts # API client with TypeScript interfaces
├── main.tsx # React entry point with TanStack Router
├── index.css # Global styles
├── routeTree.gen.ts # Auto-generated route tree (TanStack Router)
├── context/
│ ├── AppContext.tsx # Global app state (projects, repositories)
│ ├── NotificationContext.tsx # Notification system
│ └── OllamaContext.tsx # Ollama settings context provider
├── hooks/
│ ├── useOllamaSettings.ts # Hook for managing Ollama settings (localStorage + API sync)
├── routes/ # File-based routing (TanStack Router)
│ ├── __root.tsx # Root route with layout
│ ├── index.tsx # Home/landing page
│ ├── projects.tsx # Projects management view
│ ├── dashboard.tsx # Dashboard route (no repo selected)
│ ├── dashboard.$repoPath.tsx # Dashboard for specific repository
│ ├── developer-analytics.tsx # Developer analytics route
│ ├── developer-analytics.$repoPath.tsx # Repo-specific developer analytics
│ ├── codebase-health.tsx # Codebase health route
│ ├── codebase-health.$repoPath.tsx # Repo-specific codebase health
│ ├── repository-evolution.tsx # Repository evolution route
│ ├── repository-evolution.$repoPath.tsx # Repo-specific evolution
│ ├── bus-factor-and-ownership.tsx # Bus factor route
│ ├── bus-factor-and-ownership.$repoPath.tsx # Repo-specific bus factor
│ ├── social-network-analysis.tsx # Social network analysis route
│ ├── social-network-analysis.$repoPath.tsx # Repo-specific SNA
│ ├── cross-repo-analytics.$projectId.tsx # Cross-repo developer analytics
│ ├── cross-repo-codebase-health.$projectId.tsx # Cross-repo health
│ ├── cross-repo-repository-evolution.$projectId.tsx # Cross-repo evolution
│ ├── cross-repo-bus-factor-and-ownership.$projectId.tsx # Cross-repo bus factor
│ ├── cross-repo-social-network-analysis.$projectId.tsx # Cross-repo SNA
│ └── settings.tsx # Dedicated settings page
└── components/
├── Layout.tsx # Main layout with sidebar (Headless UI)
├── ProjectsSidebar.tsx # Sidebar for project/repository selection
├── ProjectsList.tsx # List of projects
├── ProjectsView.tsx # Projects management view
├── UploadProjectModal.tsx # Modal for uploading repositories
├── DashboardView.tsx # Main dashboard view
├── SummaryCards.tsx # Summary metrics cards
├── ActivityChart.tsx # Activity visualization charts
├── AuthorList.tsx # Contributor list component
├── ExtensionChart.tsx # File extension distribution chart
├── LocChart.tsx # Lines of Code history chart
├── DeveloperAnalytics.tsx # Developer analytics component
├── DeveloperAnalyticsView.tsx # Developer analytics view wrapper
├── LongitudinalPatterns.tsx # Longitudinal patterns visualization
├── CodebaseHealth.tsx # Codebase health component
├── CodebaseHealthView.tsx # Codebase health view wrapper
├── RepositoryEvolution.tsx # Repository evolution component
├── RepositoryEvolutionView.tsx # Repository evolution view wrapper
├── BusFactorAndOwnership.tsx # Bus factor component
├── BusFactorAndOwnershipView.tsx # Bus factor view wrapper
├── SocialNetworkAnalysis.tsx # Social network analysis component
├── SocialNetworkAnalysisView.tsx # Social network analysis view wrapper
├── CrossRepoDeveloperAnalytics.tsx # Cross-repo developer analytics
├── CrossRepoDeveloperAnalyticsView.tsx # Cross-repo developer analytics view
├── CrossRepoCodebaseHealth.tsx # Cross-repo codebase health
├── CrossRepoCodebaseHealthView.tsx # Cross-repo codebase health view
├── CrossRepoRepositoryEvolution.tsx # Cross-repo evolution
├── CrossRepoRepositoryEvolutionView.tsx # Cross-repo evolution view
├── CrossRepoBusFactorAndOwnership.tsx # Cross-repo bus factor
├── CrossRepoBusFactorAndOwnershipView.tsx # Cross-repo bus factor view
├── CrossRepoSocialNetworkAnalysis.tsx # Cross-repo SNA
└── CrossRepoSocialNetworkAnalysisView.tsx # Cross-repo SNA view
src/
├── index.ts # Express server setup and routes
├── db.ts # Re-exports from db/ module (backward compatibility)
├── git/ # Git analysis modules
│ ├── index.ts # Re-exports all git analysis functions
│ ├── types.ts # TypeScript interfaces for all analytics
│ ├── stats.ts # Basic repository statistics
│ ├── developerAnalytics.ts # Developer analytics (churn, patterns, etc.)
│ ├── codebaseHealth.ts # Codebase health metrics
│ ├── coverage.ts # Code coverage parsing (LCOV)
│ ├── repositoryEvolution.ts # Repository evolution analysis
│ ├── busFactor.ts # Bus factor and ownership analysis
├── services/ # External service integrations
│ ├── ollama.ts # Ollama API client (connection, completion, analysis)
│ └── aiAnalysis.ts # AI-powered analysis generation
├── routes/ # API route handlers
│ ├── settings.ts # Settings management (Ollama configuration)
│ ├── socialNetwork.ts # Social network analysis
│ ├── utils.ts # Shared utility functions
│ └── __tests__/ # Test files for git analysis
│ ├── stats.test.ts
│ ├── developerAnalytics.test.ts
│ ├── codebaseHealth.test.ts
│ ├── repositoryEvolution.test.ts
│ ├── busFactor.test.ts
│ └── utils.test.ts
└── db/ # Database modules
├── database.ts # LowDB initialization and migrations
├── types.ts # Database schema types
├── projects.ts # Project CRUD operations
├── repositories.ts # Repository CRUD operations
├── cache.ts # Analysis result caching
└── __tests__/ # Test files for database
├── database.test.ts
├── projects.test.ts
├── repositories.test.ts
└── cache.test.ts
- Database:
server/db.json- LowDB JSON database with schema versioning- Schema Version: Currently v2 (supports automatic migration from v1)
- Structure:
projects: Array of project objects (id, name, description, timestamps)repositories: Array of repository objects (id, projectId, path, name, timestamps)analysisCache: Cached analysis results keyed by repository pathcodebaseHealthCache: Cached codebase health results keyed by repository pathschemaVersion: Current schema version number
- Migration: Automatic migration from old
projects.jsonformat (repositories as projects)
- Upload Directory:
server/uploads/- Temporary storage for uploaded ZIP files and extracted repositories
-
Component Structure
- Functional components with TypeScript
- Props interfaces defined inline or imported from
api.ts - React.FC type annotation for components
- Icons from
lucide-reactlibrary
-
Styling Approach
- Tailwind CSS utility classes
- Dark mode support via
dark:prefix - Responsive design with
md:,lg:,xl:breakpoints - Consistent color scheme: blue (primary), gray (neutral), indigo (brand)
-
API Communication
- Centralized API client in
api.tsusing Axios - Base URL:
VITE_API_BASE_URLenvironment variable (defaults tohttp://localhost:3001) - All API functions return typed Promises
- Error handling in components via try/catch
- Centralized API client in
-
State Management
- Global State: React Context API
AppContext: Manages projects and repositories list, loading states, and CRUD operationsNotificationContext: Manages toast notifications (info, success, error, loading)
- Local State: Component-level state with
useStateanduseEffect - Routing State: TanStack Router manages route parameters and navigation state
- Ollama Settings: Managed via
useOllamaSettingshook with localStorage caching and backend sync- Settings persisted in localStorage for immediate access
- Automatic sync with backend on mount and when settings change
- Optimistic updates with error rollback
- Global State: React Context API
-
Type Definitions
- Shared types/interfaces in
client/src/api.ts:GitStats- Basic repository statisticsAuthorStats- Basic contributor informationDeveloperAuthorStats- Extended contributor metricsDeveloperAnalytics- Developer analytics with longitudinal patternsCrossRepoDeveloperAnalytics- Cross-repository developer analyticsCodebaseHealth- Codebase health metrics (hotspots, coupling, stability, complexity)CrossRepoCodebaseHealth- Cross-repository codebase healthRepositoryEvolution- Repository evolution metricsCrossRepoRepositoryEvolution- Cross-repository evolutionBusFactorAndOwnership- Bus factor and ownership analysisCrossRepoBusFactorAndOwnership- Cross-repository bus factorSocialNetworkAnalysis- Social network analysisCrossRepoSocialNetworkAnalysis- Cross-repository social network analysisActivityStats- Activity patternsProject- Project metadataRepository- Repository metadataOllamaSettings- Ollama configuration (enabled, host, port, model, timeout)OllamaTestResult- Connection test result (success, message)
- Shared types/interfaces in
-
API Routes (
server/src/index.ts)- Projects:
GET /projects- List all projectsGET /projects/:id- Get project by IDPOST /projects- Create new project (requires name, optional description)PUT /projects/:id- Update project (name, description)DELETE /projects/:id- Delete project
- Repositories:
GET /repositories- List repositories (optional?projectId=<id>filter)GET /repositories/:id- Get repository by IDPOST /repositories- Add repository (requires projectId, path, optional name, replace flag)POST /repositories/:id/fetch- Fetch latest changes from remote (local repos only)DELETE /repositories/:id- Remove repository
- Upload:
POST /upload- Upload ZIP archive (multipart/form-data, requires projectId)
- Analytics (all support
?refresh=trueto bypass cache):GET /stats?path=<repo-path>- Basic repository statisticsGET /developer-analytics?path=<repo-path>- Developer analyticsGET /cross-repo-developer-analytics?projectId=<id>- Cross-repo developer analyticsGET /codebase-health?path=<repo-path>- Codebase health metricsGET /cross-repo-codebase-health?projectId=<id>- Cross-repo codebase healthGET /repository-evolution?path=<repo-path>- Repository evolutionGET /cross-repo-repository-evolution?projectId=<id>- Cross-repo evolutionGET /bus-factor-and-ownership?path=<repo-path>- Bus factor analysisGET /cross-repo-bus-factor-and-ownership?projectId=<id>- Cross-repo bus factorGET /social-network-analysis?path=<repo-path>- Social network analysisGET /cross-repo-social-network-analysis?projectId=<id>- Cross-repo SNA
- Jobs:
POST /repositories/:id/analyze-all- Start full analysis for a repositoryPOST /projects/:id/analyze-all- Start full analysis for all repositories in a projectGET /repositories/analyze-all/active- List all active analysis jobsGET /repositories/analyze-all/status?jobId=<id>- Get status of a specific job
- Cache:
POST /cache/clear- Clear analysis cache (optionalpathin body)
- Settings (Ollama Integration):
GET /settings/ollama- Get current Ollama settingsPUT /settings/ollama- Update Ollama settings (requires body withenabled?,host?,port?,model?,timeout?)POST /settings/ollama/test- Test Ollama connection (optional body with test settings)
- Projects:
-
Git Analysis (
server/src/git/)- Modular structure with separate files for each analysis type
- Uses
simple-gitfor Git operations - stats.ts: Basic statistics (commits, authors, activity, extensions, LOC)
- developerAnalytics.ts: Extended developer metrics (churn, fix/revert ratios, signed commits, longitudinal patterns)
- codebaseHealth.ts: Hotspots, change coupling, stability, complexity
- repositoryEvolution.ts: Commit frequency, releases, growth curves, change bursts, churn metrics
- busFactor.ts: Single maintainer risk, fragmentation, owner churn
- socialNetwork.ts: Collaboration graphs, knowledge silos, orphaned code
- utils.ts: Shared utilities for Git operations and data processing
- All analysis functions support caching via
useCacheparameter - Returns normalized data structures matching TypeScript interfaces
-
Ollama Service (
server/src/services/)- ollama.ts: Ollama API client
testConnection(settings): Test connection to Ollama instancegenerateCompletion(prompt, settings): Generate AI text completiongenerateAnalysis(context, analysisType, settings): Generate analysis for specific analytics typeisModelAvailable(model, settings): Check if model is installed in Ollama- Uses native
fetchAPI with AbortController for timeouts - Handles errors gracefully (connection failures, model not found, timeouts)
- aiAnalysis.ts: AI-powered analysis generation
- Integrates Ollama service with Git analytics
- Generates natural language insights for codebase health, developer analytics, etc.
- Context-aware prompts based on analysis type
- ollama.ts: Ollama API client
-
Data Persistence (
server/src/db/)- LowDB (JSON file-based database) with schema versioning
- database.ts: Database initialization, migrations, schema management
- projects.ts: Project CRUD operations (UUID-based IDs)
- repositories.ts: Repository CRUD operations (linked to projects)
- cache.ts: Analysis result caching (stats and codebase health)
- settings.ts: Ollama settings management (get/update settings with validation)
getOllamaSettings(): Returns current settings or defaultsupdateOllamaSettings(updates): Updates settings with validation (port range, timeout range, non-empty host/model)- Default settings:
{ enabled: false, host: 'localhost', port: 11434, model: 'llama3', timeout: 120000 }
- types.ts: Database schema type definitions (includes
OllamaSettingsinterface) - Automatic migration from old
projects.jsonformat - Prevents duplicate repositories by path within a project
- Cache management with TTL support (currently no expiration, manual clear only)
- Ollama settings stored in database with defaults:
{ enabled: false, host: 'localhost', port: 11434, model: 'llama3', timeout: 120000 }
-
File Upload Flow
- Multer saves to
uploads/directory (100MB limit) - ZIP extracted to
uploads/<filename>_extracted/ - Automatic detection of nested repository structure
- Validates Git repository (must have
.gitdirectory) - Requires
projectIdin form data (repositories belong to projects) - Optional
nameparameter for custom repository name - Optional
replaceflag to replace existing repository with same path - Original ZIP file cleaned up after extraction
- Extracted files remain in
uploads/directory (not cleaned up automatically)
- Multer saves to
-
TanStack Router File-Based Routing
- Routes defined as files in
client/src/routes/ - Route parameters use
$prefix (e.g.,$repoPath,$projectId) - Root route (
__root.tsx) provides layout and context providers - Route tree auto-generated in
routeTree.gen.ts(do not edit manually) - Navigation via
Linkcomponent oruseNavigate()hook
- Routes defined as files in
-
Route Structure
- Index routes:
/(home/landing) - Projects:
/projects(project management) - Repository routes: Use
$repoPathparameter (URL-encoded repository path) - Project routes: Use
$projectIdparameter (UUID) - Route examples:
/dashboard/$repoPath- Dashboard for specific repository/developer-analytics/$repoPath- Developer analytics for repository/cross-repo-analytics/$projectId- Cross-repo analytics for project
- Index routes:
-
Route Components
- Each route file exports a
Routeobject using TanStack Router's route creators - Route components access params via
useParams()hook - Loading states handled in route components
- Error boundaries can be added per route
- Each route file exports a
The application provides comprehensive Git repository analytics:
-
Basic Statistics (
/stats)- Total commits, authors, files
- Activity patterns (hour, day, month, year)
- File extension distribution
- Lines of Code (LOC) history
-
Developer Analytics (
/developer-analytics)- Extended contributor metrics (lines added/removed, net lines)
- Activity time windows (hour of day, day of week)
- Signed commits percentage
- Fix and revert commit ratios
- Code churn metrics
- Longitudinal patterns:
- Author activity over time (weekly/monthly)
- Onboarding curve (new contributors over time)
- Dormancy detection (inactive contributors)
-
Codebase Health (
/codebase-health)- Hotspots: Most frequently changed files and directories
- Change Coupling: Files that change together
- Stability: File age and change frequency analysis
- Complexity: Average diff sizes, largest diffs, most rewritten files
-
Repository Evolution (
/repository-evolution)- Commit frequency over time
- Release information (tags, dates)
- Growth curve (LOC and files over time)
- Change bursts (periods of high activity)
- Churn metrics (additions, deletions, net change)
-
Bus Factor & Ownership (
/bus-factor-and-ownership)- Single Maintainer Risk: Files/repos with one primary contributor
- Fragmentation: Files with too many contributors
- Owner Churn: Files that changed primary maintainer
-
Social Network Analysis (
/social-network-analysis)- Collaboration Graph: Network of contributors and their collaborations
- Knowledge Silos: Files with limited contributor access
- Orphaned Code: Files with no recent activity
-
Cross-Repository Analytics
- Aggregated metrics across all repositories in a project
- Cross-repo collaboration patterns
- Repository clusters (repos worked on by same teams)
- Synchronization patterns (commits across repos on same dates)
- User navigates to route (e.g.,
/dashboard/$repoPathor/developer-analytics/$repoPath) - Route component extracts
repoPathfrom route parameters - Component calls API function (e.g.,
getStats(repoPath)) fromapi.ts - Axios GET request to endpoint (e.g.,
/stats?path=<path>&refresh=false) - Backend analysis function:
- Checks cache first (unless
refresh=true) - If cached and valid, returns cached result
- Otherwise, validates Git repository
- Executes Git commands via
simple-git - Processes commit logs and file lists
- Caches result in database
- Returns structured statistics
- Checks cache first (unless
- Frontend receives data and updates component state
- Components re-render with new statistics
- Loading states and error handling via notifications
-
Creating Project:
- User navigates to
/projectsroute - User creates project via form (name, optional description)
POST /projectscreates project in databaseAppContextrefreshes projects list
- User navigates to
-
Adding Repository (Upload):
- User selects project and ZIP file
- FormData sent to
/uploadendpoint withprojectId - Backend extracts ZIP, finds Git repo root
- Repository added to database linked to project
AppContextrefreshes repositories list
-
Adding Repository (Path):
- User provides repository path
POST /repositorieswithprojectIdandpath- Repository added to database
AppContextrefreshes repositories list
-
Fetching Repository Changes:
- User clicks refresh button on individual repository or "Fetch All" on project
POST /repositories/:id/fetchfetches and pulls latest changes- Backend performs:
- Validates repository path exists and is a valid Git repository
- Runs
git fetch --all --pruneto fetch from all remotes - Attempts
git pullfor current branch (if upstream is configured) - Compares commit hashes before and after to detect changes
- Clears analysis cache if changes were detected
- Frontend displays success/info notification with fetch results
- For "Fetch All": Sequentially fetches all repositories in project and shows summary
- Cache is automatically cleared for repositories with changes, ensuring fresh analytics
-
Removing Project:
- User clicks delete button
DELETE /projects/:idremoves project- All associated repositories are also removed (cascade delete)
AppContextrefreshes data
-
Removing Repository:
- User clicks delete button
DELETE /repositories/:idremoves repositoryAppContextrefreshes repositories list
# Install all dependencies
npm run install:all
# Start both frontend and backend concurrently
npm run dev- Backend: Runs on
http://localhost:3001 - Frontend: Runs on
http://localhost:5173(Vite dev server)
docker compose up --build- Frontend (containerized):
http://localhost:5173 - Backend API (containerized):
http://localhost:3001
For SSH-based Git remotes in Docker, use the SSH override compose file:
export SSH_PRIVATE_KEY_PATH=/absolute/path/to/id_ed25519
docker compose -f docker-compose.yml -f docker-compose.ssh.yml up --build- Server container includes
gitandopenssh-client - SSH key is mounted read-only to
/run/secrets/git_ssh_key GIT_SSH_COMMANDis configured indocker-compose.ssh.yml
For path-based repository add inside Docker, use the repository mount override:
export REPOSITORIES_HOST_PATH=/absolute/path/to/your/repos
docker compose -f docker-compose.yml -f docker-compose.repositories.yml up --build- Host path mounts to
/repositoriesin the server container - Add repositories by container path (example:
/repositories/my-repo)
# Frontend build
cd client && npm run build
# Backend build
cd server && npm run buildRoot (package.json):
dev: Runs both client and server concurrentlyinstall:all: Installs dependencies for root, client, and server
Client (client/package.json):
dev: Vite development serverbuild: TypeScript compilation + Vite buildpreview: Preview production buildlint: ESLint check
Server (server/package.json):
dev: Nodemon with ts-node (auto-reload)build: TypeScript compilationstart: Run compiled JavaScripttest: Run Vitest tests oncetest:watch: Run Vitest in watch modetest:coverage: Run tests with coverage report
- Backend expects valid Git repositories (must have
.gitdirectory) - Uploaded ZIPs are extracted and Git repo root is auto-detected
- Path-based repository identification within a project (duplicates prevented per project)
- Repositories must belong to a project (cannot exist standalone)
- LOC history is approximate, calculated from
git log --numstat - Uses cumulative approach: adds (added - deleted) lines per commit
- Negative LOC values are normalized to 0
- Based on commit dates, not file system timestamps
- Extracted from
git ls-files(tracked files only) - Extension is last part after final dot (e.g.,
file.test.js→js) - Files without extensions categorized as
no-extension
- Backend hardcoded to port 3001 in
server/src/index.ts - Frontend API base URL configurable via
VITE_API_BASE_URLinclient/src/api.ts - Optional server storage paths:
DB_FILE_PATHfor LowDB JSON file locationUPLOAD_DIRfor upload/extraction directory location
- Uses system preference (
prefers-color-scheme) - Tailwind
dark:classes used throughout components - No manual toggle (system preference only)
- Uses Headless UI Dialog for mobile sidebar
- Desktop sidebar is fixed (72 width units)
- Projects sidebar (
ProjectsSidebar) is separate and shows projects/repositories - Navigation handled by TanStack Router with file-based routes
- Root route (
__root.tsx) wraps all routes withLayout,AppProvider, andNotificationProvider
- Strong TypeScript usage throughout
- Shared types between frontend and backend via separate definitions
- API responses typed via interfaces in
api.ts
- Create component in
client/src/components/ - Import Recharts components as needed
- Follow existing chart patterns (see
ActivityChart.tsx,LocChart.tsx) - Create a view wrapper component if needed (see
*View.tsxcomponents) - Add route in
client/src/routes/if it's a new page - Ensure responsive design with Tailwind classes
- Add route handler in
server/src/index.ts - Implement business logic in appropriate module:
- Git analysis: Add function to
server/src/git/(create new file or extend existing) - Database operations: Add function to
server/src/db/(projects.ts, repositories.ts, or cache.ts)
- Git analysis: Add function to
- Add corresponding function in
client/src/api.ts - Define TypeScript interfaces:
- Backend: Add to
server/src/git/types.tsorserver/src/db/types.ts - Frontend: Add to
client/src/api.ts
- Backend: Add to
- Create route component in
client/src/routes/if needed - Create view component in
client/src/components/if needed - Update
AppContextif it affects global state
- Edit appropriate file in
server/src/git/:stats.tsfor basic statisticsdeveloperAnalytics.tsfor developer metricscodebaseHealth.tsfor health metricsrepositoryEvolution.tsfor evolution analysisbusFactor.tsfor bus factor analysissocialNetwork.tsfor social network analysis
- Use
simple-gitmethods for Git operations - Use caching utilities from
server/src/db/cache.tsif appropriate - Return data in format matching TypeScript interfaces from
git/types.ts - Update frontend types in
api.tsif structure changes - Add tests in
server/src/git/__tests__/if adding new functionality
- Use Tailwind utility classes
- Follow existing color scheme (blue, gray, indigo)
- Ensure dark mode support with
dark:variants - Test responsive breakpoints
When implementing new features or making significant changes, always update the following:
README.md: Update feature lists and architecture diagrams if necessary.RELEASE.md: Add a new entry or update the current version's highlights.AGENTS.md: Update the project overview, tech stack, and structure if they have changed. Update, refine it concisely to keep it short and accurate. Remove any outdated information and ensure it reflects the current state of the codebase and architecture.
- TypeScript: Strict typing, prefer interfaces over types for objects
- React: Functional components, hooks-based patterns
- Naming:
- Components: PascalCase (
SummaryCards.tsx) - Functions: camelCase (
getStats,loadProjects) - Files: Match component/function name
- Components: PascalCase (
- Imports: Group by source (React, libraries, local)
- Formatting: Follow existing indentation (2 spaces)
- Test Framework: Vitest 2.1.8 with coverage support
- Test Location:
server/src/**/__tests__/ - Coverage: Generated in
server/coverage/directory - Test Commands:
npm test- Run all tests oncenpm run test:watch- Watch mode for developmentnpm run test:coverage- Generate coverage report
- Test Structure:
- Git analysis tests:
server/src/git/__tests__/ - Database tests:
server/src/db/__tests__/ - External dependencies (simple-git, db) are mocked
- Tests use proper 40-character git commit hashes in mocks
- Git analysis tests:
- Frontend Testing: Vitest + React Testing Library configured
- Hook tests:
client/src/hooks/__test__/useOllamaSettings.test.ts - Component tests:
client/src/components/__test__/ - Context tests:
client/src/context/__test__/
- Hook tests:
- Ollama Integration Tests:
- Service tests:
server/src/services/__tests__/ollama.test.ts - Settings route tests:
server/src/routes/__tests__/settings.test.ts - Database settings tests:
server/src/db/__tests__/settings.test.ts
- Service tests:
- See:
server/TESTING.mdfor detailed testing guidelines
- Environment variable configuration for ports/URLs
- Database migration from LowDB to proper database (PostgreSQL, MongoDB, etc.)
- Authentication/authorization
- Real-time updates (WebSockets)
- Export functionality (PDF, CSV)
- More detailed commit analysis
- Branch visualization
- File change history
- Performance optimizations for large repositories
- Cache expiration/TTL for analysis results
- API rate limiting
- Background job processing for large analyses
- Enhanced AI analysis prompts with more context
- Streaming AI responses for better UX
- Repository cloning from remote URLs (GitHub, GitLab, etc.)
Last Updated: February 2026 - Updated to reflect:
-
Batch Analysis & Background Job Queue
-
Dedicated Settings Page migration
-
Code Coverage Overlay in Risk Analytics
-
Enhanced Repository Evolution with trendlines
-
Documentation update requirements for AI assistants
-
Ollama integration for AI-powered analysis
-
Settings management API and UI
-
Ollama service module with connection testing
-
Frontend hooks for Ollama settings management
-
Comprehensive test coverage for Ollama features
-
TanStack Router implementation with file-based routing
-
Project/Repository hierarchy (Projects contain Repositories)
-
LowDB database with schema versioning and caching
-
Comprehensive analytics features (Developer Analytics, Codebase Health, Repository Evolution, Bus Factor, Social Network Analysis)
-
Cross-repository analytics capabilities
-
React Context API for global state management
-
Vitest testing framework
-
Modular backend structure (db/ and git/ subdirectories)
Maintainer Notes: This is a working application with active development. Always check current implementation before making assumptions. The codebase has evolved significantly from the original simple dashboard to a comprehensive Git analytics platform.