MCPcopy
hub / github.com/codeaashu/claude-code / useCostSummary

Function useCostSummary

src/costHook.ts:6–22  ·  view source on GitHub ↗
(
  getFpsMetrics?: () => FpsMetrics | undefined,
)

Source from the content-addressed store, hash-verified

4import type { FpsMetrics } from './utils/fpsTracker.js'
5
6export function useCostSummary(
7 getFpsMetrics?: () => FpsMetrics | undefined,
8): void {
9 useEffect(() => {
10 const f = () => {
11 if (hasConsoleBillingAccess()) {
12 process.stdout.write('\n' + formatTotalCost() + '\n')
13 }
14
15 saveCurrentSessionCosts(getFpsMetrics?.())
16 }
17 process.on('exit', f)
18 return () => {
19 process.off('exit', f)
20 }
21 }, [])
22}
23

Callers 1

REPLFunction · 0.85

Calls 2

onMethod · 0.80
offMethod · 0.80

Tested by

no test coverage detected