Skip to content

enesimo16/telemetry-code-intelligence

Repository files navigation

Telemetry — Deep Space Code Intelligence

A Mars-mission-themed AI code review, refactoring & architecture assistant.

Multi-provider LLM analysis (Gemini, Groq, local Ollama), a gamified review console, prompt-injection defenses, real-time telemetry, and a JWT-secured tunnel that injects AI-generated code straight into VS Code.

.NET 8 Next.js React TypeScript PostgreSQL SignalR Docker License

Project status — This is a personal / educational work-in-progress ("Mission Control"), not a production service. It is shared publicly as a portfolio and reference implementation. See Security & configuration before running it yourself.


Overview

Telemetry (internal codename CoderAI) reimagines the code-review experience as a deep-space mission console. You paste a snippet or point it at a local workspace, pick an AI "instrument", and the platform runs a structured review — an executive summary, actionable improvements, and a numeric quality score — while streaming everything back through a live, NASA-flight-deck-inspired UI.

It is a full monorepo spanning four surfaces:

Surface Stack Role
Backend API .NET 8, Clean Architecture, EF Core, SignalR Auth, agent orchestration, telemetry, real-time hub
Web console Next.js 16, React 19, Tailwind 4 The Mission Control UI you see below
VS Code extension TypeScript, SignalR client "Ground Station" — receives AI code injections in-editor
CLI Node.js Connects a local workspace to the console for agent-mode analysis

Screenshots

Mission Control Dashboard

The command deck: pick an instrument, toggle Agent vs Assistant mode, and transmit code for analysis. XP / level progression lives in the top bar.

Mission Control Dashboard

Assistant Mode — Code Review

Paste a snippet, choose a provider (Groq / Gemini / local), and run a full structured review.

Assistant mode with a code snippet

Telemetry Metrics Console

A live vector HUD: session counts, agent-activity allocations, model-latency maps, security-shield diagnostics, and gateway-traffic ingestion — polled every 10s.

Telemetry Metrics Console


Features

  • Multi-provider AI analysis — routes reviews across Google Gemini 2.5 Flash, Groq, and a local Ollama model (qwen2.5-coder) so you can trade cost, speed, and privacy per request.
  • Agent & Assistant modesAssistant reviews a pasted snippet; Agent connects to a local workspace (via the CLI) and reasons over real files with tools like explain, refactor, unit-test, security-audit, analyze, and rag-query.
  • Structured, hallucination-resistant reviews — strict system prompts force an Executive Summary → Actionable Improvements → Score shape instead of free-form rambling.
  • RAG engine — global and user-specific retrieval-augmented context built on vector embeddings for grounded answers.
  • Gamification with anti-cheat — parses AI scores into an XP / Level system, backed by a SHA-256 code-hashing guard in the database to prevent XP farming from resubmitted code.
  • Security shield — prompt-injection and homoglyph-obfuscation detection, JWT auth with silent refresh rotation, per-endpoint rate limiting, and API-key hashing for external clients.
  • Real-time VS Code injection — a JWT-secured SignalR tunnel (CodeHub) pushes AI-generated code from the web straight into the editor.
  • Live telemetry — a mission-control metrics console with latency maps, gateway traffic, and security diagnostics.
  • Isolated code sandbox — a locked-down, network-less container for running untrusted code.

Architecture

CoderAI/
├── CoderAI.Domain/          # Entities & core domain (no dependencies)
├── CoderAI.Application/     # Interfaces, DTOs, use-case contracts
├── CoderAI.Infrastructure/  # EF Core, external integrations
├── CoderAI.Api/             # ASP.NET Core Web API + SignalR CodeHub
│   ├── Controllers/         #   Auth, CodeReview, Metrics, Gateway, Rewards, ...
│   ├── Hubs/                #   CodeHub — real-time editor tunnel
│   ├── Services/            #   Agent orchestration, AI providers, security
│   └── Middlewares/         #   API-key auth, request pipeline
├── CoderAI.Tests/           # xUnit test suite
├── frontend/                # Next.js 16 Mission Control web console
├── telemetry-extension/     # VS Code "Ground Station" extension
├── telemetry-cli/           # Local workspace bridge CLI
└── docker-compose.yml       # postgres, ollama, api, ui, sandbox

The backend follows Clean Architecture — dependencies point inward (Api → Application → Domain), with infrastructure and AI providers plugged in at the edges.

Tech stack: .NET 8, Entity Framework Core, ASP.NET Identity, JWT Bearer, SignalR, FluentValidation, Serilog · Next.js 16, React 19, TailwindCSS 4, Axios, @microsoft/signalr, react-markdown · PostgreSQL (prod) / SQLite (dev) · Docker Compose.


Quick start

Prerequisites

1. Backend (development uses SQLite — zero external services)

cd CoderAI.Api

# Provide a JWT signing key and an AI key via user-secrets (never commit these)
dotnet user-secrets set "JwtSettings:Secret" "a-random-string-at-least-32-characters-long"
dotnet user-secrets set "GeminiSettings:ApiKey" "YOUR_GEMINI_API_KEY"   # optional

dotnet run   # -> http://localhost:5109  (Swagger at /swagger)

2. Web console

cd frontend
cp .env.example .env.local     # points the UI at http://localhost:5109
npm install
npm run dev                    # -> http://localhost:3000

Open http://localhost:3000, request access, and log in.

3. Everything at once with Docker

cp .env.example .env           # fill in POSTGRES_PASSWORD, JWT_SECRET, GEMINI_API_KEY
docker compose up --build

This brings up PostgreSQL, Ollama, the API, the web UI, and the isolated sandbox on one network.


Security & configuration

No secrets are committed to this repository. All keys and credentials are supplied at runtime through environment variables, .NET user-secrets, or git-ignored files:

What Where it goes Template
JWT signing secret JwtSettings__Secret env / user-secrets
Database connection ConnectionStrings__DefaultConnection env appsettings.Production.example.json
Gemini / Groq keys GeminiSettings__ApiKey env / user-secrets
SMTP credentials EmailSettings__* env / user-secrets
Docker stack secrets root .env (git-ignored) .env.example
Frontend API URLs frontend/.env.local (git-ignored) frontend/.env.example

appsettings.json ships with empty secret fields on purpose; in Development the app falls back to a clearly-labelled throwaway key, and in Production it refuses to start if a real JwtSettings__Secret is not provided.

Rotate any key that ever touched a real deployment before making a fork public.


Tests

dotnet test                          # backend (xUnit)
cd frontend && npx playwright test   # end-to-end UI (Playwright)

License

Released under the MIT License — see LICENSE.

Built with a love of clean architecture and a good Mars-landing metaphor.

About

An advanced AI-powered code analysis platform built with .NET 8, Onion Architecture, and Llama 3. Features include security auditing, refactoring suggestions, and automated unit test generation.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages