MCPcopy Index your code
hub / github.com/codeaashu/claude-code / generateHtmlReport

Function generateHtmlReport

src/commands/insights.ts:1947–2646  ·  view source on GitHub ↗
(
  data: AggregatedData,
  insights: InsightResults,
)

Source from the content-addressed store, hash-verified

1945}
1946
1947function generateHtmlReport(
1948 data: AggregatedData,
1949 insights: InsightResults,
1950): string {
1951 const markdownToHtml = (md: string): string => {
1952 if (!md) return ''
1953 return md
1954 .split('\n\n')
1955 .map(p => {
1956 let html = escapeHtml(p)
1957 html = html.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
1958 html = html.replace(/^- /gm, '• ')
1959 html = html.replace(/\n/g, '<br>')
1960 return `<p>${html}</p>`
1961 })
1962 .join('\n')
1963 }
1964
1965 // Build At a Glance section (new 4-part format with links to sections)
1966 const atAGlance = insights.at_a_glance
1967 const atAGlanceHtml = atAGlance
1968 ? `
1969 <div class="at-a-glance">
1970 <div class="glance-title">At a Glance</div>
1971 <div class="glance-sections">
1972 ${atAGlance.whats_working ? `<div class="glance-section"><strong>What's working:</strong> ${escapeHtmlWithBold(atAGlance.whats_working)} <a href="#section-wins" class="see-more">Impressive Things You Did →</a></div>` : ''}
1973 ${atAGlance.whats_hindering ? `<div class="glance-section"><strong>What's hindering you:</strong> ${escapeHtmlWithBold(atAGlance.whats_hindering)} <a href="#section-friction" class="see-more">Where Things Go Wrong →</a></div>` : ''}
1974 ${atAGlance.quick_wins ? `<div class="glance-section"><strong>Quick wins to try:</strong> ${escapeHtmlWithBold(atAGlance.quick_wins)} <a href="#section-features" class="see-more">Features to Try →</a></div>` : ''}
1975 ${atAGlance.ambitious_workflows ? `<div class="glance-section"><strong>Ambitious workflows:</strong> ${escapeHtmlWithBold(atAGlance.ambitious_workflows)} <a href="#section-horizon" class="see-more">On the Horizon →</a></div>` : ''}
1976 </div>
1977 </div>
1978 `
1979 : ''
1980
1981 // Build project areas section
1982 const projectAreas = insights.project_areas?.areas || []
1983 const projectAreasHtml =
1984 projectAreas.length > 0
1985 ? `
1986 <h2 id="section-work">What You Work On</h2>
1987 <div class="project-areas">
1988 ${projectAreas
1989 .map(
1990 area => `
1991 <div class="project-area">
1992 <div class="area-header">
1993 <span class="area-name">${escapeHtml(area.name)}</span>
1994 <span class="area-count">~${area.session_count} sessions</span>
1995 </div>
1996 <div class="area-desc">${escapeHtml(area.description)}</div>
1997 </div>
1998 `,
1999 )
2000 .join('')}
2001 </div>
2002 `
2003 : ''
2004

Callers 1

generateUsageReportFunction · 0.85

Calls 8

escapeHtmlWithBoldFunction · 0.85
markdownToHtmlFunction · 0.85
getHourCountsJsonFunction · 0.85
generateBarChartFunction · 0.85
generateTimeOfDayChartFunction · 0.85
keysMethod · 0.80
escapeHtmlFunction · 0.50

Tested by

no test coverage detected