Skip to content

feat: análisis a nivel proyecto (multi-archivo, clases/herencia, +TS/Go) - #1

Merged
DataDave-Dev merged 3 commits into
mainfrom
feat/project-analysis
Jun 16, 2026
Merged

feat: análisis a nivel proyecto (multi-archivo, clases/herencia, +TS/Go)#1
DataDave-Dev merged 3 commits into
mainfrom
feat/project-analysis

Conversation

@DataDave-Dev

@DataDave-Dev DataDave-Dev commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Resumen

Lleva CodeViz de "analizador de un snippet" a analizador de proyecto. Tres fases:

Fase 1 — Multi-archivo + arquitectura

  • Modelo de grafo enriquecido: nodos module/function/class, aristas calls/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 + aristas imports.
  • API /analyze acepta files[] (proyecto) o code (snippet) con límites de tamaño/nº.
  • UI: toggle Snippet | Proyecto, carga de carpeta (webkitdirectory) con filtros (extensión, node_modules/.git…).
  • Diagram: layout en dos niveles (sub-dagre por módulo + dagre de módulos) con contenedores de módulo.

Fase 2 — Clases y herencia

  • Detección de clases, métodos atribuidos a su clase (jerarquía módulo › clase › método), aristas extends (cross-file).
  • Diagram: layout recursivo genérico (N niveles), contenedor unificado módulo/clase.

Fase 3 — Más lenguajes + filtros

  • +TypeScript (gramática dedicada) y +Go (de 2 a 4 lenguajes), factory jslike compartida JS/TS.
  • Diagram: leyenda interactiva para filtrar calls/imports/extends.

Limitaciones conocidas (futuro)

  • Resolución name-based (sin scope/tipo): nombres iguales colapsan.
  • Go: imports por paquete no se mapean a archivos (call graph intra-paquete sí, vía fallback de definición única).
  • Carga zip aún no soportada (solo carpeta).

Test plan

  • pnpm tsc --noEmit limpio
  • pnpm lint limpio
  • pnpm vitest run — 10 tests (Python, JS, TS, Go: cross-file, clases, herencia)
  • E2E por API en los 4 lenguajes (módulos, imports, calls cross-file, extends)
  • Probado manualmente en /es/app (modo Proyecto, subir carpeta, filtro de aristas)

Summary by CodeRabbit

  • New Features

    • Added Snippet and Project analysis modes: analyze individual code files or upload entire project folders for comprehensive graph generation
    • Interactive visualization legend enabling users to toggle and distinguish between different relationship types (calls, imports, extends)
    • Added support for TypeScript and Go programming languages
  • Improvements

    • Enhanced graph visualization with hierarchical layout, improved container organization, and better module/class grouping

…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).
@ecc-tools

ecc-tools Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Analyzing 200 commits...

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The PR replaces single-snippet code analysis with a project-level multi-file engine. Core graph types gain NodeKind, EdgeKind, and SourceFile. A shared analyzeProjectWith engine handles cross-file resolution; Python, JavaScript, TypeScript, and Go analyzers are added or refactored to use it. The API route gains multi-file input support. CodeTool is replaced by CodeWorkspace with snippet/project modes, and Diagram gains container-aware hierarchical layout with edge-kind filtering.

Changes

Project-level analysis engine, CodeWorkspace UI, and Diagram enhancements

Layer / File(s) Summary
Core graph type contracts and LanguageAnalyzer API
src/lib/analysis/types.ts
Introduces NodeKind, EdgeKind, SourceFile types; extends GraphNode with type/file/parent, GraphEdge with kind; changes LanguageAnalyzer.analyze(code) to analyzeProject(files: SourceFile[]).
Shared project-level analysis engine
src/lib/analysis/analyzers/shared.ts
Expands LangSpec with importQuery, classQuery, classBases, resolveModule; replaces analyzeWith with analyzeProjectWith; adds parseFile, enclosingFunctionName, enclosingClassName, and resolveOwner helpers that build module/class/function nodes and deduplicated call/import/extends edges across files.
Language-specific analyzers and registry
src/lib/analysis/analyzers/jslike.ts, src/lib/analysis/analyzers/python.ts, src/lib/analysis/analyzers/javascript.ts, src/lib/analysis/analyzers/typescript.ts, src/lib/analysis/analyzers/go.ts, src/lib/analysis/registry.ts
Adds jslike.ts factory (makeJsLikeSpec, classBases, resolveModule) used by JavaScript and TypeScript analyzers; expands Python analyzer with class/import hooks; adds Go analyzer (module resolution disabled); registers all four languages in the registry.
API route multi-file support
src/app/api/analyze/route.ts
Adds MAX_TOTAL_BYTES/MAX_FILES limits and language-to-extension map; constructs a sources array from files[] or wraps code as a named snippet file; enforces total-byte limit; calls analyzer.analyzeProject(sources).
CodeWorkspace UI component
src/components/ui/CodeWorkspace.tsx, src/components/ui/CodeTool.tsx, src/app/[lang]/app/page.tsx, src/i18n/dictionaries/en.json, src/i18n/dictionaries/es.json
Adds CodeWorkspace with snippet/project modes, folder upload (filtered by extension/ignore rules), draggable pane splitter, and Ctrl+Enter shortcut; removes CodeTool; updates page to use CodeWorkspace; adds snippetTab, projectTab, uploadFolder, projectHint i18n strings in English and Spanish.
Diagram container-aware layout and edge filtering
src/components/ui/Diagram.tsx
Replaces flat toReactFlow with a layout() pipeline supporting module/class container nodes with hierarchical Dagre positioning; adds ContainerNode renderer; edges styled by kind; adds a legend Panel with per-kind toggle buttons filtering visible edges.
Analyzer tests updated for project API and edge kinds
src/lib/analysis/analyzers/analyzers.test.ts
Refactors tests to use a run(analyzer, files) harness calling analyzeProject; adds kind-aware hasNode/hasEdge predicates; updates Python/JS/TS/Go test cases to assert qualified node ids, explicit edge kinds, class method parenting, and cross-file resolution.

Sequence Diagram

sequenceDiagram
  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
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐇 Hoppity-hop through the AST trees,
Modules and classes now nested with ease!
Snippet or project — pick your own mode,
Dagre lays out every call and import node.
TypeScript, Go, Python, JS in a row —
One little rabbit made the call graph glow! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: análisis a nivel proyecto (multi-archivo, clases/herencia, +TS/Go)' accurately describes the main change: implementing project-level analysis with multi-file support, class/inheritance detection, and TypeScript/Go language support.
Description check ✅ Passed The PR description comprehensively covers the three phases of development, explains the architecture changes, acknowledges known limitations, and includes a test plan confirming all checklist items passed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/project-analysis

Comment @coderabbitai help to get the list of available commands and usage tips.

@ecc-tools

ecc-tools Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Analysis Complete

Generated ECC bundle from 3 commits | Confidence: 55%

View Pull Request #2

Repository Profile
Attribute Value
Language TypeScript
Framework Not detected
Commit Convention conventional
Test Directory colocated
Changed Files (18)
Metric Value
Files changed 18
Additions 1360
Deletions 267

Top hotspots

Path Status +/-
src/components/ui/CodeWorkspace.tsx added +463 / -0
src/components/ui/Diagram.tsx modified +257 / -27
src/lib/analysis/analyzers/shared.ts modified +202 / -25
src/lib/analysis/analyzers/analyzers.test.ts modified +140 / -37
src/components/ui/CodeTool.tsx removed +0 / -128

Top directories

Directory Files Total changes
src/components/ui 3 875
src/lib/analysis/analyzers 7 622
src/app/api/analyze 1 83
src/lib/analysis 2 27
src/i18n/dictionaries 2 12
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.

Area Status Evidence / Next Step
Commit history Partial 3 commits sampled
CI/CD signals Missing Add workflow files or CI troubleshooting evidence so ECC Tools can reason about pipeline setup.
Security evidence Missing Add AgentShield, audit, SARIF, SBOM, or security review evidence so recommendations can cover security posture.
Harness configuration Missing Add Claude, Codex, OpenCode, Zed, dmux, MCP, plugin, or cross-harness config evidence for harness-agnostic recommendations.
Reference/eval evidence Ready src/lib/analysis/analyzers/analyzers.test.ts
AI routing and cost controls Missing Add model-routing, budget, usage, or cost-control files before relying on AI-heavy automation recommendations.
Team handoff and project tracking Missing Add roadmap, runbook, project, Linear, or follow-up tracking docs so generated work can land in a team queue.
Reference Set Readiness (1/7, 14%)
Area Status Evidence / Next Step
Deep analyzer corpus Present src/lib/analysis/analyzers/analyzers.test.ts
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.
Likely Future Issues (3)
Severity Signal Why it may show up
HIGH API contract changes may ship without integration coverage 1 API surface paths changed; 0 integration or e2e tests changed
MEDIUM API implementation changes may ship without contract artifact updates 1 API implementation paths changed; 0 API contract/spec files changed
MEDIUM User-facing UI changes may ship without browser coverage 4 user-facing UI paths changed; 0 browser or e2e coverage files changed
  • API contract changes may ship without integration coverage: The PR changes API or route-facing files but does not touch any obvious integration or end-to-end tests.
  • API implementation changes may ship without contract artifact updates: The PR changes API implementation files but does not touch any obvious OpenAPI, GraphQL, or contract/spec artifact.
  • User-facing UI changes may ship without browser coverage: The PR changes components, pages, or other user-facing UI files without touching any obvious browser or end-to-end coverage.
Suggested Follow-up Work (3)
Type Suggested title Targets
PR test: add integration coverage for src/app/api/analyze/route.ts src/app/api/analyze/route.ts
PR docs: sync API contract for src/app/api/analyze/route.ts src/app/api/analyze/route.ts
PR test: add browser coverage for src/app/[lang]/app/page.tsx + src/components/ui/CodeTool.tsx src/app/[lang]/app/page.tsx, src/components/ui/CodeTool.tsx
  • test: add integration coverage for src/app/api/analyze/route.ts: Backfill integration or end-to-end coverage for the changed API surface before more contract changes land.
  • docs: sync API contract for src/app/api/analyze/route.ts: Backfill the missing API contract or spec update before another implementation change lands on top of the same surface.
  • test: add browser coverage for src/app/[lang]/app/page.tsx + src/components/ui/CodeTool.tsx: Backfill browser coverage before another user-facing UI change lands on the touched surface.

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)
Workflow Description
extend-language-support Adds or enhances support for a programming language in the code analysis engine, including analyzers, test coverage, UI selectors, and registry integration.
feature-development-with-cross-file-analysis Implements a new analysis feature that requires changes across analyzers, UI, API, and tests, especially for cross-file/project-level capabilities.
diagram-ui-enhancement Improves or extends the diagram visualization in the UI, including layout, legend, containers, and interactive filtering.
Generated Instincts (25)
Domain Count
git 4
code-style 10
architecture 1
testing 4
workflow 6

After merging, import with:

/instinct-import .claude/homunculus/instincts/inherited/codeviz-instincts.yaml

Files

  • .claude/ecc-tools.json
  • .claude/skills/codeviz/SKILL.md
  • .agents/skills/codeviz/SKILL.md
  • .agents/skills/codeviz/agents/openai.yaml
  • .claude/identity.json
  • .codex/config.toml
  • .codex/AGENTS.md
  • .codex/agents/explorer.toml
  • .codex/agents/reviewer.toml
  • .codex/agents/docs-researcher.toml
  • .claude/homunculus/instincts/inherited/codeviz-instincts.yaml
  • .claude/commands/extend-language-support.md
  • .claude/commands/feature-development-with-cross-file-analysis.md
  • .claude/commands/diagram-ui-enhancement.md

ECC Tools | Everything Claude Code

@DataDave-Dev
DataDave-Dev merged commit 7c616e5 into main Jun 16, 2026
0 of 2 checks passed
@DataDave-Dev
DataDave-Dev deleted the feat/project-analysis branch June 16, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant