-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
pkg:corepackages/core - indexer, scanner, vectorpackages/core - indexer, scanner, vector
Description
Branch: feat/stats-aggregation
Priority: Highest
Parent Epic: #145
Type: Story
Description
Implement the data collection infrastructure needed to support dashboard visualizations. This includes extending the IndexStats interface, creating a StatsAggregator class, and updating scanners to track detailed metadata about languages, component types, and package structure.
This is foundational work that must be completed before CLI enhancements or web dashboard can display rich statistics.
Acceptance Criteria
- Extended
IndexStatsinterface includes language breakdown - Extended
IndexStatsinterface includes component type counts - Extended
IndexStatsinterface includes package-level stats (for monorepos) -
StatsAggregatorclass efficiently collects stats during indexing - Scanners (TypeScript, Go) report language and component metadata
- Indexer aggregates stats with <5% performance overhead
- Stats are persisted to state file for retrieval
- Backward compatibility maintained (old state files still work)
Technical Requirements
Storage: Extend existing indexer-state.json file
New Types:
interface DetailedIndexStats extends IndexStats {
byLanguage: Record<SupportedLanguage, LanguageStats>;
byComponentType: Record<ComponentType, number>;
byPackage?: Record<string, PackageStats>;
}New Classes:
StatsAggregatorclass inpackages/core/src/indexer/stats-aggregator.ts- Methods:
addFile(),addComponent(),getAggregatedStats() - Efficient incremental aggregation (no post-processing)
Scanner Updates:
- TypeScript scanner: Report language (TS vs JS) per file
- Go scanner: Report Go language per file
- Both: Include component type in metadata
Testing:
- Unit tests for
StatsAggregator - Integration tests with scanners
- Performance benchmarks (<5% overhead)
- Backward compatibility tests
Files to Create:
packages/core/src/indexer/stats-aggregator.tspackages/core/src/indexer/__tests__/stats-aggregator.test.ts
Files to Modify:
packages/core/src/indexer/types.tspackages/core/src/indexer/index.tspackages/core/src/scanner/typescript.tspackages/core/src/scanner/go.ts
Metadata
Metadata
Assignees
Labels
pkg:corepackages/core - indexer, scanner, vectorpackages/core - indexer, scanner, vector