cosmicstack-labs / mercury-agent
Code health
Hotspots average 4.2, the place fixes pay off most.
Explore this codebase
- Code health map48hotspots across 733 files
- Ownership686sole-owned files: one author, no second reader
- Architecture6modules, 8 entry points
- Decisions42recorded, of which 0 in force and 42 background
- Refactoring54open opportunities, one per file
- TestsNo coverage report yet. Run your tests with coverage on, then add the report:
AlsoDocsChatFilesKnowledge graphChange couplingCommitsStatsCosts
Do next · 4
4 things worth doing in the week to Oct 14, the last indexed commit.
Worth planning
Start breaking up handleMessage (CCN 481, 1,554 lines): first lift lines 2518-2528
src/core/agent.ts:2518
handleMessage nests deeply; easier to read and change once split, which also removes a duplicate; its file is imported by 22 files, changed 62 times in 90 days.
- gain
- up to under +0.1 health on this file(inferred)
- finding
- Nested complexity
- size
- CCN 481, 1,554 lines, nests 7 deep
- severity
- high
Medium effort, worth a checkStart breaking up handleBotsCommand (CCN 276, 758 lines): first lift lines 496-506
src/core/commands/bots-command.ts:496
handleBotsCommand has many paths; easier to read and change once split, which also removes a duplicate; function changed in 7 commits; its file is imported by 3 files, changed 8 times in 90 days.
- gain
- up to +0.6 health on this file(inferred)
- finding
- Complex method
- size
- CCN 276, 758 lines, nests 4 deep
- severity
- high
Medium effort, worth a checkTidy the code shape this week's commits left: 31 findings in 15 files
13 commits in the last 7 days added or worsened long, complex or deeply nested code, still open. Start with
src/bots/bot-manager.ts(5 findings): tidying it while the change is fresh costs less than after the next one.- code-shape findings
- 31
- files
- 15
- commits
- 13
Large effortBreak up TuiApp (CCN 301, 600 lines)
src/ui/App.tsx:621
TuiApp nests deeply; easier to read and change once split, which also removes a duplicate; its file is imported by 12 files, changed 34 times in 90 days.
- gain
- up to under +0.1 health on this file(inferred)
- finding
- Nested complexity
- size
- CCN 301, 600 lines, nests 5 deep
- severity
- high
Medium effort, worth a check
Improve what Repowise can see
Add a test coverage report
Without one, Repowise cannot tell tested code from untested code, so every test-related action says “unknown”.
- line coverage
- Unknown, no report
Small effort
Everything we found
4 areas
Every detector's open count by area. The actions above are the part worth doing.
- Code health2,078 open findingsCriticalChange entropy · src/index.ts92 findings · 8.0 deducted
- Refactoring54 open opportunitiesLowrunUninstall+1.0 health, M effort · src/cli/uninstall.ts
- Decisions0 drifting from the codeMediumsrc/core/agent.tsHigh-churn file with no governing decision
- Ownership686 sole-owned filesMediumsrc/core/agent.tsOne author, no second reader