Skip to content

feat: metric quality improvements and DX enhancements #9

@bntvllnt

Description

@bntvllnt

Summary

Collection of metric quality and developer experience improvements identified during deep analysis testing across 4 repos (self + jarvis-cli 279 files + analytics 12 files + logger 13 files).


1. Single-file module cohesion scoring (HIGH)

10/12 modules flagged as JUNK_DRAWER by analyze_forces. But 7 of those are single-file modules where cohesion is meaningless (no internal deps possible with 1 file).

community/ (1 file) → cohesion: 0 → JUNK_DRAWER
impact/    (1 file) → cohesion: 0 → JUNK_DRAWER
search/    (1 file) → cohesion: 0 → JUNK_DRAWER
...5 more

Fix: Label single-file modules as LEAF or N/A instead of JUNK_DRAWER.


2. Tension analysis heuristics for special files (MEDIUM)

analyze_forces recommends splitting:

  • types/index.ts — but this is the design-intentional single source of truth for all types
  • cli.ts — but this is the entry point orchestrator

Recommendations like "Split into analyzer-index.ts and graph-index.ts" would violate the project architecture.

Fix: Add heuristics to suppress split recommendations for:

  • Type hub files (high fan-in, 0 fan-out, all type exports)
  • Entry point files (0 fan-in, high fan-out, bin or CLI patterns)

3. file_context path normalization (MEDIUM)

file_context("src/mcp/index.ts") returns "File not found in graph". Must use "mcp/index.ts" (no src/ prefix). Error message doesn't hint at the correct format.

Fix: Strip common prefixes (src/, lib/, app/) automatically, or include the expected format in the error message.


4. Git churn integration (LOW)

find_hotspots(metric='churn') always returns 0 for all files. The churn metric exists in the data model but is never populated.

Fix: Integrate git log --numstat to compute per-file change frequency. Churn + complexity = high-value hotspot detection.


5. Context-aware nextSteps hints (LOW)

nextSteps in tool responses are static regardless of results. For example, find_dead_exports suggests "check if they're truly unused" even when 0 dead exports are found.

Fix: Conditionally generate hints based on result data (empty results, high counts, specific patterns detected).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions