Skip to content

Conversation

@prosdev
Copy link
Collaborator

@prosdev prosdev commented Nov 27, 2025

Summary

Adds change frequency data to the codebase map, showing how often directories are modified. This helps identify "hot" areas of the codebase.

Changes

Types (packages/core/src/map/types.ts)

  • Added ChangeFrequency interface with:
    • last30Days: Commits in the last 30 days
    • last90Days: Commits in the last 90 days
    • lastCommit: Date of most recent commit
  • Added includeChangeFrequency option to MapOptions
  • Added changeFrequency field to MapNode

Core (packages/core/src/map/index.ts)

  • Added MapGenerationContext interface for flexible input
  • Implemented computeChangeFrequency() function:
    • Collects all directory paths from tree
    • Queries git for commits in each directory (last 90 days)
    • Counts commits in 30-day and 90-day windows
    • Applies data to tree nodes
  • Updated formatCodebaseMap() to display frequency indicators:
    • 🔥 5+ commits this month (hot)
    • ✏️ 1-4 commits this month (active)
    • 📝 commits in last 90 days

Adapter (packages/mcp-server/src/adapters/built-in/map-adapter.ts)

  • Added repositoryPath config option
  • Added includeChangeFrequency parameter to tool schema
  • Creates LocalGitExtractor when change frequency is requested
  • Passes context to generateCodebaseMap()

Tests

  • Added 3 tests for change frequency feature:
    • Include frequency when enabled
    • Skip frequency when disabled
    • Format frequency in output

Example Output

├── packages/ (500 components) 🔥 12 commits this month
│   ├── core/ (200 components) ✏️ 3 commits this month
│   ├── mcp-server/ (150 components) 🔥 8 commits this month
│   └── cli/ (50 components) 📝 5 commits (90d)

Closes

Closes #94

Part of

Epic: Intelligent Git History (v0.4.0) #90

- Add ChangeFrequency type with last30Days, last90Days, lastCommit
- Add includeChangeFrequency option to MapOptions
- Implement computeChangeFrequency using git extractor
- Display frequency indicators in formatted output (🔥 hot, ✏️ active, 📝 recent)
- Update MapAdapter to support change frequency with repositoryPath
- Add MapGenerationContext for flexible indexer + git extractor passing
- Add 3 tests for change frequency feature

Part of Epic: Intelligent Git History (v0.4.0) #90
@prosdev prosdev merged commit f48dfc5 into main Nov 27, 2025
1 check passed
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.

Change frequency in dev_map

1 participant