feat: initial CodeBoard monorepo scaffold

Turborepo monorepo with npm workspaces:
- apps/web: Next.js 14 frontend with Tailwind v4, SSE progress, doc viewer
- apps/worker: BullMQ job processor (clone → parse → LLM generate)
- packages/shared: TypeScript types
- packages/parser: Babel-based AST parser (JS/TS) + regex (Python)
- packages/llm: OpenAI/Anthropic provider abstraction + prompt pipeline
- packages/diagrams: Mermaid architecture & dependency graph generators
- packages/database: Prisma schema (PostgreSQL)
- Docker multi-stage build (web + worker targets)

All packages compile successfully with tsc and next build.
This commit is contained in:
Vectry
2026-02-09 15:22:50 +00:00
parent efdc282da5
commit 79dad6124f
72 changed files with 10132 additions and 136 deletions

View File

@@ -0,0 +1,21 @@
{
"name": "@codeboard/shared",
"version": "0.0.1",
"private": true,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"build": "tsc",
"clean": "rm -rf dist",
"dev": "tsc --watch"
},
"devDependencies": {
"typescript": "^5.7"
}
}

View File

@@ -0,0 +1,24 @@
export type {
CloneResult,
CloneMetadata,
FileNode,
FunctionNode,
ClassNode,
ClassProperty,
ImportNode,
ExportNode,
CodeStructure,
ModuleNode,
DetectedPattern,
DependencyEdge,
GeneratedDocs,
DocsOverview,
DocsModule,
DocsPatterns,
DocsGettingStarted,
Generation,
GenerationStatus,
LLMMessage,
LLMOptions,
LLMProviderConfig,
} from "./types.js";

View File

@@ -0,0 +1,185 @@
// ── Repository Cloning ──────────────────────────────────────────────
export interface CloneMetadata {
name: string;
description: string;
defaultBranch: string;
languages: Record<string, number>;
stars: number;
lastCommit: string;
totalFiles: number;
totalLines: number;
}
export interface CloneResult {
localPath: string;
metadata: CloneMetadata;
}
// ── AST Parsing ─────────────────────────────────────────────────────
export interface FunctionNode {
name: string;
params: string[];
returnType?: string;
lineStart: number;
lineEnd: number;
docstring?: string;
calls: string[];
}
export interface ClassProperty {
name: string;
type?: string;
}
export interface ClassNode {
name: string;
methods: FunctionNode[];
properties: ClassProperty[];
}
export interface ImportNode {
source: string;
specifiers: string[];
}
export interface ExportNode {
name: string;
isDefault: boolean;
}
export interface FileNode {
path: string;
language: string;
size: number;
functions: FunctionNode[];
classes: ClassNode[];
imports: ImportNode[];
exports: ExportNode[];
complexity: number;
}
export interface ModuleNode {
name: string;
path: string;
files: string[];
summary?: string;
}
export interface DetectedPattern {
name: string;
description: string;
examples: string[];
}
export interface DependencyEdge {
source: string;
target: string;
type: "import" | "call" | "extends";
}
export interface CodeStructure {
files: FileNode[];
modules: ModuleNode[];
entryPoints: string[];
exports: ExportNode[];
dependencies: DependencyEdge[];
patterns: DetectedPattern[];
}
// ── Generated Documentation ─────────────────────────────────────────
export interface DocsOverview {
title: string;
description: string;
architectureDiagram: string;
techStack: string[];
keyMetrics: {
files: number;
modules: number;
languages: string[];
};
}
export interface DocsModule {
name: string;
path: string;
summary: string;
keyFiles: Array<{ path: string; purpose: string }>;
publicApi: string[];
dependsOn: string[];
dependedBy: string[];
}
export interface DocsPatterns {
conventions: string[];
designPatterns: string[];
architecturalDecisions: string[];
}
export interface DocsGettingStarted {
prerequisites: string[];
setupSteps: string[];
firstTask: string;
}
export interface GeneratedDocs {
id: string;
repoUrl: string;
repoName: string;
generatedAt: string;
sections: {
overview: DocsOverview;
modules: DocsModule[];
patterns: DocsPatterns;
gettingStarted: DocsGettingStarted;
dependencyGraph: string;
};
}
// ── Generation State ────────────────────────────────────────────────
export type GenerationStatus =
| "QUEUED"
| "CLONING"
| "PARSING"
| "GENERATING"
| "RENDERING"
| "COMPLETED"
| "FAILED";
export interface Generation {
id: string;
repoUrl: string;
repoName: string;
commitHash: string;
status: GenerationStatus;
progress: number;
result: GeneratedDocs | null;
error: string | null;
costUsd: number | null;
duration: number | null;
createdAt: string;
viewCount: number;
}
// ── LLM Configuration ───────────────────────────────────────────────
export interface LLMMessage {
role: "system" | "user" | "assistant";
content: string;
}
export interface LLMOptions {
temperature?: number;
maxTokens?: number;
model?: string;
}
export interface LLMProviderConfig {
provider: "openai" | "anthropic";
apiKey: string;
model?: string;
baseUrl?: string;
}

View File

@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src"]
}