feat: análisis a nivel proyecto (multi-archivo, clases/herencia, +TS/Go) - #1
Conversation
…oss-file) Fase 1 de project-analysis: - Modelo de grafo enriquecido: NodeKind (module/function/class), file, parent; EdgeKind (calls/imports/extends); SourceFile. - analyzeProject: tabla de símbolos global, resolución de imports por lenguaje (Python dotted/relativo, JS relativo), llamadas cross-file desambiguadas por imports, nodos de módulo + aristas imports. - API /analyze acepta files[] (o code como snippet de 1 archivo) con caps de tamaño/nº. - UI: toggle Snippet|Proyecto, carga de carpeta (webkitdirectory) con filtros (ext, node_modules/.git…) y lista de archivos. - Diagram: layout en dos niveles (sub-dagre por módulo + dagre de módulos), contenedores de módulo, aristas por tipo + leyenda. - Tests cross-file (Python y JS).
- Analizador: detecta clases (Python class_definition, JS class), atribuye métodos a su clase (parent = nodo clase), y resuelve herencia → aristas 'extends' (cross-file vía imports, name-based). - Modelo: nodos type 'class'; jerarquía módulo › clase › método. - Diagram: layout recursivo genérico (N niveles), contenedor unificado módulo/clase con estilo distinto, aristas 'extends' + leyenda actualizada. - Tests: clases/herencia en Python y JS (cross-file).
…Fase 3) - Lenguajes: TypeScript (grammar dedicada) y Go vía tree-sitter-wasms. - jslike: factory compartida JS/TS (DRY); classBases maneja class_heritage (JS) y extends_clause (TS). - Go: call graph intra-paquete vía fallback de definición única (imports por paquete no se mapean a archivos). - LangSpec: campos de clase opcionales (Go no tiene clases). - UI: selector con 4 lenguajes, extensiones y samples por lenguaje. - Diagram: leyenda interactiva para filtrar calls/imports/extends. - API: EXT de snippet para ts/go. - Tests: TS (imports, clases/herencia) y Go (cross-file mismo paquete).
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR replaces single-snippet code analysis with a project-level multi-file engine. Core graph types gain ChangesProject-level analysis engine, CodeWorkspace UI, and Diagram enhancements
Sequence DiagramsequenceDiagram
participant User
participant CodeWorkspace
participant POSTHandler as POST /api/analyze
participant AnalyzerRegistry
participant analyzeProjectWith
User->>CodeWorkspace: select snippet or upload folder
User->>CodeWorkspace: click Analyze (or Ctrl+Enter)
CodeWorkspace->>POSTHandler: POST {code|files, language}
POSTHandler->>POSTHandler: build sources[], enforce MAX_FILES/MAX_TOTAL_BYTES
POSTHandler->>AnalyzerRegistry: getAnalyzer(language)
POSTHandler->>analyzeProjectWith: analyzeProject(sources[])
analyzeProjectWith->>analyzeProjectWith: parseFile per source, resolveOwner, build Graph
analyzeProjectWith-->>POSTHandler: Graph {nodes, edges}
POSTHandler-->>CodeWorkspace: 200 {graph}
CodeWorkspace->>Diagram: render Graph with container layout + edge-kind legend
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Analysis CompleteGenerated ECC bundle from 3 commits | Confidence: 55% View Pull Request #2Repository Profile
Changed Files (18)
Top hotspots
Top directories
Analysis Depth Readiness (commit-history, 21%)ECC Tools uses this to decide whether recommendations should stay at commit-history/setup guidance or expand into CI, security, harness, reference-set, AI-routing, and team backlog work.
Reference Set Readiness (1/7, 14%)
Likely Future Issues (3)
Suggested Follow-up Work (3)
Copy-ready bodies test: add integration coverage for src/app/api/analyze/route.ts ## Summary
- Add integration or end-to-end coverage for the recently changed API surface.
## Why
- Backfill integration or end-to-end coverage for the changed API surface before more contract changes land.
## Touched paths
- `src/app/api/analyze/route.ts`
## Validation
- Add or extend integration / e2e coverage for the changed API, route, or contract surface.
- Exercise the touched endpoints or route handlers against realistic request / response flows.docs: sync API contract for src/app/api/analyze/route.ts ## Summary
- Update the API contract artifact that should reflect the recently changed implementation surface.
## Why
- Backfill the missing API contract or spec update before another implementation change lands on top of the same surface.
## Touched paths
- `src/app/api/analyze/route.ts`
## Validation
- Update the relevant OpenAPI, GraphQL, or contract/spec artifact used by this repo.
- Run the contract validation, docs generation, or API verification flow that depends on that artifact.test: add browser coverage for src/app/[lang]/app/page.tsx + src/components/ui/CodeTool.tsx ## Summary
- Add browser or end-to-end coverage for the recently changed user-facing surface.
## Why
- Backfill browser coverage before another user-facing UI change lands on the touched surface.
## Touched paths
- `src/app/[lang]/app/page.tsx`
- `src/components/ui/CodeTool.tsx`
## Validation
- Add or extend browser / e2e coverage for the changed component, page, or flow.
- Exercise the visible user journey that depends on the touched UI surface.Detected Workflows (3)
Generated Instincts (25)
After merging, import with: Files
|
Resumen
Lleva CodeViz de "analizador de un snippet" a analizador de proyecto. Tres fases:
Fase 1 — Multi-archivo + arquitectura
module/function/class, aristascalls/imports/extends,SourceFile.analyzeProject: tabla de símbolos global, resolución de imports por lenguaje, llamadas cross-file desambiguadas por imports, nodos de módulo + aristasimports./analyzeaceptafiles[](proyecto) ocode(snippet) con límites de tamaño/nº.webkitdirectory) con filtros (extensión,node_modules/.git…).Fase 2 — Clases y herencia
extends(cross-file).Fase 3 — Más lenguajes + filtros
jslikecompartida JS/TS.calls/imports/extends.Limitaciones conocidas (futuro)
Test plan
pnpm tsc --noEmitlimpiopnpm lintlimpiopnpm vitest run— 10 tests (Python, JS, TS, Go: cross-file, clases, herencia)/es/app(modo Proyecto, subir carpeta, filtro de aristas)Summary by CodeRabbit
New Features
Improvements