How phodal/autodev-worker works
Project Type and Purpose
• This is a full-stack, monorepo platform with two primary packages:
• context-worker: a Node.js CLI/library that analyzes codebases, builds ASTs, extracts context, runs code searches, and presents codemodels.
• web: a Next.js (React + serverless API routes) frontend + backend that provides UI, REST/HTTP APIs, and persistence via Prisma.
• Purpose: power AI-driven development workflows (contextual code assistance, knowledge management, analytics, marketplace).
File Structure
• Root: pnpm-workspace; CI/CD pipeline (.github/workflows/ci-cd.yml); shared types in packages/work-core.
• context-worker: Organized into layered modules:
– analyzer (collects files, runs language analyzers)
– ast (Tree-sitter wrapper, AST builders)
– code-context (language profiles + context providers)
– code-search (scope graph builder + search indexes)
– codemodel (UML/PlantUML presenters)
– document (Markdown/ReST analyzers)
– utils, CLI entrypoint main.ts
• web: Next.js app under src/app, with:
– pages & layouts
– API routes (src/app/api/...) using utilities for LLM, embeddings, concept extraction, DB.
– Prisma schemas & migrations for relational store.
– Components, hooks, lib (shared UI, client-side logic).
Dig into the README
• Confirms the full-stack AI platform: “AI-Powered Development,” “Knowledge Management,” “Metrics & Analytics.”
1. Client / Browser (rectangle)
2. Web Frontend (Next.js UI)
3. Web API Layer (serverless functions / Next.js API routes)
5. Context-Worker Service (separate Node.js process or microservice)
9. Shared Types / Modules (work-core)
• Browser → Web Frontend (HTTP/HTTPS)
• Frontend → Web API (REST calls)
• API → Database (SQL queries via Prisma)
• API → Context-Worker (RPC/CLI invocation or message queue)
• Context-Worker → File System or Git Repos (scans code)
• Context-Worker → LLM Providers (API calls for embeddings, analysis)
• API → LLM Providers (when user triggers AI-powered features)
• CI/CD → Deploy Frontend & Context-Worker
c. Architectural Patterns & Principles:
– Monorepo with Workspaces: share code/types via work-core.
– Layered Modules in context-worker: separation of scanning, analysis, AST, context, search, presentation.
– Serverless API in Web: decoupled functions for chat, context generation, concept extraction, validation.
– Plugin-style Language Profiles: context providers registered for each language.
– Infrastructure as Code: Prisma migrations, Next.js config.
d. Key Technologies / Frameworks:
– Node.js + TypeScript (both packages)
– Tree-sitter (AST)
– Prisma + PostgreSQL (or other SQL)
– Next.js (React, server-side rendering, API routes)
– pnpm workspaces
– GitHub Actions (CI/CD)