How andreagriffiths11/teamxray works
Project type and purpose
• This is a VS Code extension (“Team X-Ray”) written in TypeScript that augments GitHub Copilot with team expertise insights.
• It lives in the VS Code Extension Host, provides commands (right-click file, command-palette), spins up a Webview UI, performs Git analysis, and calls GitHub’s Model Context Protocol (MCP) or falls back to local Git.
File structure
• Top-level:
• package.json, tsconfig.json, webpack.config.js → build & package config
• src/extension.ts → VS Code activation & command registration
• src/core/… → service classes (copilot-mcp-service, expertise-analyzer, tree-provider, webview, token-manager)
• src/types → domain types (Expert)
• Build: webpack bundles into the .vsix
• Config: .github/workflows → CI/CD pipeline
README insights
• Calls out:
• Real Git Analysis (commit history parsing)
• AI Analysis via GitHub Models API (MCP)
• Offline fallback to local Git
• Modern Webview UI for results
Main components & relationships
a. VS Code Extension Host
– extension.ts registers commands & lifecycle hooks
b. Command & Language Integration
– Command in context menu / command-palette triggers core services
c. Core Services Layer
– TokenManager loads GITHUB_TOKEN
– GitAnalysis (in expertise-analyzer) parses commit history via child_process or Git lib
– CopilotMCPService wraps calls to GitHub’s Models API over the MCP protocol
– Fallback logic detects MCP availability and switches to local analysis
d. UI Layer (Webview)
– ExpertiseWebview builds/updates the HTML + JS UI
– TreeProvider exposes an explorer view of expertise hierarchy
e. External Systems
– Local Git binary & repo on disk
– GitHub MCP server (GPT-4o) via Model Context Protocol
Architectural patterns & design principles
• Modular service classes (single responsibility per file in src/core)
• Asynchronous event-driven flow (VS Code commands → Promises → Webview updates)
• Dependency injection of TokenManager into CopilotMCPService & Analyzer
• Fallback strategy pattern for online vs offline
Technologies & frameworks
• TypeScript + Node.js 20+
• VS Code Extension API
• Git CLI or Node Git library
• GitHub Model Context Protocol (MCP) client
• Webview API for UI
• Webpack for bundling extension
– VS Code Host (left side)
– Core Services (center)
– External Systems (right side)
1. User triggers command → extension.ts
2. extension.ts calls TokenManager → GitAnalysis → CopilotMCPService
3. CopilotMCPService ↔ MCP Server (GPT-4o)
4. If MCP fails → GitAnalysis offline path
5. Results passed to ExpertiseWebview & TreeProvider
6. Webview UI renders insights back to user
– Green for external dependencies (Git, MCP Server)
– Yellow for UI components (Webview, TreeProvider)
d. Labels & annotations:
Essential elements
• Component boundaries (VS Code Extension Host vs external systems)
• Clear labels on modules, protocols, and data payloads