mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
refactor: restructure monorepo into Claude Code plugin layout
Move packages/{core,dashboard,skill} into understand-anything-plugin/ to
conform to the Claude Code plugin format. Add .claude-plugin/marketplace.json
for plugin discovery. Update workspace config and docs accordingly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"version": 1,
|
||||
"name": "understand-anything",
|
||||
"description": "AI-powered codebase understanding — analyze, visualize, and explain any project",
|
||||
"owner": {
|
||||
"name": "Lum1104"
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "understand-anything",
|
||||
"description": "Multi-agent codebase analysis with interactive dashboard, guided tours, and skill commands",
|
||||
"version": "1.0.0",
|
||||
"source": "./understand-anything-plugin"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,9 +5,12 @@ An open-source tool combining LLM intelligence + static analysis to produce inte
|
||||
|
||||
## Architecture
|
||||
- **Monorepo** with pnpm workspaces
|
||||
- **packages/core** — Shared analysis engine (types, persistence, tree-sitter plugin, LLM prompt templates)
|
||||
- **packages/dashboard** — React + TypeScript web dashboard (React Flow, Monaco Editor, Zustand, TailwindCSS)
|
||||
- **packages/skill** — Claude Code skills (`/understand-chat`, `/understand-diff`, `/understand-explain`, `/understand-onboard`)
|
||||
- **understand-anything-plugin/** — Claude Code plugin containing all source code:
|
||||
- **understand-anything-plugin/packages/core** — Shared analysis engine (types, persistence, tree-sitter plugin, LLM prompt templates)
|
||||
- **understand-anything-plugin/packages/dashboard** — React + TypeScript web dashboard (React Flow, Monaco Editor, Zustand, TailwindCSS)
|
||||
- **understand-anything-plugin/src** — Skill TypeScript source for `/understand-chat`, `/understand-diff`, `/understand-explain`, `/understand-onboard`
|
||||
- **understand-anything-plugin/skills** — Skill definitions
|
||||
- **understand-anything-plugin/agents** — Agent definitions
|
||||
|
||||
## Key Commands
|
||||
- `pnpm install` — Install all dependencies
|
||||
@@ -15,9 +18,9 @@ An open-source tool combining LLM intelligence + static analysis to produce inte
|
||||
- `pnpm --filter @understand-anything/core test` — Run core tests
|
||||
- `pnpm dev:dashboard` — Start dashboard dev server
|
||||
|
||||
## Key Commands (updated)
|
||||
- `pnpm --filter @understand-anything/skill build` — Build skill package
|
||||
- `pnpm --filter @understand-anything/skill test` — Run skill tests
|
||||
## Key Commands (plugin)
|
||||
- `pnpm --filter @understand-anything/skill build` — Build the plugin package
|
||||
- `pnpm --filter @understand-anything/skill test` — Run plugin tests
|
||||
|
||||
## Phase 2 Features
|
||||
- Fuzzy search via Fuse.js (SearchEngine in core)
|
||||
|
||||
@@ -1,157 +1,206 @@
|
||||
# Understand Anything
|
||||
<h1 align="center">Understand Anything</h1>
|
||||
|
||||
An open-source tool that combines LLM intelligence with static analysis to help anyone understand any codebase — from junior developers to product managers.
|
||||
<p align="center">
|
||||
<strong>Turn any codebase into an interactive knowledge graph you can explore, search, and ask questions about.</strong>
|
||||
</p>
|
||||
|
||||
## Current Status
|
||||
<p align="center">
|
||||
<a href="#-quick-start"><img src="https://img.shields.io/badge/Quick_Start-blue?style=for-the-badge" alt="Quick Start" /></a>
|
||||
<a href="https://github.com/Lum1104/Understand-Anything/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License: MIT" /></a>
|
||||
<a href="https://docs.anthropic.com/en/docs/claude-code"><img src="https://img.shields.io/badge/Claude_Code-Plugin-8A2BE2?style=for-the-badge" alt="Claude Code Plugin" /></a>
|
||||
</p>
|
||||
|
||||
**Phase 4 complete.** The core analysis engine, web dashboard, and Claude Code skills are all functional. The project includes a multi-agent `/understand` command, fuzzy and semantic search, schema validation, staleness detection, layer auto-detection, guided learning tours, and an interactive chat interface.
|
||||
---
|
||||
|
||||
## Features
|
||||
**You just joined a new team. The codebase is 200,000 lines of code. Where do you even start?**
|
||||
|
||||
### Phase 1 — Foundation
|
||||
- **Knowledge Graph** — Automatically maps your codebase into an interactive graph of files, functions, classes, and their relationships
|
||||
- **Multi-Panel Dashboard** — Graph view, code viewer, chat, and learn panels in a workspace layout
|
||||
- **Natural Language Search** — Search your codebase with plain English: "which parts handle authentication?"
|
||||
- **Tree-sitter Analysis** — Accurate structural analysis for TypeScript, JavaScript (more languages coming)
|
||||
- **LLM-Powered Summaries** — Every node gets a plain-English description of what it does and why
|
||||
Understand Anything is a [Claude Code](https://docs.anthropic.com/en/docs/claude-code) plugin that analyzes your project with a multi-agent pipeline, builds a knowledge graph of every file, function, class, and dependency, then gives you an interactive dashboard to explore it all visually. Stop reading code blind. Start seeing the big picture.
|
||||
|
||||
### Phase 2 — Intelligence
|
||||
- **Fuzzy Search** — Fast, typo-tolerant search across all graph nodes via Fuse.js (SearchEngine in core)
|
||||
- **Schema Validation** — Zod-based runtime validation when loading knowledge graphs, with detailed error messages
|
||||
- **Staleness Detection** — Detects changed files via git diff and incrementally merges graph updates
|
||||
- **Layer Auto-Detection** — Heuristic-based layer grouping (API, Service, Data, UI, Utility) with LLM refinement
|
||||
- **`/understand-chat` Skill** — Ask questions about your codebase directly in the terminal via Claude Code
|
||||
- **Dashboard Chat Panel** — Context-aware Q&A integrated into the web dashboard (Claude API)
|
||||
- **Dagre Auto-Layout** — Automatic hierarchical graph layout for clean visualization
|
||||
- **Layer Visualization** — Color-coded layer grouping with collapsible groups and a legend panel
|
||||
---
|
||||
|
||||
### Phase 3 — Learning
|
||||
- **Guided Tours** — Auto-generated step-by-step walkthroughs of codebase architecture (Kahn's algorithm)
|
||||
- **Language Lessons** — 12 concept patterns explained in context (generics, closures, decorators, etc.)
|
||||
- **Persona Selector** — Adaptive UI for junior devs, non-technical stakeholders, and AI-assisted developers
|
||||
- **Learn Panel** — Interactive tour mode with graph highlighting in the dashboard
|
||||
## 🤔 Why?
|
||||
|
||||
### Phase 4 — Skills & Ecosystem
|
||||
- **`/understand` Command** — Multi-agent pipeline that analyzes a codebase end-to-end and produces `knowledge-graph.json`
|
||||
- **`/understand-diff` Skill** — Analyze git diffs against the knowledge graph for impact and risk assessment
|
||||
- **`/understand-explain` Skill** — Deep-dive explanations of any file, function, or module
|
||||
- **`/understand-onboard` Skill** — Generate team onboarding guides from the knowledge graph
|
||||
- **Plugin Registry** — Community analyzer plugins with auto-discovery
|
||||
- **Semantic Search** — Embedding-based vector search with cosine similarity
|
||||
Reading code is hard. Understanding a whole codebase is harder. Documentation is always out of date, onboarding takes weeks, and every new feature feels like archaeology.
|
||||
|
||||
## Quick Start
|
||||
Understand Anything fixes this by combining **LLM intelligence** with **static analysis** to produce a living, explorable map of your project — with plain-English explanations for everything.
|
||||
|
||||
### 1. Analyze any codebase (via Claude Code)
|
||||
---
|
||||
|
||||
## 🎯 Who is this for?
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="33%" valign="top">
|
||||
<h3>👩💻 Junior Developers</h3>
|
||||
<p>Stop drowning in unfamiliar code. Get guided tours that walk you through the architecture step by step, with every function and class explained in plain English.</p>
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
<h3>📋 Product Managers & Designers</h3>
|
||||
<p>Finally understand how the system actually works without reading code. Ask questions like "how does authentication work?" and get clear answers grounded in the real codebase.</p>
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
<h3>🤖 AI-Assisted Developers</h3>
|
||||
<p>Give your AI tools deep context about your project. Use <code>/understand-diff</code> before code review, <code>/understand-explain</code> to dive into any module, or <code>/understand-chat</code> to reason about architecture.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### 1. Install the plugin
|
||||
|
||||
```bash
|
||||
# Install the plugin
|
||||
claude --plugin-dir /path/to/Understand-Anything/packages/skill
|
||||
/plugin marketplace add Lum1104/Understand-Anything
|
||||
/plugin install understand-anything
|
||||
```
|
||||
|
||||
# In any project, run:
|
||||
### 2. Analyze your codebase
|
||||
|
||||
```bash
|
||||
/understand
|
||||
```
|
||||
|
||||
This produces `.understand-anything/knowledge-graph.json` in your project.
|
||||
A multi-agent pipeline scans your project, extracts every file, function, class, and dependency, then builds a knowledge graph saved to `.understand-anything/knowledge-graph.json`.
|
||||
|
||||
### 2. View the dashboard
|
||||
### 3. Explore the dashboard
|
||||
|
||||
```bash
|
||||
# Clone this repo and install
|
||||
git clone https://github.com/Lum1104/Understand-Anything.git
|
||||
cd Understand-Anything
|
||||
pnpm install
|
||||
|
||||
# Start the dashboard (auto-detects .understand-anything/ from your project)
|
||||
pnpm dev:dashboard
|
||||
/understand-dashboard
|
||||
```
|
||||
|
||||
The dashboard dev server automatically looks for `.understand-anything/knowledge-graph.json` in the project root — no manual copying needed.
|
||||
An interactive web dashboard opens with your codebase visualized as a graph — color-coded by architectural layer, searchable, and clickable. Select any node to see its code, relationships, and a plain-English explanation.
|
||||
|
||||
### 3. Use other skill commands
|
||||
### 4. Keep learning
|
||||
|
||||
```bash
|
||||
# Ask questions about the codebase
|
||||
/understand-chat How does authentication work in this project?
|
||||
# Ask anything about the codebase
|
||||
/understand-chat How does the payment flow work?
|
||||
|
||||
# Analyze impact of current changes
|
||||
# Analyze impact of your current changes
|
||||
/understand-diff
|
||||
|
||||
# Deep-dive into a specific file
|
||||
# Deep-dive into a specific file or function
|
||||
/understand-explain src/auth/login.ts
|
||||
|
||||
# Generate an onboarding guide
|
||||
# Generate an onboarding guide for new team members
|
||||
/understand-onboard
|
||||
```
|
||||
|
||||
## Plugin Installation
|
||||
---
|
||||
|
||||
The skill commands work in any project via Claude Code:
|
||||
## ✨ Features
|
||||
|
||||
```bash
|
||||
# Option 1: Load for current session
|
||||
claude --plugin-dir /path/to/Understand-Anything/packages/skill
|
||||
<table>
|
||||
<tr>
|
||||
<td width="50%" valign="top">
|
||||
<h3>🗺️ Interactive Knowledge Graph</h3>
|
||||
<p>Files, functions, classes, and their relationships visualized with React Flow. Click any node to see its code and connections.</p>
|
||||
</td>
|
||||
<td width="50%" valign="top">
|
||||
<h3>💬 Plain-English Summaries</h3>
|
||||
<p>Every node described by an LLM so anyone — technical or not — can understand what it does and why it exists.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" valign="top">
|
||||
<h3>🧭 Guided Tours</h3>
|
||||
<p>Auto-generated walkthroughs of the architecture, ordered by dependency. Learn the codebase in the right order.</p>
|
||||
</td>
|
||||
<td width="50%" valign="top">
|
||||
<h3>🔍 Fuzzy & Semantic Search</h3>
|
||||
<p>Find anything by name or by meaning. Search "which parts handle auth?" and get relevant results across the graph.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" valign="top">
|
||||
<h3>📊 Diff Impact Analysis</h3>
|
||||
<p>See which parts of the system your changes affect before you commit. Understand ripple effects across the codebase.</p>
|
||||
</td>
|
||||
<td width="50%" valign="top">
|
||||
<h3>🎭 Persona-Adaptive UI</h3>
|
||||
<p>The dashboard adjusts its detail level based on who you are — junior dev, PM, or power user.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" valign="top">
|
||||
<h3>🏗️ Layer Visualization</h3>
|
||||
<p>Automatic grouping by architectural layer — API, Service, Data, UI, Utility — with color-coded legend.</p>
|
||||
</td>
|
||||
<td width="50%" valign="top">
|
||||
<h3>📚 Language Concepts</h3>
|
||||
<p>12 programming patterns (generics, closures, decorators, etc.) explained in context wherever they appear.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Option 2: Add to .claude/settings.json for persistent use
|
||||
# (in the project where you cloned Understand-Anything)
|
||||
---
|
||||
|
||||
## 🔧 Under the Hood
|
||||
|
||||
### Multi-Agent Pipeline
|
||||
|
||||
The `/understand` command orchestrates 5 specialized agents:
|
||||
|
||||
| Agent | Role |
|
||||
|-------|------|
|
||||
| `project-scanner` | Discover files, detect languages and frameworks |
|
||||
| `file-analyzer` | Extract functions, classes, imports; produce graph nodes and edges |
|
||||
| `architecture-analyzer` | Identify architectural layers |
|
||||
| `tour-builder` | Generate guided learning tours |
|
||||
| `graph-reviewer` | Validate graph completeness and referential integrity |
|
||||
|
||||
File analyzers run in parallel (up to 3 concurrent). Supports incremental updates — only re-analyzes files that changed since the last run.
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
understand-anything-plugin/
|
||||
.claude-plugin/ — Plugin manifest
|
||||
agents/ — Specialized AI agents
|
||||
skills/ — Skill definitions (/understand, /understand-chat, etc.)
|
||||
src/ — TypeScript source (context-builder, diff-analyzer, etc.)
|
||||
packages/
|
||||
core/ — Analysis engine (types, persistence, tree-sitter, search, schema, tours)
|
||||
dashboard/ — React + TypeScript web dashboard
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"enabledPlugins": {
|
||||
"understand-anything": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
### Tech Stack
|
||||
|
||||
## Commands
|
||||
TypeScript, pnpm workspaces, React 18, Vite, TailwindCSS, React Flow, Monaco Editor, Zustand, web-tree-sitter, Fuse.js, Zod, Dagre
|
||||
|
||||
### Development Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `pnpm install` | Install all dependencies |
|
||||
| `pnpm --filter @understand-anything/core build` | Build the core package |
|
||||
| `pnpm --filter @understand-anything/core test` | Run core tests |
|
||||
| `pnpm --filter @understand-anything/skill build` | Build the skill package |
|
||||
| `pnpm --filter @understand-anything/skill test` | Run skill tests |
|
||||
| `pnpm --filter @understand-anything/skill build` | Build the plugin package |
|
||||
| `pnpm --filter @understand-anything/skill test` | Run plugin tests |
|
||||
| `pnpm --filter @understand-anything/dashboard build` | Build the dashboard |
|
||||
| `pnpm dev:dashboard` | Start dashboard dev server |
|
||||
|
||||
## Multi-Agent Architecture
|
||||
---
|
||||
|
||||
The `/understand` command orchestrates 5 specialized agents in a 7-phase pipeline:
|
||||
## 🤝 Contributing
|
||||
|
||||
| Agent | Model | Role |
|
||||
|-------|-------|------|
|
||||
| `project-scanner` | Haiku | Discover files, detect languages and frameworks |
|
||||
| `file-analyzer` | Sonnet | Extract functions, classes, imports; produce graph nodes/edges |
|
||||
| `architecture-analyzer` | Sonnet | Identify architectural layers (API, Service, Data, UI, etc.) |
|
||||
| `tour-builder` | Sonnet | Generate guided learning tours |
|
||||
| `graph-reviewer` | Haiku | Validate graph completeness and referential integrity |
|
||||
Contributions are welcome! Here's how to get started:
|
||||
|
||||
File analyzers run in parallel (up to 3 concurrent) for speed. Supports incremental updates — only re-analyzes files that changed since the last run.
|
||||
1. Fork the repository
|
||||
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
||||
3. Run the tests (`pnpm --filter @understand-anything/core test`)
|
||||
4. Commit your changes and open a pull request
|
||||
|
||||
## Project Structure
|
||||
Please open an issue first for major changes so we can discuss the approach.
|
||||
|
||||
```
|
||||
packages/
|
||||
core/ — Analysis engine: types, persistence, tree-sitter, search, schema, staleness, layers, tours
|
||||
dashboard/ — React + TypeScript web dashboard with chat, learn, and persona panels
|
||||
skill/
|
||||
agents/ — Specialized AI agents (scanner, analyzer, architect, tour-builder, reviewer)
|
||||
skills/ — Claude Code skills (/understand, /understand-chat, /understand-diff, etc.)
|
||||
```
|
||||
---
|
||||
|
||||
## Tech Stack
|
||||
<p align="center">
|
||||
<strong>Stop reading code blind. Start understanding everything.</strong>
|
||||
</p>
|
||||
|
||||
- TypeScript, pnpm workspaces
|
||||
- React 18, Vite, TailwindCSS
|
||||
- React Flow (graph visualization)
|
||||
- Monaco Editor (code viewer)
|
||||
- Zustand (state management)
|
||||
- tree-sitter (static analysis)
|
||||
- Fuse.js (fuzzy search)
|
||||
- Zod (schema validation)
|
||||
- Dagre (graph layout)
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
<p align="center">
|
||||
MIT License © <a href="https://github.com/Lum1104">Lum1104</a>
|
||||
</p>
|
||||
|
||||
@@ -1,528 +0,0 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"project": {
|
||||
"name": "taskflow-api",
|
||||
"languages": ["typescript"],
|
||||
"frameworks": ["express", "prisma", "zod"],
|
||||
"description": "A task management REST API built with Express and Prisma. Supports user authentication, project workspaces, task CRUD with assignments, and real-time notifications via WebSocket. Designed for team collaboration with role-based access control.",
|
||||
"analyzedAt": "2026-03-14T12:00:00.000Z",
|
||||
"gitCommitHash": "a1b2c3d4e5f6"
|
||||
},
|
||||
"nodes": [
|
||||
{
|
||||
"id": "file:src/index.ts",
|
||||
"type": "file",
|
||||
"name": "index.ts",
|
||||
"filePath": "src/index.ts",
|
||||
"summary": "Application entry point. Initializes the Express server, applies middleware, mounts route handlers, and starts listening on the configured port.",
|
||||
"tags": ["entry", "server", "express"],
|
||||
"complexity": "moderate"
|
||||
},
|
||||
{
|
||||
"id": "file:src/routes/task.routes.ts",
|
||||
"type": "file",
|
||||
"name": "task.routes.ts",
|
||||
"filePath": "src/routes/task.routes.ts",
|
||||
"summary": "Defines REST endpoints for task CRUD operations: GET /tasks, POST /tasks, PATCH /tasks/:id, DELETE /tasks/:id. Validates request bodies with Zod schemas before delegating to TaskService.",
|
||||
"tags": ["routes", "tasks", "rest"],
|
||||
"complexity": "moderate"
|
||||
},
|
||||
{
|
||||
"id": "file:src/routes/auth.routes.ts",
|
||||
"type": "file",
|
||||
"name": "auth.routes.ts",
|
||||
"filePath": "src/routes/auth.routes.ts",
|
||||
"summary": "Authentication routes: POST /auth/login, POST /auth/register, POST /auth/refresh. Handles credential validation and JWT token issuance.",
|
||||
"tags": ["routes", "auth", "jwt"],
|
||||
"complexity": "moderate"
|
||||
},
|
||||
{
|
||||
"id": "file:src/routes/project.routes.ts",
|
||||
"type": "file",
|
||||
"name": "project.routes.ts",
|
||||
"filePath": "src/routes/project.routes.ts",
|
||||
"summary": "Project workspace endpoints: CRUD for projects plus member management. Enforces role-based access so only admins can modify project settings.",
|
||||
"tags": ["routes", "projects", "rbac"],
|
||||
"complexity": "moderate"
|
||||
},
|
||||
{
|
||||
"id": "file:src/services/task.service.ts",
|
||||
"type": "file",
|
||||
"name": "task.service.ts",
|
||||
"filePath": "src/services/task.service.ts",
|
||||
"summary": "Business logic for tasks. Handles creation, status transitions, assignment, due-date validation, and triggers notifications on state changes.",
|
||||
"tags": ["service", "tasks", "business-logic"],
|
||||
"complexity": "complex"
|
||||
},
|
||||
{
|
||||
"id": "func:src/services/task.service.ts:createTask",
|
||||
"type": "function",
|
||||
"name": "createTask",
|
||||
"filePath": "src/services/task.service.ts",
|
||||
"lineRange": [24, 58],
|
||||
"summary": "Creates a new task in the database. Validates the assignee belongs to the project, sets default status to 'todo', and publishes a TASK_CREATED event to the notification service.",
|
||||
"tags": ["create", "validation", "events"],
|
||||
"complexity": "moderate"
|
||||
},
|
||||
{
|
||||
"id": "func:src/services/task.service.ts:transitionStatus",
|
||||
"type": "function",
|
||||
"name": "transitionStatus",
|
||||
"filePath": "src/services/task.service.ts",
|
||||
"lineRange": [60, 102],
|
||||
"summary": "Moves a task through its lifecycle (todo -> in_progress -> review -> done). Enforces valid transitions and records the state change timestamp.",
|
||||
"tags": ["state-machine", "workflow", "validation"],
|
||||
"complexity": "complex"
|
||||
},
|
||||
{
|
||||
"id": "file:src/services/auth.service.ts",
|
||||
"type": "file",
|
||||
"name": "auth.service.ts",
|
||||
"filePath": "src/services/auth.service.ts",
|
||||
"summary": "Authentication service handling password hashing with bcrypt, JWT token generation/verification, and refresh token rotation.",
|
||||
"tags": ["service", "auth", "security"],
|
||||
"complexity": "complex"
|
||||
},
|
||||
{
|
||||
"id": "file:src/services/notification.service.ts",
|
||||
"type": "file",
|
||||
"name": "notification.service.ts",
|
||||
"filePath": "src/services/notification.service.ts",
|
||||
"summary": "Manages real-time notifications via WebSocket. Subscribes to domain events (task created, assigned, status changed) and broadcasts to relevant connected clients.",
|
||||
"tags": ["service", "websocket", "events", "realtime"],
|
||||
"complexity": "complex"
|
||||
},
|
||||
{
|
||||
"id": "class:src/models/Task.ts:Task",
|
||||
"type": "class",
|
||||
"name": "Task",
|
||||
"filePath": "src/models/Task.ts",
|
||||
"lineRange": [8, 45],
|
||||
"summary": "Prisma model wrapper for tasks. Defines the schema fields (title, description, status, priority, dueDate, assigneeId, projectId) and provides static query helpers.",
|
||||
"tags": ["model", "prisma", "database"],
|
||||
"complexity": "moderate"
|
||||
},
|
||||
{
|
||||
"id": "class:src/models/User.ts:User",
|
||||
"type": "class",
|
||||
"name": "User",
|
||||
"filePath": "src/models/User.ts",
|
||||
"lineRange": [5, 38],
|
||||
"summary": "Prisma model wrapper for users. Stores email, hashed password, display name, and role. Provides methods for credential verification and profile serialization.",
|
||||
"tags": ["model", "prisma", "auth"],
|
||||
"complexity": "moderate"
|
||||
},
|
||||
{
|
||||
"id": "file:src/db/prisma.ts",
|
||||
"type": "file",
|
||||
"name": "prisma.ts",
|
||||
"filePath": "src/db/prisma.ts",
|
||||
"summary": "Singleton Prisma client instance. Configures connection pooling, logging levels, and graceful shutdown hooks.",
|
||||
"tags": ["database", "prisma", "connection"],
|
||||
"complexity": "simple"
|
||||
},
|
||||
{
|
||||
"id": "file:src/middleware/auth.middleware.ts",
|
||||
"type": "file",
|
||||
"name": "auth.middleware.ts",
|
||||
"filePath": "src/middleware/auth.middleware.ts",
|
||||
"summary": "Express middleware that extracts and verifies JWT from the Authorization header. Attaches the decoded user payload to req.user for downstream handlers.",
|
||||
"tags": ["middleware", "auth", "jwt"],
|
||||
"complexity": "moderate"
|
||||
},
|
||||
{
|
||||
"id": "func:src/middleware/auth.middleware.ts:requireRole",
|
||||
"type": "function",
|
||||
"name": "requireRole",
|
||||
"filePath": "src/middleware/auth.middleware.ts",
|
||||
"lineRange": [28, 44],
|
||||
"summary": "Higher-order middleware factory that checks if the authenticated user has one of the required roles. Returns 403 Forbidden if the role check fails.",
|
||||
"tags": ["rbac", "authorization", "middleware"],
|
||||
"complexity": "simple"
|
||||
},
|
||||
{
|
||||
"id": "file:src/utils/validate.ts",
|
||||
"type": "file",
|
||||
"name": "validate.ts",
|
||||
"filePath": "src/utils/validate.ts",
|
||||
"summary": "Shared Zod schemas and a validateBody middleware factory. Schemas cover task creation, user registration, and project settings validation.",
|
||||
"tags": ["validation", "zod", "schemas"],
|
||||
"complexity": "simple"
|
||||
},
|
||||
{
|
||||
"id": "file:src/utils/logger.ts",
|
||||
"type": "file",
|
||||
"name": "logger.ts",
|
||||
"filePath": "src/utils/logger.ts",
|
||||
"summary": "Structured logging utility built on pino. Provides log levels (debug, info, warn, error) and request-scoped child loggers with correlation IDs.",
|
||||
"tags": ["logging", "pino", "observability"],
|
||||
"complexity": "simple"
|
||||
},
|
||||
{
|
||||
"id": "file:src/config.ts",
|
||||
"type": "file",
|
||||
"name": "config.ts",
|
||||
"filePath": "src/config.ts",
|
||||
"summary": "Loads environment variables and exports typed configuration: port, database URL, JWT secret, token expiry, log level, and WebSocket settings.",
|
||||
"tags": ["config", "env", "settings"],
|
||||
"complexity": "simple"
|
||||
},
|
||||
{
|
||||
"id": "module:src/routes",
|
||||
"type": "module",
|
||||
"name": "routes",
|
||||
"filePath": "src/routes",
|
||||
"summary": "Route module aggregating all HTTP endpoint definitions. Each route file maps URL paths to controller logic with middleware chains.",
|
||||
"tags": ["module", "routing", "api"],
|
||||
"complexity": "simple"
|
||||
},
|
||||
{
|
||||
"id": "concept:authentication-flow",
|
||||
"type": "concept",
|
||||
"name": "Authentication Flow",
|
||||
"summary": "The system uses JWT-based stateless authentication. Users log in with email/password, receive an access token (15 min) and refresh token (7 days). The auth middleware validates tokens on protected routes, and the refresh endpoint rotates tokens to maintain sessions.",
|
||||
"tags": ["concept", "auth", "jwt", "security"],
|
||||
"complexity": "complex"
|
||||
},
|
||||
{
|
||||
"id": "concept:task-lifecycle",
|
||||
"type": "concept",
|
||||
"name": "Task Lifecycle",
|
||||
"summary": "Tasks follow a state machine: todo -> in_progress -> review -> done. Only valid forward transitions are allowed. Each transition triggers a notification event and records a timestamp. Tasks can also be archived after completion.",
|
||||
"tags": ["concept", "workflow", "state-machine"],
|
||||
"complexity": "moderate"
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "file:src/index.ts",
|
||||
"target": "file:src/routes/task.routes.ts",
|
||||
"type": "imports",
|
||||
"direction": "forward",
|
||||
"description": "Mounts task routes at /api/tasks",
|
||||
"weight": 0.8
|
||||
},
|
||||
{
|
||||
"source": "file:src/index.ts",
|
||||
"target": "file:src/routes/auth.routes.ts",
|
||||
"type": "imports",
|
||||
"direction": "forward",
|
||||
"description": "Mounts auth routes at /api/auth",
|
||||
"weight": 0.8
|
||||
},
|
||||
{
|
||||
"source": "file:src/index.ts",
|
||||
"target": "file:src/routes/project.routes.ts",
|
||||
"type": "imports",
|
||||
"direction": "forward",
|
||||
"description": "Mounts project routes at /api/projects",
|
||||
"weight": 0.8
|
||||
},
|
||||
{
|
||||
"source": "file:src/index.ts",
|
||||
"target": "file:src/config.ts",
|
||||
"type": "imports",
|
||||
"direction": "forward",
|
||||
"description": "Reads server port and startup configuration",
|
||||
"weight": 0.6
|
||||
},
|
||||
{
|
||||
"source": "file:src/index.ts",
|
||||
"target": "file:src/middleware/auth.middleware.ts",
|
||||
"type": "middleware",
|
||||
"direction": "forward",
|
||||
"description": "Applies JWT auth middleware globally to protected routes",
|
||||
"weight": 0.7
|
||||
},
|
||||
{
|
||||
"source": "module:src/routes",
|
||||
"target": "file:src/routes/task.routes.ts",
|
||||
"type": "contains",
|
||||
"direction": "forward",
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"source": "module:src/routes",
|
||||
"target": "file:src/routes/auth.routes.ts",
|
||||
"type": "contains",
|
||||
"direction": "forward",
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"source": "module:src/routes",
|
||||
"target": "file:src/routes/project.routes.ts",
|
||||
"type": "contains",
|
||||
"direction": "forward",
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"source": "file:src/routes/task.routes.ts",
|
||||
"target": "file:src/services/task.service.ts",
|
||||
"type": "calls",
|
||||
"direction": "forward",
|
||||
"description": "Delegates task operations to the service layer",
|
||||
"weight": 0.9
|
||||
},
|
||||
{
|
||||
"source": "file:src/routes/task.routes.ts",
|
||||
"target": "file:src/utils/validate.ts",
|
||||
"type": "validates",
|
||||
"direction": "forward",
|
||||
"description": "Uses Zod schemas to validate incoming task payloads",
|
||||
"weight": 0.7
|
||||
},
|
||||
{
|
||||
"source": "file:src/routes/auth.routes.ts",
|
||||
"target": "file:src/services/auth.service.ts",
|
||||
"type": "calls",
|
||||
"direction": "forward",
|
||||
"description": "Delegates login, register, and token refresh to auth service",
|
||||
"weight": 0.9
|
||||
},
|
||||
{
|
||||
"source": "file:src/routes/project.routes.ts",
|
||||
"target": "file:src/middleware/auth.middleware.ts",
|
||||
"type": "depends_on",
|
||||
"direction": "forward",
|
||||
"description": "Requires authentication and role checking on all endpoints",
|
||||
"weight": 0.8
|
||||
},
|
||||
{
|
||||
"source": "file:src/services/task.service.ts",
|
||||
"target": "func:src/services/task.service.ts:createTask",
|
||||
"type": "contains",
|
||||
"direction": "forward",
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"source": "file:src/services/task.service.ts",
|
||||
"target": "func:src/services/task.service.ts:transitionStatus",
|
||||
"type": "contains",
|
||||
"direction": "forward",
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"source": "file:src/services/task.service.ts",
|
||||
"target": "class:src/models/Task.ts:Task",
|
||||
"type": "reads_from",
|
||||
"direction": "forward",
|
||||
"description": "Queries and mutates task records via the Task model",
|
||||
"weight": 0.9
|
||||
},
|
||||
{
|
||||
"source": "file:src/services/task.service.ts",
|
||||
"target": "file:src/services/notification.service.ts",
|
||||
"type": "publishes",
|
||||
"direction": "forward",
|
||||
"description": "Emits TASK_CREATED and STATUS_CHANGED events to the notification service",
|
||||
"weight": 0.7
|
||||
},
|
||||
{
|
||||
"source": "file:src/services/auth.service.ts",
|
||||
"target": "class:src/models/User.ts:User",
|
||||
"type": "reads_from",
|
||||
"direction": "forward",
|
||||
"description": "Looks up users for authentication and creates new user records",
|
||||
"weight": 0.9
|
||||
},
|
||||
{
|
||||
"source": "file:src/services/auth.service.ts",
|
||||
"target": "file:src/config.ts",
|
||||
"type": "configures",
|
||||
"direction": "backward",
|
||||
"description": "Reads JWT secret and token expiry from configuration",
|
||||
"weight": 0.6
|
||||
},
|
||||
{
|
||||
"source": "file:src/services/notification.service.ts",
|
||||
"target": "file:src/utils/logger.ts",
|
||||
"type": "depends_on",
|
||||
"direction": "forward",
|
||||
"description": "Logs WebSocket connection events and notification delivery",
|
||||
"weight": 0.5
|
||||
},
|
||||
{
|
||||
"source": "class:src/models/Task.ts:Task",
|
||||
"target": "file:src/db/prisma.ts",
|
||||
"type": "depends_on",
|
||||
"direction": "forward",
|
||||
"description": "Uses the shared Prisma client for all database queries",
|
||||
"weight": 0.9
|
||||
},
|
||||
{
|
||||
"source": "class:src/models/User.ts:User",
|
||||
"target": "file:src/db/prisma.ts",
|
||||
"type": "depends_on",
|
||||
"direction": "forward",
|
||||
"description": "Uses the shared Prisma client for user queries",
|
||||
"weight": 0.9
|
||||
},
|
||||
{
|
||||
"source": "file:src/middleware/auth.middleware.ts",
|
||||
"target": "file:src/middleware/auth.middleware.ts",
|
||||
"type": "contains",
|
||||
"direction": "forward",
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"source": "file:src/middleware/auth.middleware.ts",
|
||||
"target": "func:src/middleware/auth.middleware.ts:requireRole",
|
||||
"type": "contains",
|
||||
"direction": "forward",
|
||||
"weight": 1.0
|
||||
},
|
||||
{
|
||||
"source": "concept:authentication-flow",
|
||||
"target": "file:src/services/auth.service.ts",
|
||||
"type": "related",
|
||||
"direction": "forward",
|
||||
"description": "Auth service implements the core authentication flow",
|
||||
"weight": 0.9
|
||||
},
|
||||
{
|
||||
"source": "concept:authentication-flow",
|
||||
"target": "file:src/middleware/auth.middleware.ts",
|
||||
"type": "related",
|
||||
"direction": "forward",
|
||||
"description": "Auth middleware enforces the authentication flow on routes",
|
||||
"weight": 0.8
|
||||
},
|
||||
{
|
||||
"source": "concept:task-lifecycle",
|
||||
"target": "func:src/services/task.service.ts:transitionStatus",
|
||||
"type": "related",
|
||||
"direction": "forward",
|
||||
"description": "The transitionStatus function implements the task state machine",
|
||||
"weight": 0.9
|
||||
},
|
||||
{
|
||||
"source": "concept:task-lifecycle",
|
||||
"target": "file:src/services/notification.service.ts",
|
||||
"type": "related",
|
||||
"direction": "forward",
|
||||
"description": "Lifecycle transitions trigger real-time notifications",
|
||||
"weight": 0.7
|
||||
},
|
||||
{
|
||||
"source": "func:src/services/task.service.ts:createTask",
|
||||
"target": "file:src/utils/validate.ts",
|
||||
"type": "validates",
|
||||
"direction": "forward",
|
||||
"description": "Validates task data before persisting",
|
||||
"weight": 0.6
|
||||
}
|
||||
],
|
||||
"layers": [
|
||||
{
|
||||
"id": "layer:api",
|
||||
"name": "API Layer",
|
||||
"description": "HTTP route handlers and request/response processing. The entry point for all client interactions with the system.",
|
||||
"nodeIds": [
|
||||
"file:src/index.ts",
|
||||
"file:src/routes/task.routes.ts",
|
||||
"file:src/routes/auth.routes.ts",
|
||||
"file:src/routes/project.routes.ts",
|
||||
"module:src/routes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "layer:service",
|
||||
"name": "Service Layer",
|
||||
"description": "Core business logic and domain operations. Orchestrates data access, validation, event publishing, and enforces business rules.",
|
||||
"nodeIds": [
|
||||
"file:src/services/task.service.ts",
|
||||
"func:src/services/task.service.ts:createTask",
|
||||
"func:src/services/task.service.ts:transitionStatus",
|
||||
"file:src/services/auth.service.ts",
|
||||
"file:src/services/notification.service.ts"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "layer:data",
|
||||
"name": "Data Layer",
|
||||
"description": "Database models, Prisma client, and data access patterns. Provides the persistence foundation for all domain entities.",
|
||||
"nodeIds": [
|
||||
"class:src/models/Task.ts:Task",
|
||||
"class:src/models/User.ts:User",
|
||||
"file:src/db/prisma.ts"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "layer:middleware",
|
||||
"name": "Middleware Layer",
|
||||
"description": "Cross-cutting concerns applied to request pipelines: authentication, authorization, and request validation.",
|
||||
"nodeIds": [
|
||||
"file:src/middleware/auth.middleware.ts",
|
||||
"func:src/middleware/auth.middleware.ts:requireRole",
|
||||
"file:src/utils/validate.ts"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "layer:infrastructure",
|
||||
"name": "Infrastructure Layer",
|
||||
"description": "Configuration, logging, and shared utilities that support all other layers without containing business logic.",
|
||||
"nodeIds": [
|
||||
"file:src/config.ts",
|
||||
"file:src/utils/logger.ts",
|
||||
"concept:authentication-flow",
|
||||
"concept:task-lifecycle"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tour": [
|
||||
{
|
||||
"order": 1,
|
||||
"title": "Where It All Begins",
|
||||
"description": "The application starts in index.ts, which wires up Express middleware and mounts all the route handlers. Think of it as the front door of the API.",
|
||||
"nodeIds": ["file:src/index.ts"]
|
||||
},
|
||||
{
|
||||
"order": 2,
|
||||
"title": "Handling Requests",
|
||||
"description": "Incoming HTTP requests hit the route files. Each route file defines endpoints for a domain area (tasks, auth, projects) and validates input before passing it along.",
|
||||
"nodeIds": [
|
||||
"file:src/routes/task.routes.ts",
|
||||
"file:src/routes/auth.routes.ts",
|
||||
"file:src/routes/project.routes.ts"
|
||||
]
|
||||
},
|
||||
{
|
||||
"order": 3,
|
||||
"title": "Security Gate",
|
||||
"description": "Before most routes run, the auth middleware checks the JWT token. The requireRole function adds role-based access control on top of basic authentication.",
|
||||
"nodeIds": [
|
||||
"file:src/middleware/auth.middleware.ts",
|
||||
"func:src/middleware/auth.middleware.ts:requireRole"
|
||||
],
|
||||
"languageLesson": "JWT (JSON Web Token) is a compact token format that encodes user identity and permissions. It lets the server verify who you are without storing session data."
|
||||
},
|
||||
{
|
||||
"order": 4,
|
||||
"title": "Business Logic",
|
||||
"description": "Services contain the real brains of the application. TaskService manages task creation and status transitions, while AuthService handles password hashing and token management.",
|
||||
"nodeIds": [
|
||||
"file:src/services/task.service.ts",
|
||||
"func:src/services/task.service.ts:createTask",
|
||||
"func:src/services/task.service.ts:transitionStatus",
|
||||
"file:src/services/auth.service.ts"
|
||||
]
|
||||
},
|
||||
{
|
||||
"order": 5,
|
||||
"title": "Data Persistence",
|
||||
"description": "The Task and User models wrap Prisma queries. They talk to the database through a shared Prisma client configured in prisma.ts.",
|
||||
"nodeIds": [
|
||||
"class:src/models/Task.ts:Task",
|
||||
"class:src/models/User.ts:User",
|
||||
"file:src/db/prisma.ts"
|
||||
],
|
||||
"languageLesson": "Prisma is an ORM (Object-Relational Mapper) that lets you write database queries in TypeScript instead of raw SQL. It auto-generates types from your schema."
|
||||
},
|
||||
{
|
||||
"order": 6,
|
||||
"title": "Real-Time Updates",
|
||||
"description": "When tasks change state, the notification service broadcasts updates over WebSocket so connected clients see changes immediately without polling.",
|
||||
"nodeIds": ["file:src/services/notification.service.ts"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Generated
+27
-19
@@ -15,7 +15,23 @@ importers:
|
||||
specifier: ^3.1.0
|
||||
version: 3.2.4(@types/debug@4.1.12)(@types/node@25.5.0)(jiti@2.6.1)(lightningcss@1.31.1)
|
||||
|
||||
packages/core:
|
||||
understand-anything-plugin:
|
||||
dependencies:
|
||||
'@understand-anything/core':
|
||||
specifier: workspace:*
|
||||
version: link:packages/core
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^22.0.0
|
||||
version: 22.19.15
|
||||
typescript:
|
||||
specifier: ^5.7.0
|
||||
version: 5.9.3
|
||||
vitest:
|
||||
specifier: ^3.1.0
|
||||
version: 3.2.4(@types/debug@4.1.12)(@types/node@22.19.15)(jiti@2.6.1)(lightningcss@1.31.1)
|
||||
|
||||
understand-anything-plugin/packages/core:
|
||||
dependencies:
|
||||
fuse.js:
|
||||
specifier: ^7.1.0
|
||||
@@ -43,7 +59,7 @@ importers:
|
||||
specifier: ^3.1.0
|
||||
version: 3.2.4(@types/debug@4.1.12)(@types/node@25.5.0)(jiti@2.6.1)(lightningcss@1.31.1)
|
||||
|
||||
packages/dashboard:
|
||||
understand-anything-plugin/packages/dashboard:
|
||||
dependencies:
|
||||
'@anthropic-ai/sdk':
|
||||
specifier: ^0.78.0
|
||||
@@ -95,22 +111,6 @@ importers:
|
||||
specifier: ^6.0.0
|
||||
version: 6.4.1(@types/node@25.5.0)(jiti@2.6.1)(lightningcss@1.31.1)
|
||||
|
||||
packages/skill:
|
||||
dependencies:
|
||||
'@understand-anything/core':
|
||||
specifier: workspace:*
|
||||
version: link:../core
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: ^22.0.0
|
||||
version: 22.19.15
|
||||
typescript:
|
||||
specifier: ^5.7.0
|
||||
version: 5.9.3
|
||||
vitest:
|
||||
specifier: ^3.1.0
|
||||
version: 3.2.4(@types/debug@4.1.12)(@types/node@22.19.15)(jiti@2.6.1)(lightningcss@1.31.1)
|
||||
|
||||
packages:
|
||||
|
||||
'@anthropic-ai/sdk@0.78.0':
|
||||
@@ -2268,6 +2268,14 @@ snapshots:
|
||||
chai: 5.3.3
|
||||
tinyrainbow: 2.0.0
|
||||
|
||||
'@vitest/mocker@3.2.4(vite@7.3.1(@types/node@22.19.15)(jiti@2.6.1)(lightningcss@1.31.1))':
|
||||
dependencies:
|
||||
'@vitest/spy': 3.2.4
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 0.30.21
|
||||
optionalDependencies:
|
||||
vite: 7.3.1(@types/node@22.19.15)(jiti@2.6.1)(lightningcss@1.31.1)
|
||||
|
||||
'@vitest/mocker@3.2.4(vite@7.3.1(@types/node@25.5.0)(jiti@2.6.1)(lightningcss@1.31.1))':
|
||||
dependencies:
|
||||
'@vitest/spy': 3.2.4
|
||||
@@ -3213,7 +3221,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/chai': 5.2.3
|
||||
'@vitest/expect': 3.2.4
|
||||
'@vitest/mocker': 3.2.4(vite@7.3.1(@types/node@25.5.0)(jiti@2.6.1)(lightningcss@1.31.1))
|
||||
'@vitest/mocker': 3.2.4(vite@7.3.1(@types/node@22.19.15)(jiti@2.6.1)(lightningcss@1.31.1))
|
||||
'@vitest/pretty-format': 3.2.4
|
||||
'@vitest/runner': 3.2.4
|
||||
'@vitest/snapshot': 3.2.4
|
||||
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
packages:
|
||||
- 'packages/*'
|
||||
- 'understand-anything-plugin/packages/*'
|
||||
- 'understand-anything-plugin'
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
File diff suppressed because it is too large
Load Diff
+7
-2
@@ -13,10 +13,15 @@ export default defineConfig({
|
||||
configureServer(server) {
|
||||
server.middlewares.use((req, res, next) => {
|
||||
if (req.url === "/knowledge-graph.json") {
|
||||
// Look for .understand-anything/knowledge-graph.json up from cwd
|
||||
// GRAPH_DIR env var points to the project being analyzed
|
||||
// Falls back to monorepo root, then public/ (demo)
|
||||
const graphDir = process.env.GRAPH_DIR;
|
||||
const candidates = [
|
||||
...(graphDir
|
||||
? [path.resolve(graphDir, ".understand-anything/knowledge-graph.json")]
|
||||
: []),
|
||||
path.resolve(process.cwd(), ".understand-anything/knowledge-graph.json"),
|
||||
path.resolve(process.cwd(), "../../.understand-anything/knowledge-graph.json"),
|
||||
path.resolve(process.cwd(), "../../../.understand-anything/knowledge-graph.json"),
|
||||
];
|
||||
for (const candidate of candidates) {
|
||||
if (fs.existsSync(candidate)) {
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
Reference in New Issue
Block a user