mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-05-02 00:40:14 +00:00
feat: add shell commands section to CSV and JSON export
This commit is contained in:
parent
260cad9e08
commit
4f2fcf81d8
1 changed files with 19 additions and 0 deletions
|
|
@ -99,6 +99,20 @@ function buildToolRows(projects: ProjectSummary[]): Array<Record<string, string
|
|||
.map(([tool, calls]) => ({ Tool: tool, Calls: calls }))
|
||||
}
|
||||
|
||||
function buildBashRows(projects: ProjectSummary[]): Array<Record<string, string | number>> {
|
||||
const bashTotals: Record<string, number> = {}
|
||||
for (const project of projects) {
|
||||
for (const session of project.sessions) {
|
||||
for (const [cmd, d] of Object.entries(session.bashBreakdown)) {
|
||||
bashTotals[cmd] = (bashTotals[cmd] ?? 0) + d.calls
|
||||
}
|
||||
}
|
||||
}
|
||||
return Object.entries(bashTotals)
|
||||
.sort(([, a], [, b]) => b - a)
|
||||
.map(([cmd, calls]) => ({ Command: cmd, Calls: calls }))
|
||||
}
|
||||
|
||||
function buildProjectRows(projects: ProjectSummary[]): Array<Record<string, string | number>> {
|
||||
return projects.map(p => ({
|
||||
Project: p.projectPath,
|
||||
|
|
@ -158,6 +172,10 @@ export async function exportCsv(periods: PeriodExport[], outputPath: string): Pr
|
|||
parts.push(rowsToCsv(buildToolRows(allProjects)))
|
||||
parts.push('')
|
||||
|
||||
parts.push('# Shell Commands - All')
|
||||
parts.push(rowsToCsv(buildBashRows(allProjects)))
|
||||
parts.push('')
|
||||
|
||||
parts.push('# Projects - All')
|
||||
parts.push(rowsToCsv(buildProjectRows(allProjects)))
|
||||
parts.push('')
|
||||
|
|
@ -185,6 +203,7 @@ export async function exportJson(periods: PeriodExport[], outputPath: string): P
|
|||
generated: new Date().toISOString(),
|
||||
periods: periodData,
|
||||
tools: buildToolRows(allProjects),
|
||||
shellCommands: buildBashRows(allProjects),
|
||||
projects: buildProjectRows(allProjects),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue