adam-java-analytics
Version:
Java code analyzer for detecting package dependencies and circular references
23 lines (19 loc) • 731 B
text/typescript
import { NextResponse } from "next/server"
import fs from "fs"
import path from "path"
import { analyzeProject } from "@/lib/analyzer"
export async function GET() {
try {
let projectPath = process.env.PROJECT_PATH || process.cwd();
const configPath = path.join(process.cwd(), ".project-config.json")
if (fs.existsSync(configPath)) {
const config = JSON.parse(fs.readFileSync(configPath, "utf8"))
projectPath = config.projectPath
}
const projectData = await analyzeProject(projectPath)
return NextResponse.json(projectData)
} catch (error) {
console.error("Failed to analyze project:", error)
return NextResponse.json({ error: "Failed to analyze project" }, { status: 500 })
}
}